public static function combine(...$args) { //$args = Arrays::flatten(func_get_args()); $args = Arrays::flatten($args); $i = 0; foreach ($args as $index => $arg) { if (self::rooted($arg)) { $i = $index; } //echo "$index => $arg\n"; } if (self::rooted($lastPath = $args[count($args) - 1])) { return $lastPath; } $path = ''; for (; $i < count($args); $i++) { $arg = $args[$i]; if ($arg !== '/') { $arg = rtrim(strtr($arg, ['\\' => '/']), '/'); } if (self::rooted($arg)) { $path = $arg; } else { if (strlen($path) > 0) { $path .= '/'; } $path .= $arg; } } return $path; }
public static function pop() { if (!empty(static::$handlers)) { ob_end_flush(); $handler = Arrays::peek(static::$handlers); if (isset($handler['close'])) { $handler['close'](); } array_pop(static::$handlers); if (!empty(static::$handlers)) { static::setHandler(Arrays::peek(static::$handlers)); } } }