<commit_before><?php
/**
 * PropertyModel represents a class property definition.
 *
 * PHP version 5
 *
 * @category PHP
 * @package  PHP_Reflect
 * @author   Laurent Laville <<EMAIL>>
 * @license  http://www.opensource.org/licenses/bsd-license.php  BSD License
 * @version  GIT: $Id$
 * @link     http://php5.laurent-laville.org/reflect/
 */

namespace Bartlett\Reflect\Model;

use PhpParser\Node;
use PhpParser\PrettyPrinter;

/**
 * The PropertyModel class reports information about a class property.
 *
 * @category PHP
 * @package  PHP_Reflect
 * @author   <NAME> <<EMAIL>>
 * @license  http://www.opensource.org/licenses/bsd-license.php  BSD License
 * @version  Release: @package_version@
 * @link     http://php5.laurent-laville.org/reflect/
 * @since    Class available since Release 2.0.0RC1
 */
class PropertyModel extends AbstractModel
{
    private $declaringClass;

    /**
     * Creates a new PropertyModel instance.
     *
     */
    public function __construct($class, Node\Stmt\Property $property)
    {
        parent::__construct($property);
        $this->declaringClass = $class;
    }

    /**
     * Gets declaring class
     *
     * @return ClassModel
     */
    public function getDeclaringClass()
    {
        return $this->declaringClass;
    }

    /**
     * Gets the name of the property.
     *
     * @return string
     */
    public function getName()
    {
        return $this->node->props[0]->name;
    }

    /**
     * Gets the property value.
     *
     * @return mixed
     */
    public function getValue()
    {
        if (!empty($this->node->props[0]->default)) {
            $prettyPrinter = new PrettyPrinter\Standard;
            return trim(
                $prettyPrinter->prettyPrintExpr($this->node->props[0]->default),
                '"\''
            );
        }
        return;
    }

    /**
     * Checks if default value.
     *
     * @return bool TRUE if the property was declared at compile-time, or
     *              FALSE if it was created at run-time.
     */
    public function isDefault()
    {
        return !empty($this->node->props[0]->default);
    }

    /**
     * Checks if the property is private.
     *
     * @return bool  TRUE if the property is private, otherwise FALSE
     */
    public function isPrivate()
    {
        return $this->node->isPrivate();
    }

    /**
     * Checks if the property is protected.
     *
     * @return bool  TRUE if the property is protected, otherwise FALSE
     */<commit_msg>FIX property model value (due to upgrade nikic/php-parser 1.4 to 2.1)<commit_after><?php
/**
 * PropertyModel represents a class property definition.
 *
 * PHP version 5
 *
 * @category PHP
 * @package  PHP_Reflect
 * @author   <NAME> <<EMAIL>>
 * @license  http://www.opensource.org/licenses/bsd-license.php  BSD License
 * @version  GIT: $Id$
 * @link     http://php5.laurent-laville.org/reflect/
 */

namespace Bartlett\Reflect\Model;

use PhpParser\Node;

/**
 * The PropertyModel class reports information about a class property.
 *
 * @category PHP
 * @package  PHP_Reflect
 * @author   <NAME> <<EMAIL>>
 * @license  http://www.opensource.org/licenses/bsd-license.php  BSD License
 * @version  Release: @package_version@
 * @link     http://php5.laurent-laville.org/reflect/
 * @since    Class available since Release 2.0.0RC1
 */
class PropertyModel extends AbstractModel
{
    private $declaringClass;

    /**
     * Creates a new PropertyModel instance.
     *
     */
    public function __construct($class, Node\Stmt\Property $property)
    {
        parent::__construct($property);
        $this->declaringClass = $class;
    }

    /**
     * Gets declaring class
     *
     * @return ClassModel
     */
    public function getDeclaringClass()
    {
        return $this->declaringClass;
    }

    /**
     * Gets the name of the property.
     *
     * @return string
     */
    public function getName()
    {
        return $this->node->props[0]->name;
    }

    /**
     * Gets the property value.
     *
     * @return mixed
     */
    public function getValue()
    {
        if (!empty($this->node->props[0]->default->value)) {
            return $this->node->props[0]->default->value;
        }
        return;
    }

    /**
     * Checks if default value.
     *
     * @return bool TRUE if the property was declared at compile-time, or
     *              FALSE if it was created at run-time.
     */
    public function isDefault()
    {
        return !empty($this->node->props[0]->default);
    }

    /**
     * Checks if the property is private.
     *
     * @return bool  TRUE if the property is private, otherwise FALSE
     */
    public function isPrivate()
    {
        return $this->node->isPrivate();
    }

    /**
     * Checks if the property is protected.
     *
     * @return bool  TRUE if the property is protected, otherwise FALSE
     */
{'fraction_non_alphanumeric': 0.12313661425362467, 'fraction_numerical': 0.005309373085562589, 'mean_word_length': 2.1538956857694784, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1443', 'n_tokens_mistral': 1462, 'n_tokens_neox': 1436, 'n_words': 379}