Pop\Code\Generator\PropertyGenerator::formatArrayValues PHP Method

formatArrayValues() protected method

Format array value
protected formatArrayValues ( ) : string
return string
    protected function formatArrayValues()
    {
        $ary = str_replace(PHP_EOL, PHP_EOL . $this->indent . '  ', var_export($this->value, true));
        $ary .= ';';
        $ary = str_replace('  );', ');', $ary);
        $ary = str_replace('NULL', 'null', $ary);
        $keys = array_keys($this->value);
        $isAssoc = false;
        for ($i = 0; $i < count($keys); $i++) {
            if ($keys[$i] != $i) {
                $isAssoc = true;
            }
        }
        if (!$isAssoc) {
            for ($i = 0; $i < count($keys); $i++) {
                $ary = str_replace($i . ' => ', '', $ary);
            }
        }
        return $ary;
    }