Example #1
0
 /**
  * @param string $scope
  * The scope of the method or function
  *
  * @param string $name
  * The name of the method (with an optional alternate id)
  *
  * @return bool
  */
 private function hasMethodWithScopeAndName(string $scope, string $name)
 {
     if (!empty($this->method_map[$scope][$name])) {
         return true;
     }
     // For elements in the root namespace, check to see if
     // there's a static method signature for something that
     // hasn't been loaded into memory yet and create a
     // method out of it as its requested
     if ('\\' == $scope) {
         $function_signature_map = UnionType::internalFunctionSignatureMap();
         $fqsen = FullyQualifiedFunctionName::make($scope, $name);
         if (!empty($function_signature_map[$name])) {
             $signature = $function_signature_map[$name];
             // Add each method returned for the signature
             foreach (Method::methodListFromSignature($this, $fqsen, $signature) as $method) {
                 $this->addMethod($method);
             }
             return true;
         }
     }
     if (Database::isEnabled()) {
         // Otherwise, check the database
         try {
             MethodModel::read(Database::get(), $scope . '|' . $name);
             return true;
         } catch (NotFoundException $exception) {
             return false;
         }
     } else {
         return false;
     }
 }