PayPal\Core\PPUtils::isAttributeProperty PHP Method

isAttributeProperty() public static method

Determine if a property in a given class is a attribute type.
public static isAttributeProperty ( string $class, string $propertyName ) : string
$class string
$propertyName string
return string
    public static function isAttributeProperty($class, $propertyName)
    {
        if ($annotations = self::propertyAnnotations($class, $propertyName)) {
            return array_key_exists('attribute', $annotations);
        }
        return false;
    }

Usage Example

Example #1
0
 /**
  * @test
  */
 public function testGetAttributeType()
 {
     $this->assertEquals(true, PPUtils::isAttributeProperty('MockReflectionTestType', 'currencyID'));
     $this->assertEquals(false, PPUtils::isAttributeProperty('MockReflectionTestType', 'value'));
     $this->assertEquals(false, PPUtils::isAttributeProperty('MockReflectionTestType', 'noAnnotations'));
 }