@param string|int $space

@return Space
438213
public function getSpace($space)
    {
        if (isset($this->spaces[$space])) {
            return $this->spaces[$space];
        }

        if (!is_string($space)) {
            return $this->spaces[$space] = new Space($this, $space);
        }

        $spaceId = $this->getSpaceIdByName($space);

        return $this->spaces[$space] = $this->spaces[$spaceId] = new Space($this, $spaceId);
    }
1146532
public static String getSpaces(int number) {

    Assert.argument(number >= 0, "The number [{0}] of desired spaces must be greater than equal to 0", number);

    StringBuilder spaces = new StringBuilder(Math.max(number, 0));

    while (number > 0) {
      int count = Math.min(SPACES.length - 1, number);
      spaces.append(SPACES[count]);
      number -= count;
    }

    return spaces.toString();
  }
1341869
final private function resizeContent(string $content, int $space = 3):string
    {
        $maxLine = 0;
        $newString = "";
        foreach (preg_split("/((\r?\n)|(\r\n?))/", $content) as $line) {
            if ($maxLine < strlen($line)) {
                $maxLine = strlen($line);
            }
        }

        foreach (preg_split("/((\r?\n)|(\r\n?))/", $content) as $line) {
            $slength = strlen($line);
            $diff = abs($maxLine - $slength);


            $tmpStr = $this->copyContent(" ", $diff);
            $spaceRs = $this->copyContent(" ", $space);
            if ($space != 0) {
                $newString .= $spaceRs.$line.$tmpStr.$spaceRs."\n";
            } else {
                $newString .= "\n".$spaceRs.$line.$tmpStr.$spaceRs." ";
            }
        }
        return ($newString);
    }
447374
public static function iniSizeToBytes($size)
    {
        if (\is_numeric($size)) {
            return (int)$size;
        }

        $suffix = \strtoupper(\substr($size, -1));
        $strippedSize = \substr($size, 0, -1);

        if (!\is_numeric($strippedSize)) {
            throw new \InvalidArgumentException("$size is not a valid ini size");
        }

        if ($strippedSize <= 0) {
            throw new \InvalidArgumentException("Expect $size to be higher isn't zero or lower");
        }

        if ($suffix === 'K') {
            return $strippedSize * 1024;
        }
        if ($suffix === 'M') {
            return $strippedSize * 1024 * 1024;
        }
        if ($suffix === 'G') {
            return $strippedSize * 1024 * 1024 * 1024;
        }
        if ($suffix === 'T') {
            return $strippedSize * 1024  * 1024 * 1024 * 1024;
        }

        return (int)$size;
    }
360287
public function setLength($length)
    {
        $length = intval($length);
        $this->length = empty($length) ? 1 : $length;

        return $this;
    }
1064022
public static function core($str)
    {
        $str = _String::normalizePunctuationSpaces($str);
        $str = mb_strtolower(trim($str));
        $str = _String::normalizeSpaces($str);
        return $str;
    }
688376
public function limit(int $length)
    {
        $string = $this->string;

        if ($this->length() > $length) {
            $string = substr($string, 0, $length);
        }

        return new static($string, $this->encoding);
    }
932524
public Cell<C,T> space (float space) {
		if (space < 0) throw new IllegalArgumentException("space cannot be < 0.");
		Value<C,T> value = new FixedValue<C, T>(layout.toolkit,space);
		spaceTop = value;
		spaceLeft = value;
		spaceBottom = value;
		spaceRight = value;
		return this;
	}
497406
public function getNamespaceByName( $name ) {
		$result = $this->getNamespaceResult()['query'];
		foreach ( $result['namespaces'] as $nsInfo ) {
			if ( ( !empty( $nsInfo['canonical'] ) && $nsInfo['canonical'] === $name ) ||
				$nsInfo['*'] === $name ) {
				return $this->createNamespaceFromQuery( $nsInfo, $result['namespacealiases'] );
			}
		}
		foreach ( $result['namespacealiases'] as $alias ) {
			if ( $alias['*'] === $name && !empty( $result['namespaces'][$alias['id']] ) ) {
				return $this->createNamespaceFromQuery(
					$result['namespaces'][$alias['id']],
					$result['namespacealiases']
				);
			}
		}
		return null;
	}
1174287
protected function _normalizeNamespace($name)
    {
        if (isset($this->_c_normalizedNames[$name]))
            return $this->_c_normalizedNames[$name];

        $canonicalName = strtolower(
            strtr($name, array(' ' => '', '\\' => self::SEPARATOR))
        );

        return $this->_c_normalizedNames[$name] = $canonicalName;
    }
1240473
public function backspace($spaces = 1, $destructive = false)
	{
		echo chr(27) . "[" . (int)$spaces . "D";

		if ($destructive)
		{
			for ($i=0; $i < $spaces; $i++)
			{
				echo chr(32);
			}

			echo chr(27) . "[" . (int)$spaces . "D";
		}

		return $this;
	}
854492
private function getParametersForNameSpace($namespace)
    {
        $parameters = array();
        foreach ($this->parameters as $key => $value) {
            if (0 === strpos($key, $namespace . ':')) {
                $parameters[substr($key, strlen($namespace) + 1)] = $value;
            }
        }
        return $parameters;
    }
409089
function nest(Container $container, $namespace = null)
    {
        // Use Container Namespace if not provided as argument
        ($namespace !== null) ?: $namespace = $container->getName();

        if ($namespace === null || $namespace === '')
            throw new \InvalidArgumentException(
                'Namespace can`t be empty.'
            );

        $cNamespace = $this->_normalizeNamespace($namespace);
        if (isset($this->__nestRight[$cNamespace]))
            throw new \InvalidArgumentException(sprintf(
                'Namespace (%s) is exists on container:%s'
                , $namespace , $this->getPath()
            ));

        $nestedCnt = $container;
        $nestedCnt->__nestLeft = $this; // set parent container
        $nestedCnt->setName($namespace);
        $this->__nestRight[$cNamespace] = $nestedCnt;
        return $this;
    }
1001496
public function removeNamespace($string)
    {
        $prefix = $this->namespace;

        if (substr($string, 0, strlen($prefix)) == $prefix) {
            $string = substr($string, strlen($prefix), strlen($string));
        }

        return $string;
    }
324909
public function match($token, $ignoreSpaces = true)
    {
        switch($token) {
        case Tokens::T_WHITESPACE:
            $pos = $this->getPosAfterSpaces($this->pos);

            $spaces = substr($this->value, $this->pos, $pos - $this->pos);

            $this->pos = $pos;
            return $spaces;
        case Tokens::T_IDENTIFIER:
            if($ignoreSpaces) {
                $this->ignoreSpaces();
            }
            //
            if(preg_match('/^[\w\d_]+/i', substr($this->value, $this->pos), $matches))
            {
                $identifier = $matches[0];
                $this->pos += strlen($identifier);
                return $identifier;
            }

            throw new \InvalidArgumentException(sprintf('T_IDENTIFIER is not matched with next token.'));
            break;
        default:
            $literal = $this->literals->getLiteralForToken($token);
            
            if($this->literals->isSpace($literal)) {
                $ignoreSpaces = false;
            }
            if($ignoreSpaces) {
                $this->ignoreSpaces();
            }
            // If next token is match with the literal, forward the point
            if($literal !== substr($this->value, $this->pos, strlen($literal))) {
                throw new \InvalidArgumentException(sprintf('Token "%s" is not match with next token on "%s"', $literal, substr($this->value, $this->pos)));
            }
            // 
            $this->pos += strlen($literal);

            return $literal;
            break;
        }
    }
1191778
public function write(string $data): int
    {
        $dataLength    = strlen($data);
        $this->doWrite($data, $this->offset, $dataLength);
        $this->offset += $dataLength;
        return $dataLength;
    }
575279
private function computeIndentationSpaces($keyword)
    {
        if ($this->align === self::ALIGN_TO_RIGHT) {
            return (self::INDENTATION * 2) - strlen(trim($keyword)) + 1;
        }

        return self::INDENTATION;
    }