private function isPropertyAccessible($name, \ReflectionClass $class)
    {
        $camelized = $this->camelize($name);
        $setter = 'set'.$camelized;
        $getsetter = lcfirst($camelized); // jQuery style, e.g. read: last(), write: last($item)
        $classHasProperty = $class->hasProperty($name);

        if ($this->isMethodAccessible($class, $setter, 1)
            || $this->isMethodAccessible($class, $getsetter, 1)
            || $this->isMethodAccessible($class, '__set', 2)
            || ($classHasProperty && $class->getProperty($name)->isPublic())) {
            return true;
        }

        $singulars = (array) StringUtil::singularify($camelized);

        // Any of the two methods is required, but not yet known
        if (null !== $this->findAdderAndRemover($class, $singulars)) {
            return true;
        }

        return false;
    }
private function isPropertyAccessible($name, \ReflectionClass $class)
    {
        $camelized = $this->camelize($name);
        $setter = 'set'.$camelized;
        $getsetter = lcfirst($camelized); // jQuery style, e.g. read: last(), write: last($item)
        $classHasProperty = $class->hasProperty($name);

        if ($this->isMethodAccessible($class, $setter, 1)
            || $this->isMethodAccessible($class, $getsetter, 1)
            || $this->isMethodAccessible($class, '__set', 2)
            || ($classHasProperty && $class->getProperty($name)->isPublic())) {
            return true;
        }

        $singulars = (array) StringUtil::singularify($camelized);

        // Any of the two methods is required, but not yet known
        if (null !== $this->findAdderAndRemover($class, $singulars)) {
            return true;
        }

        return false;
    }
private function isPropertyAccessible ( $ name , \ ReflectionClass $ class ) { $ camelized = $ this -> camelize ( $ name ) ; $ setter = 'set' . $ camelized ; $ getsetter = lcfirst ( $ camelized ) ; // jQuery style, e.g. read: last(), write: last($item) $ classHasProperty = $ class -> hasProperty ( $ name ) ; if ( $ this -> isMethodAccessible ( $ class , $ setter , 1 ) || $ this -> isMethodAccessible ( $ class , $ getsetter , 1 ) || $ this -> isMethodAccessible ( $ class , '__set' , 2 ) || ( $ classHasProperty && $ class -> getProperty ( $ name ) -> isPublic ( ) ) ) { return true ; } $ singulars = ( array ) StringUtil :: singularify ( $ camelized ) ; // Any of the two methods is required, but not yet known if ( null !== $ this -> findAdderAndRemover ( $ class , $ singulars ) ) { return true ; } return false ; }
Check whether or not a property is writable.

Part of the Symfony package. Symfony license applies.

@param string           $name
@param \ReflectionClass $class
@return bool
Check whether or not a property is writable .