Symfony\Component\PropertyAccess\PropertyAccessor::isReadable PHP Method

isReadable() public method

public isReadable ( $objectOrArray, $propertyPath )
    public function isReadable($objectOrArray, $propertyPath)
    {
        if (!$propertyPath instanceof PropertyPathInterface) {
            $propertyPath = new PropertyPath($propertyPath);
        }

        try {
            $zval = array(
                self::VALUE => $objectOrArray,
            );
            $this->readPropertiesUntil($zval, $propertyPath, $propertyPath->getLength(), $this->ignoreInvalidIndices);

            return true;
        } catch (AccessException $e) {
            return false;
        } catch (UnexpectedTypeException $e) {
            return false;
        }
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function isReadable($node, $singlePath)
 {
     if (!$singlePath) {
         return false;
     }
     return $this->propertyAccess->isReadable($node, $singlePath);
 }
All Usage Examples Of Symfony\Component\PropertyAccess\PropertyAccessor::isReadable