@param mixed $data
@param array $paths
@param string $separator

@return string[]
511102
protected function readArray($data, array $paths, $separator = ' ')
    {
        $extracted = [];

        // Check if there is a separator in the path config and if so extract it and then remove it
        // from the path config.

        if (array_key_exists('separator', $paths) && !is_array($paths['separator'])) {
            $separator = (string)$paths['separator'];
            unset($paths['separator']);
        }

        foreach ($paths as $index => $path) {
            if (is_array($path)) {
                // Since $path is a array the $index with be treated as a path and the result of that
                // path is treated as a array. If the result is not a array then it will be placed in
                // a array to simulate that the result is a array.

                try {
                    $array = $this->accessor->getValue($data, (string)$index);

                    if (!is_array($array) && !$array instanceof Traversable) {
                        $array = [$array];
                    }
                } catch (ExceptionInterface $e) {
                    $array = [];
                }

                $results = [];

                foreach ($array as $value) {
                    if ($path) {
                        $results = array_merge($results, $this->readArray($value, $path, $separator));
                    } else {
                        if ($value = $this->convert($value)) {
                            $results[] = $value;
                        }
                    }
                }

                $extracted[] = $results;
            } else {
                $extracted[] = $this->readString($data, $path);
            }
        }

        // The data is extracted so now its time to combine all the data into strings.

        return $this->combine($extracted, $separator);
    }
1093568
public static function flattenSeparated(array $values, $sep = '.')
    {
        $result = [];
        $stack  = [
            [
                '',
                $values
            ]
        ];

        while (count($stack) > 0) {
            list($prefix, $values) = array_pop($stack);

            foreach ($values as $key => $value) {
                $newKey = $prefix . (string) $key;

                if (is_array($value)) {
                    $stack[] = [
                        $newKey . $sep,
                        $value
                    ];
                } else {
                    $result[$newKey] = $value;
                }
            }
        }

        return $result;
    }
1326310
public static function flatten(array $array, string $separator = null, string $prepend = ''): array
    {
        $flattened = [];

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $flattened = array_merge($flattened, static::flatten($value, $separator, $prepend . $key . $separator));
            } else {
                $flattened[$prepend . $key] = $value;
            }
        }

        return $flattened;
    }
294500
public static function removeByPath(&$data, $path, $separator = '.')
    {
        $nodes = array_values(array_filter(explode($separator, $path), 'strlen'));

        if (empty($nodes)) {
            return false;
        }

        $previous = null;
        $dataTmp = &$data;

        foreach ($nodes as $node) {
            if (is_object($dataTmp)) {
                if (empty($dataTmp->$node)) {
                    return false;
                }

                $previous = &$dataTmp;
                $dataTmp = &$dataTmp->$node;
            } elseif (is_array($dataTmp)) {
                if (empty($dataTmp[$node])) {
                    return false;
                }

                $previous = &$dataTmp;
                $dataTmp = &$dataTmp[$node];
            } else {
                return false;
            }
        }

        // Now, path go to the end, means we get latest node, set value to this node.
        if (is_object($previous)) {
            unset($previous->$node);
        } elseif (is_array($previous)) {
            unset($previous[$node]);
        }

        return true;
    }
400747
public function getPath($separator = ' > ', $includeNode = true)
	{
		$pathNodes = $this->getAncestors(0, $includeNode);
		$items = array();
		foreach ($pathNodes as $node) {
			array_unshift($items, $node->__toString());
		}
		$path = implode($separator, $items);
		
		return $path;
	}
535625
public function split($separator)
    {
        $hash = new Hash(explode((string) $separator, (string) $this));

        return $hash->map(
            function ($value) {
                return new String($value);
            }
        );
    }
1164208
protected function getNested($path = null, $separator = '.')
    {
        if (!$path) {
            return $this->nested;
        }
        $parts = explode($separator, $path);
        $item = array_pop($parts);

        $nested = $this->nested;
        foreach ($parts as $part) {
            if (!isset($nested[$part])) {
                $part = '*';
                if (!isset($nested[$part])) {
                    return [];
                }
            }
            $nested = $nested[$part];
        }

        return isset($nested[$item]) ? $nested[$item] : (isset($nested['*']) ? $nested['*'] : null);
    }
667064
public static function get(array $array, $namespace = null, $separator = '.')
    {
        if (!is_string($namespace)) {
            return $array;
        }

        $keys = explode($separator, $namespace);

        while (count($keys) > 0 and !is_null($array)) {
            $key = array_shift($keys);
            $array = isset($array[$key]) ? $array[$key] : null;
        }

        return $array;
    }
1305558
public function arraySet(array $data, string $path, $value)
    {
        $dot = new Dot($data);
        $dot->set($path, $value);

        return $dot->all();
    }
837401
public function getPropertyName($path = null, $separator = '.')
    {
        $parts = explode($separator, $path);
        $nested = $this->nested;

        $result = [];
        while (($part = array_shift($parts)) !== null) {
            if (!isset($nested[$part])) {
                if (isset($nested['*'])) {
                    $part = '*';
                } else {
                    return implode($separator, array_merge($result, [$part], $parts));
                }
            }
            $result[] = $part;
            $nested = $nested[$part];
        }

        return implode('.', $result);
    }
509095
public static function slashes($path, $separator = DIRECTORY_SEPARATOR, $multiple = true)
    {
        if ($multiple) {
            return preg_replace('#[/\\\\]+#', $separator, $path);
        }
        return str_replace(['/', '\\'], $separator, $path);
    }
1083893
public function parse($data, array $paths = []): iterable
    {
        \assert(\is_array($data) === true || \is_object($data) === true || $data === null);

        $this->paths = $this->normalizePaths($paths);

        $rootPosition = $this->factory->createPosition(
            ParserInterface::ROOT_LEVEL,
            ParserInterface::ROOT_PATH,
            null,
            null
        );

        if ($this->schemaContainer->hasSchema($data) === true) {
            yield $this->createDocumentDataIsResource($rootPosition);
            yield from $this->parseAsResource($rootPosition, $data);
        } elseif ($data instanceof SchemaIdentifierInterface) {
            yield $this->createDocumentDataIsIdentifier($rootPosition);
            yield $this->parseAsIdentifier($rootPosition, $data);
        } elseif (\is_array($data) === true) {
            yield $this->createDocumentDataIsCollection($rootPosition);
            yield from $this->parseAsResourcesOrIdentifiers($rootPosition, $data);
        } elseif ($data instanceof Traversable) {
            $data = $data instanceof IteratorAggregate ? $data->getIterator() : $data;
            yield $this->createDocumentDataIsCollection($rootPosition);
            yield from $this->parseAsResourcesOrIdentifiers($rootPosition, $data);
        } elseif ($data === null) {
            yield $this->createDocumentDataIsNull($rootPosition);
        } else {
            throw new InvalidArgumentException(_(static::MSG_NO_SCHEMA_FOUND, \get_class($data)));
        }
    }
461066
public function joinRows($rows, $separator = ', ')
    {
        $ret = array();
        foreach ($rows as $r) {
            $ret[] = $r.'';
        }

        return implode($separator, $ret);
    }
165494
public static function setByPath(&$data, $path, $value, $separator = '.')
    {
        if (false === strpos($path, $separator)) {
            $data[$path] = $value;

            return true;
        }

        if (!$nodes = Str::toArray($path, $separator)) {
            return false;
        }

        $dataTmp = &$data;

        foreach ($nodes as $node) {
            if (\is_array($dataTmp)) {
                if (empty($dataTmp[$node])) {
                    $dataTmp[$node] = [];
                }

                $dataTmp = &$dataTmp[$node];
            } else {
                // If a node is value but path is not go to the end, we replace this value as a new store.
                // Then next node can insert new value to this store.
                $dataTmp = array();
            }
        }

        // Now, path go to the end, means we get latest node, set value to this node.
        $dataTmp = $value;

        return true;
    }
478898
public static function getStringElements($string, $separator)
    {
        $matches = [];
        $pattern = sprintf('|[^\%s]+|', $separator);
        $matchCount = preg_match_all($pattern, $string, $matches);

        if ($matchCount > 1) {
            return $matches[0];
        }

        return [];
    }
388775
public function findByPath($path, $separator = '/')
    {
        foreach ($this->items as $page) {
            if (implode($separator, $page->getPath()) == $path) {
                return $page;
            } else if ($found = $page->getPages()->findByPath($path, $separator)) {
                return $found;
            }
        }
    }
380814
public static function setByPath(array &$data, $path, $value, $separator = '.')
    {
        $nodes = static::getPathNodes($path, $separator);

        if (empty($nodes)) {
            return false;
        }

        $dataTmp = &$data;

        foreach ($nodes as $node) {
            if (is_array($dataTmp)) {
                if (!isset($dataTmp[$node])) {
                    $dataTmp[$node] = [];
                }

                $dataTmp = &$dataTmp[$node];
            } else {
                // If a node is value but path is not go to the end, we replace this value as a new store.
                // Then next node can insert new value to this store.
                $dataTmp = [];
            }
        }

        // Now, path go to the end, means we get latest node, set value to this node.
        $dataTmp = $value;

        return true;
    }