예제 #1
0
 public static function getBaseRoute($path)
 {
     if (StringHandler::endsWith($path, "Locale")) {
         $path = StringHandler::replaceLast("Locale", "", $path);
     }
     return $path;
 }
예제 #2
0
 /**
  * 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;
 }
예제 #3
0
 /**
  * @dataProvider endsWithProvider
  */
 public function testEndsWith($input, $wanted, $expected)
 {
     $this->assertEquals($expected, StringHandler::endsWith($input, $wanted));
 }