src/Schema.php
private function parseProperties(array $arr): array {
        $properties = [];
        $requiredProperties = [];
        foreach ($arr as $key => $value) {
            // Fix a schema specified as just a value.
            if (is_int($key)) {
                if (is_string($value)) {
                    $key = $value;
                    $value = '';
                } else {
                    throw new ParseException("Schema at position $key is not a valid parameter.", 500);
                }
            }

            // The parameter is defined in the key.
            list($name, $param, $required) = $this->parseShortParam($key, $value);

            $node = $this->parseNode($param, $value);

            $properties[$name] = $node;
            if ($required) {
                $requiredProperties[] = $name;
            }
        }
        return [$properties, $requiredProperties];
    }
private function parseProperties(array $arr): array {
        $properties = [];
        $requiredProperties = [];
        foreach ($arr as $key => $value) {
            // Fix a schema specified as just a value.
            if (is_int($key)) {
                if (is_string($value)) {
                    $key = $value;
                    $value = '';
                } else {
                    throw new ParseException("Schema at position $key is not a valid parameter.", 500);
                }
            }

            // The parameter is defined in the key.
            list($name, $param, $required) = $this->parseShortParam($key, $value);

            $node = $this->parseNode($param, $value);

            $properties[$name] = $node;
            if ($required) {
                $requiredProperties[] = $name;
            }
        }
        return [$properties, $requiredProperties];
    }
private function parseProperties ( array $ arr ) : array { $ properties = [ ] ; $ requiredProperties = [ ] ; foreach ( $ arr as $ key => $ value ) { // Fix a schema specified as just a value. if ( is_int ( $ key ) ) { if ( is_string ( $ value ) ) { $ key = $ value ; $ value = '' ; } else { throw new ParseException ( "Schema at position $key is not a valid parameter." , 500 ) ; } } // The parameter is defined in the key. list ( $ name , $ param , $ required ) = $ this -> parseShortParam ( $ key , $ value ) ; $ node = $ this -> parseNode ( $ param , $ value ) ; $ properties [ $ name ] = $ node ; if ( $ required ) { $ requiredProperties [ ] = $ name ; } } return [ $ properties , $ requiredProperties ] ; }
Parse the schema for an object's properties.

@param array $arr An object property schema.
@return array Returns a schema array suitable to be placed in the **properties** key of a schema.
@throws ParseException Throws an exception if a property name cannot be determined for an array item.
Parse the schema for an object s properties .