public static function toArrayFrom($source, $firstLevel = false, $excludeClasses = [], $propertyPattern = null)
    {
        // Prepare the source object type
        $object = new SerializerObject($source);
        $object->setStopFirstLevel($firstLevel);
        $object->setDoNotParse($excludeClasses);
        if (!is_null($propertyPattern)) {
            if (!is_array($propertyPattern)) {
                throw new InvalidArgumentException(
                    'Property pattern must be an array with 2 regex elements (Search and Replace)'
                );
            }
            $object->setMethodPattern($propertyPattern[0], $propertyPattern[1]);
        }
        return $object->build();
    }
public static function toArrayFrom($source, $firstLevel = false, $excludeClasses = [], $propertyPattern = null)
    {
        // Prepare the source object type
        $object = new SerializerObject($source);
        $object->setStopFirstLevel($firstLevel);
        $object->setDoNotParse($excludeClasses);
        if (!is_null($propertyPattern)) {
            if (!is_array($propertyPattern)) {
                throw new InvalidArgumentException(
                    'Property pattern must be an array with 2 regex elements (Search and Replace)'
                );
            }
            $object->setMethodPattern($propertyPattern[0], $propertyPattern[1]);
        }
        return $object->build();
    }
public static function toArrayFrom ( $ source , $ firstLevel = false , $ excludeClasses = [ ] , $ propertyPattern = null ) { // Prepare the source object type $ object = new SerializerObject ( $ source ) ; $ object -> setStopFirstLevel ( $ firstLevel ) ; $ object -> setDoNotParse ( $ excludeClasses ) ; if ( ! is_null ( $ propertyPattern ) ) { if ( ! is_array ( $ propertyPattern ) ) { throw new InvalidArgumentException ( 'Property pattern must be an array with 2 regex elements (Search and Replace)' ) ; } $ object -> setMethodPattern ( $ propertyPattern [ 0 ] , $ propertyPattern [ 1 ] ) ; } return $ object -> build ( ) ; }
Get all properties from a source object as an associative array

@param mixed $source
@param bool $firstLevel
@param array $excludeClasses
@param array|null $propertyPattern
@return array
@throws \ByJG\Serializer\Exception\InvalidArgumentException
Get all properties from a source object as an associative array