/** * @param $source * @return string */ private function addTarget($source) { if (String::isNotEmpty($this->getTarget())) { $source .= ' target="' . $this->target . '"'; return $source; } return $source; }
/** * Initializing router * * @return mixed */ public function init() { $controller = String::upperFirst(strtolower(Request::get('controller'))); $action = String::lower(Request::get('action')) . 'Action'; $controllerData = ClassHandler::loadController($controller, $action); $controller = new $controllerData['controller'](); if (method_exists($controller, 'init')) { call_user_func(array($controller, 'init')); } return call_user_func(array($controller, $controllerData['action'])); }
/** * @param $controller * @param $directory * @return array|string */ private static function loadSpecificController($controller, Directory $directory) { $className = ''; if (String::isNotEmpty($controller)) { $fileName = self::findControllerFilename($controller, $directory); /** @noinspection PhpIncludeInspection */ include_once $fileName; $className = self::generateClassName($fileName); $className = String::replace('.php', '', implode('\\', $className)); return $className; } return $className; }
/** * @param $source * @return string */ protected function addId($source) { if (String::isNotEmpty($this->getCssId())) { $source .= ' id="' . $this->getCssId() . '"'; return $source; } return $source; }
/** * */ protected function prepareChars() { $this->charsToUse .= self::$chars; if ($this->useSpecialChars) { $this->charsToUse .= self::$specialChars; } if ($this->useUmlauts) { $this->charsToUse .= self::$umlauts; } if ($this->useLowerCase) { $this->charsToUse .= String::lower($this->charsToUse); } if ($this->useUpperCase) { $this->charsToUse .= String::upper($this->charsToUse); } $charArray = Collection::explode($this->charsToUse, ''); if (Collection::isValid($charArray)) { $this->charArray = array_unique($charArray); } }
/** * Replace string * * @param string $key The key * @param string $value The value * * @return void */ private function replaceString($key, $value) { $this->content = String::replace('{ ' . $key . ' }', $value, $this->content); }
/** * */ public function testUpperFirst() { $this->assertEquals('ABc', String::upperFirst('aBc')); }
/** * @param $method * @return string */ private function evaluateMagicMethod($method) { return String::substring($method, 0, 3); }