public static function getBaseRoute($path) { if (StringHandler::endsWith($path, "Locale")) { $path = StringHandler::replaceLast("Locale", "", $path); } return $path; }
/** * Return the current Theme * * @return \RZ\Roadiz\Core\Entities\Theme */ public function getTheme() { if (null === $this->theme) { $className = static::getCalledClass(); while (!StringHandler::endsWith($className, "App")) { $className = get_parent_class($className); if ($className === false) { $className = ""; break; } if (strpos($className, "\\") !== 0) { $className = "\\" . $className; } } $this->theme = $this->getService('em')->getRepository('RZ\\Roadiz\\Core\\Entities\\Theme')->findOneByClassName($className); } return $this->theme; }
/** * @dataProvider endsWithProvider */ public function testEndsWith($input, $wanted, $expected) { $this->assertEquals($expected, StringHandler::endsWith($input, $wanted)); }