original_string: public function getEntityName($_route = null)
      {
          if($_route == null) {
              $request = $this->get('request_stack')->getCurrentRequest();
              $_route = $request->attributes->get('_route');
          }
          $parts = explode('.', $_route);
          if(count($parts) == 2) {
              $namespace = $parts[0];
          }
          $_route = end($parts);
          $parts = explode('_', $_route);
          if(count($parts) > 1) {
              $entity = $parts[count($parts)-2];
          } else {
              $parts = explode(':', $_route);
              if(count($parts) == 2) {
                  $entity = strtolower($parts[1]);
              }
          }
          //if((count($parts)-2) == -1) die(var_dump($_route));
          //die(var_dump(count($parts)));
          //die(var_dump($entity));
          return $entity;
      }
code: public function getEntityName($_route = null)
      {
          if($_route == null) {
              $request = $this->get('request_stack')->getCurrentRequest();
              $_route = $request->attributes->get('_route');
          }
          $parts = explode('.', $_route);
          if(count($parts) == 2) {
              $namespace = $parts[0];
          }
          $_route = end($parts);
          $parts = explode('_', $_route);
          if(count($parts) > 1) {
              $entity = $parts[count($parts)-2];
          } else {
              $parts = explode(':', $_route);
              if(count($parts) == 2) {
                  $entity = strtolower($parts[1]);
              }
          }
          //if((count($parts)-2) == -1) die(var_dump($_route));
          //die(var_dump(count($parts)));
          //die(var_dump($entity));
          return $entity;
      }
code_tokens: public function getEntityName ( $ _route = null ) { if ( $ _route == null ) { $ request = $ this -> get ( 'request_stack' ) -> getCurrentRequest ( ) ; $ _route = $ request -> attributes -> get ( '_route' ) ; } $ parts = explode ( '.' , $ _route ) ; if ( count ( $ parts ) == 2 ) { $ namespace = $ parts [ 0 ] ; } $ _route = end ( $ parts ) ; $ parts = explode ( '_' , $ _route ) ; if ( count ( $ parts ) > 1 ) { $ entity = $ parts [ count ( $ parts ) - 2 ] ; } else { $ parts = explode ( ':' , $ _route ) ; if ( count ( $ parts ) == 2 ) { $ entity = strtolower ( $ parts [ 1 ] ) ; } } //if((count($parts)-2) == -1) die(var_dump($_route)); //die(var_dump(count($parts))); //die(var_dump($entity)); return $ entity ; }
docstring: return entity name as "entity"
docstring_tokens: return entity name as entity