/** * Reduce code duplication * * @param string $path * @param string $cabin * @return array (array $publicPath, int|null $root) */ protected function loadCommonData(string $path, string $cabin) : array { if (!$this->permCheck()) { \Airship\redirect($this->airship_cabin_prefix); } $root = null; $publicPath = \Airship\chunk($path); $pathInfo = $this->getPath($path); if (!empty($pathInfo)) { try { $root = $this->files->getDirectoryId($pathInfo, $cabin); } catch (FileNotFound $ex) { \Airship\redirect($this->airship_cabin_prefix); } } // return [$pathInfo, $publicPath, $root]; return [$publicPath, $root]; }