Esempio n. 1
0
 /**
  * Return name
  *
  * @return string
  *
  * @since 1.0.0
  */
 public function getName()
 {
     if (empty($this->name)) {
         $reflection = new ReflectionClass(__CLASS__);
         $self_class_name = strtolower($reflection->getShortName());
         $class_parts = explode('_', Inflector::underscore(get_called_class()));
         $class_name = implode(array_slice($class_parts, array_search($self_class_name, $class_parts) + 1));
         if (empty($class_name)) {
             $remove_parts = [];
             $remove_parts[] = $self_class_name;
             $remove_parts[] = strtolower($this->getContainer('application')->getName());
             $class_name = implode(array_unique(array_diff($class_parts, $remove_parts)));
         }
         $this->name = $class_name;
     }
     return $this->name;
 }