Normalize Array Path Stored On Class

@return $this
344761
function normalize()
    {
        $normalized = array();
        $paths      = $this->getPath();

        if (empty($paths))
            return $normalized;

        // Replace "~" with user's home directory.
        if ('~' === $paths[0]) {
            $home  = explode($this->getSeparator(), str_replace('\\', '/', $this->_getHomeDir()));
            $paths = $paths + $home;
        }

        $isRoot = $this->_isRoot($paths[0]);
        $paths  = array_filter($paths, function($p, $i) use (&$isRoot, $paths) {
            if ( ($isRoot && $i > 0) || $i+1 == count($paths) /* keep last slash remain */) {
                // keep last slash /go/to/path/
                // keep first slash after root if exists
                //   phar://path/to/res
                $isRoot = false;
                return true;
            }

            // Remove all ['',] from path
            // on appended path we don't want any absolute sign in
            // array list
            return ($p !== '' && $p !== '.');
        }, ARRAY_FILTER_USE_BOTH);

        // Collapse ".." with the previous part, if one exists
        // Don't collapse ".." if the previous part is also ".."
        foreach ($paths as $path) {
            if (   '..' === $path && count($normalized) > 0      // keep first segment
                && '..' !== $normalized[count($normalized) - 1]
            ) {
                if (! $this->_isRoot($normalized[count($normalized) - 1]) )
                    array_pop($normalized);

                continue;
            }

            $normalized[] = $path;
        }

        $this->setPath($normalized);
        return $this;
    }
472050
public function _loadArray()
	{
		$rawData = $this->getRawData();
		$value = $this->_postgresqlArrayDecode($rawData);
		$value = $value ?: [];
		$this->getModel()->setAttribute($this->getArrayFieldName(), $value);

		return $this;
	}
1176848
protected function normalizePath($path) {
		$path = realpath(rtrim($path, DIRECTORY_SEPARATOR));
		
		if ($path === false || ! is_readable($path)) {
			require_once __DIR__ . '/Exceptions/InvalidPath.php';
			throw new InvalidPath('Directory "' . $path . '" does not exists or is unreadable');
		}
		
		return $path;
	}
101287
public function clear()
    {
        $this->defaults = [];
        $this->types = [];
        $this->requires = [];
        $this->notNullables = [];

        return $this;
    }
259861
public function setFiles()
    {
        $this->files = [];
        $path = $this->getValue();

        if (!preg_match('#^/#', $path)) {
            $path = $this->parser->getServer()->getPrefix().'/'.$path;
        }

        $iterator = new GlobIterator($path);
        foreach ($iterator as $path) {
            $this->files[] = $path;
        }

        return $this;
    }
626174
public function normalize() {
		$j = $this->getLength();
		if($j === 0) {
			throw new Exception('Cannot normalize zero length vector');
		}
		$j *= $j;
		$components = array();
		foreach($this->components as $component) {
			$components[] = sqrt(($component * $component) / $j);
		}
		$this->components = $components;
		return $this;
	}
833143
public function normalizePath($path)
    {
        $realpath = realpath($path);
        if ($realpath) {
            $path = $realpath;
        }

        $path = str_replace('\\', '/', $path);
        $path = rtrim($path, '/');
        if (substr($path, 1, 1) === ':') {
            $path = lcfirst($path);
        }

        return $path;
    }
136799
public static function normalize($path)
    {
        $path = self::expandParentLinks($path);
        $path = self::tidy($path);
        return $path;
    }
1269423
protected static function normalizePath($path)
    {
        $pathAry = explode('/', $path);
        $i       = 1;

        do {
            if ('.' == $pathAry[$i]) {
                if ($i < count($pathAry) - 1) {
                    array_splice($pathAry, $i, 1);
                } else {
                    $pathAry[$i] = '';
                    $i++;
                }

            } elseif ('..' == $pathAry[$i]) {
                if (1 == $i) {
                    array_splice($pathAry, 1, 1);

                } elseif ('..' != $pathAry[$i - 1]) {
                    if ($i < count($pathAry) - 1) {
                        array_splice($pathAry, $i - 1, 2);
                        $i--;
                    } else {
                        array_splice($pathAry, $i - 1, 2, '');
                    }
                }

            } else {
                $i++;
            }
        } while ($i < count($pathAry));

        return implode('/', $pathAry);
    }
674286
public function normalizeValues()
    {
        $persistedAttributes = array();
        foreach ($this->values as $value) {
            $persistedAttributes[] = $value->getAttribute();
        }

        $missingAttributes = array_diff($this->getAttributes()->toArray(), $persistedAttributes);

        foreach ($missingAttributes as $attribute) {
            $value = $attribute->buildNewValue();
            $value->setValueSet($this);
            $this->addValue($value);
            $value->setAttribute($attribute);
        }

        return $this;
    }
1087334
public function setPath($path)
    {
        if (is_array($path)) {
            $this->path = '/' . implode('/', $path);
        } else {
            $this->path = (string) $path;
        }

        return $this;
    }
1170808
def normalize_path(path)
      if path.is_a?(String)
        path.split(':')
      elsif path.respond_to?(:each)
        path
      else
        [path]
      end
    end
1178623
private function normalizeFields()
    {
        foreach ($this->fields as $key => $field) {
            if (is_array($field)) {
                $this->fields[$key] = \Meare\Juggler\json_object($field);
            }
        }
    }
451357
public function normalize(?string $path): ?string
    {
        if ($this->preferredDirectorySeparator === $this->directorySeparator) {
            return $path;
        }

        if (null === $path) {
            return $path;
        }

        return implode($this->preferredDirectorySeparator, explode($this->directorySeparator, $path));
    }
331143
protected function normalizeItems()
    {
        foreach ($this->items as $index => $item) {
            $this->items[$index] = $this->normalizeItem( $item, $index );
        }
    }
50187
private function normalize() : array {
    $files = [];

    foreach($_FILES as $key => $file) {
      
      if (!is_array($file['name'])) {
          $files[$key][] = $file;
          continue;
      }

      foreach($file['name'] as $subKey => $name) {
          $files[$key][$subKey] = [
              'name' => $name,
              'type' => $file['type'][$subKey],
              'tmp_name' => $file['tmp_name'][$subKey],
              'error' => $file['error'][$subKey],
              'size' => $file['size'][$subKey]
          ];
      }
    }

    return $files;
  }
242035
private function normalizePaths(iterable $paths): array
    {
        $separator = DocumentInterface::PATH_SEPARATOR;

        // convert paths like a.b.c to paths that actually should be used a, a.b, a.b.c
        $normalizedPaths = [];
        foreach ($paths as $path) {
            $curPath = '';
            foreach (\explode($separator, $path) as $pathPart) {
                $curPath                   = empty($curPath) === true ? $pathPart : $curPath . $separator . $pathPart;
                $normalizedPaths[$curPath] = true;
            }
        }

        return $normalizedPaths;
    }