Exemplo n.º 1
0
 /**
  * Extracts handler suffix name from path.
  * eg. 'Service/AdminServiceController'           => 'Service'
  * eg. 'Collection/Content/ResourceCollectionModel' => 'Collection'
  * eg. 'Collection/LogCollection'                   => 'Collection'
  * eg. 'Entity/ResourceEntity'                    => 'Entity'
  * @param string $path
  * @param string $delimiter
  * @return string
  */
 public static final function getHandlerSuffixFromPath($path, $delimiter = '\\')
 {
     Kit::ensureString($path);
     Kit::ensureString($delimiter);
     $handler = self::getHandlerFromPath($path, $delimiter);
     $title_word_list = Kit::separateTitleWords($handler);
     if (Kit::len($title_word_list) > 0) {
         if (TRUE === Kit::in($last_word = Kit::last($title_word_list), self::$handler_suffix_list)) {
             return $last_word;
         }
     }
     throw new UserException("Get handler suffix of \$handler({$handler}) failed.");
 }