src/Encoder/ArrayEncoder.php
private function getAlignedArray(array $array, $depth, array $options, callable $encode)
    {
        $next = 0;
        $omit = $options['array.omit'];

        foreach (array_keys($array) as $key) {
            if ($key !== $next++) {
                $omit = false;
                break;
            }
        }

        return $omit
            ? $this->getFormattedArray($array, $depth, $options, $encode)
            : $this->buildArray($this->getAlignedPairs($array, $encode), $depth, $options);
    }
private function getAlignedArray(array $array, $depth, array $options, callable $encode)
    {
        $next = 0;
        $omit = $options['array.omit'];

        foreach (array_keys($array) as $key) {
            if ($key !== $next++) {
                $omit = false;
                break;
            }
        }

        return $omit
            ? $this->getFormattedArray($array, $depth, $options, $encode)
            : $this->buildArray($this->getAlignedPairs($array, $encode), $depth, $options);
    }
private function getAlignedArray ( array $ array , $ depth , array $ options , callable $ encode ) { $ next = 0 ; $ omit = $ options [ 'array.omit' ] ; foreach ( array_keys ( $ array ) as $ key ) { if ( $ key !== $ next ++ ) { $ omit = false ; break ; } } return $ omit ? $ this -> getFormattedArray ( $ array , $ depth , $ options , $ encode ) : $ this -> buildArray ( $ this -> getAlignedPairs ( $ array , $ encode ) , $ depth , $ options ) ; }
Returns the PHP code for aligned array accounting for omitted keys and inline arrays.
@param array $array Array to encode
@param int $depth Current indentation depth of the output
@param array $options List of encoder options
@param callable $encode Callback used to encode values
@return string The PHP code representation for the array
Returns the PHP code for aligned array accounting for omitted keys and inline arrays .