/**
  * Returns true if the given method is valid.
  *
  * @param string $api
  * @param string $method
  *
  * @return bool
  */
 protected function isValidMethod($api, $method)
 {
     $apiService = $this->serviceFactory->getObject($api);
     // validate the method
     $availableMethods = [];
     foreach (get_class_methods($apiService) as $serviceMethod) {
         // the comparison must be case insensitive
         $availableMethods[strtolower($serviceMethod)] = true;
     }
     return isset($availableMethods[$method]);
 }
Exemple #2
0
 /**
  * Returns the CApiInstance object for the requested API.
  *
  * NOTE: This method must only be called from other CApiService objects.
  *
  * @param string $name
  *
  * @return CApiService
  */
 public static function getApiService($name = null)
 {
     return self::$apiServiceFactory->getObject($name ? $name : 'api');
 }