public function generate($value): array
    {
        $schema = [];
        switch (gettype($value)) {
            case 'NULL':
                $schema['type'] = 'null';
                break;
            case 'boolean':
                $schema['type'] = 'boolean';
                break;
            case 'integer':
                $schema['type'] = 'integer';
                break;
            case 'double':
                $schema['type'] = 'number';
                break;
            case 'string':
                $schema = $this->generateStringSchema($value);
                break;
            case 'array':
                $isDictionary = array_keys($value) !== range(0, count($value) - 1);
                if ($isDictionary) {
                    $schema = $this->generateDictionarySchema($value);
                } else {
                    $schema = $this->generateArraySchema($value);
                }
                break;
        }
        return $schema;
    }
public function generate($value): array
    {
        $schema = [];
        switch (gettype($value)) {
            case 'NULL':
                $schema['type'] = 'null';
                break;
            case 'boolean':
                $schema['type'] = 'boolean';
                break;
            case 'integer':
                $schema['type'] = 'integer';
                break;
            case 'double':
                $schema['type'] = 'number';
                break;
            case 'string':
                $schema = $this->generateStringSchema($value);
                break;
            case 'array':
                $isDictionary = array_keys($value) !== range(0, count($value) - 1);
                if ($isDictionary) {
                    $schema = $this->generateDictionarySchema($value);
                } else {
                    $schema = $this->generateArraySchema($value);
                }
                break;
        }
        return $schema;
    }
public function generate ( $ value ) : array { $ schema = [ ] ; switch ( gettype ( $ value ) ) { case 'NULL' : $ schema [ 'type' ] = 'null' ; break ; case 'boolean' : $ schema [ 'type' ] = 'boolean' ; break ; case 'integer' : $ schema [ 'type' ] = 'integer' ; break ; case 'double' : $ schema [ 'type' ] = 'number' ; break ; case 'string' : $ schema = $ this -> generateStringSchema ( $ value ) ; break ; case 'array' : $ isDictionary = array_keys ( $ value ) !== range ( 0 , count ( $ value ) - 1 ) ; if ( $ isDictionary ) { $ schema = $ this -> generateDictionarySchema ( $ value ) ; } else { $ schema = $ this -> generateArraySchema ( $ value ) ; } break ; } return $ schema ; }
Generate a schema for the given value

@param mixed $value value to create a schema for
@return array schema as array structure
Generate a schema for the given value