Adamgoose\Routing\Annotations\MethodEndpoint::hasPaths PHP Method

hasPaths() public method

Determine if the endpoint has any paths.
public hasPaths ( ) : boolean
return boolean
    public function hasPaths()
    {
        return count($this->paths) > 0;
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function modify(MethodEndpoint $endpoint, ReflectionMethod $method)
 {
     if ($endpoint->hasPaths()) {
         foreach ($endpoint->getPaths() as $path) {
             $path->middleware = array_merge($path->middleware, (array) $this->value);
         }
     } else {
         $endpoint->middleware = array_merge($endpoint->middleware, (array) $this->value);
     }
 }