src/Micrometa/Infrastructure/Factory/ProfiledNamesFactory.php
protected static function createProfiledNameFromArray(array $arg, &$profile)
    {
        // If it's an associative array containing a "name" key
        if (array_key_exists('name', $arg)) {
            return self::createProfiledNameFromObject((object)$arg, $profile);
        }

        // If the argument has two items at least
        if (count($arg) > 1) {
            $name    = array_shift($arg);
            $profile = trim(array_shift($arg)) ?: null;

            return self::createProfiledNameFromString($name, $profile);
        }

        throw new InvalidArgumentException(
            InvalidArgumentException::INVALID_TYPE_PROPERTY_ARRAY_STR,
            InvalidArgumentException::INVALID_TYPE_PROPERTY_ARRAY
        );
    }
protected static function createProfiledNameFromArray(array $arg, &$profile)
    {
        // If it's an associative array containing a "name" key
        if (array_key_exists('name', $arg)) {
            return self::createProfiledNameFromObject((object)$arg, $profile);
        }

        // If the argument has two items at least
        if (count($arg) > 1) {
            $name    = array_shift($arg);
            $profile = trim(array_shift($arg)) ?: null;

            return self::createProfiledNameFromString($name, $profile);
        }

        throw new InvalidArgumentException(
            InvalidArgumentException::INVALID_TYPE_PROPERTY_ARRAY_STR,
            InvalidArgumentException::INVALID_TYPE_PROPERTY_ARRAY
        );
    }
protected static function createProfiledNameFromArray ( array $ arg , & $ profile ) { // If it's an associative array containing a "name" key if ( array_key_exists ( 'name' , $ arg ) ) { return self :: createProfiledNameFromObject ( ( object ) $ arg , $ profile ) ; } // If the argument has two items at least if ( count ( $ arg ) > 1 ) { $ name = array_shift ( $ arg ) ; $ profile = trim ( array_shift ( $ arg ) ) ? : null ; return self :: createProfiledNameFromString ( $ name , $ profile ) ; } throw new InvalidArgumentException ( InvalidArgumentException :: INVALID_TYPE_PROPERTY_ARRAY_STR , InvalidArgumentException :: INVALID_TYPE_PROPERTY_ARRAY ) ; }
Create a profiled name from an array argument

@param array $arg                   Array argument
@param string|boolean|null $profile Profile

@return \stdClass Profiled name
@throws InvalidArgumentException If the array definition is invalid
Create a profiled name from an array argument