PayPal\Core\PPUtils::objectProperties PHP Method

objectProperties() public static method

public static objectProperties ( object $object ) : array
$object object
return array
    public static function objectProperties($object)
    {
        $props = array();
        foreach (get_object_vars($object) as $property => $default) {
            $annotations = self::propertyAnnotations($object, $property);
            if (isset($annotations['name'])) {
                $props[strtolower($annotations['name'])] = $property;
            }
            $props[strtolower($property)] = $property;
        }
        return $props;
    }

Usage Example

Example #1
0
 /**
  * @test
  */
 public function testGetProperties()
 {
     $o = new MockReflectionTestType();
     $ret = PPUtils::objectProperties($o);
     //TODO: Check count
     $this->assertEquals(6, count($ret), "Not all properties have been read");
     $this->assertEquals('fieldWithSpecialChar', $ret['fieldwith-specialchar']);
 }
All Usage Examples Of PayPal\Core\PPUtils::objectProperties