/** * Delegate call to command helper classes * * @param string $method * @param string $arguments * @return mixed * @author Sergey Startsev */ public function __call($method, $arguments) { $helper = 'afs' . ucfirst(afsConsoleHelper::getOsType()) . 'ConsoleCommandHelper'; if (!class_exists($helper)) { throw new afsConsoleCommandHelperException("This '{$helper}' adaptee doesn't exists"); } $reflection = new ReflectionClass($helper); $instance = $reflection->newInstance(); if (!method_exists($instance, $method)) { throw new afsConsoleCommandHelperException("Method '{$method}' doesn't exists in '{$helper}' helper"); } return call_user_func_array(array($instance, $method), $arguments); }
/** * Getting pwd command result * * @return string * @author Sergey Startsev */ public function getPwd() { if (empty($this->pwd)) { if (afsConsoleHelper::isUnixLikeOs()) { $pwd = afsFileSystem::create()->execute('pwd'); $this->pwd = strlen($pwd[1]) == 0 ? $pwd[0] : ''; } $session = new Session(); if ($session->get('pwd')) { $this->pwd = $session->get('pwd'); } } return $this->pwd; }