Example #1
0
 /**
  * @param ProviderInterface $provider
  * @return Authenticator
  */
 public function register(ProviderInterface $provider)
 {
     $provides = $provider->provides();
     if (isset($provides['handlers'])) {
         foreach ($provides['handlers'] as $request => $handler) {
             $this->handle($request, $handler);
         }
     }
     if (isset($provides['manipulators'])) {
         foreach ($provides['manipulators'] as $response => $manipulator) {
             $this->manipulate($response, $manipulator);
         }
     }
     return $this;
 }
Example #2
0
File: Query.php Project: atabak/orm
 /**
  * {@inheritdoc}
  */
 public function where($property, $operator, $value = null)
 {
     if ($value === null) {
         $value = $operator;
         $operator = '=';
     }
     $this->provider->getQueryBuilder()->where($property, $operator, $value);
     return $this;
 }
Example #3
0
 /**
  * Add a packaged configuration (a "provider") to this container.
  *
  * @see ProviderInterface
  *
  * @param ProviderInterface $provider
  *
  * @return void
  */
 public function add(ProviderInterface $provider)
 {
     $provider->register($this);
 }
Example #4
0
 /**
  * Populates the given provider with the relations from the relation config given.
  *
  * @param string            $parentProvider
  * @param array             $relations
  * @param ProviderInterface $provider
  *
  * @since 2.0
  */
 protected function assignRelationsToProvider($parentProvider, $relations, ProviderInterface $provider)
 {
     foreach ($relations as $type => $configs) {
         // Check if we have a valid class
         if (!isset($this->relationClasses[$type])) {
             continue;
         }
         $relationClass = $this->relationClasses[$type];
         // If so assign all the relations for that type
         foreach ($configs as $name => $relationConfig) {
             if (!isset($relationConfig['providerFrom'])) {
                 $relationConfig['providerFrom'] = $parentProvider;
             }
             $relation = new $relationClass($relationConfig);
             $provider->addRelation($name, $relation);
         }
     }
 }
Example #5
0
 /**
  * Send an SMS message.
  *
  * @param string $mobile   The mobile phone number to send a message to.
  * @param string $message  The SMS message.
  *
  * @return bool True on success, false on failure.
  */
 public function send($mobile, $message)
 {
     return $this->provider->send($mobile, $message);
 }
 /**
  * @param ProviderInterface $provider
  */
 public function addProvider(ProviderInterface $provider)
 {
     $this->providers[$provider->getName()] = $provider;
 }
Example #7
0
 /**
  * Registers a provider
  *
  * @param ProviderInterface $provider
  * @param int|\DateInterval $lifeTime Life time in seconds or a \DateInterval instance
  */
 public function registerProvider($provider, $lifeTime = 3600)
 {
     if (!$lifeTime instanceof \DateInterval) {
         $lifeTime = new \DateInterval(sprintf('PT%dS', $lifeTime));
     }
     $this->providers[$provider->getId()] = array('provider' => $provider, 'lifeTime' => $lifeTime);
 }
Example #8
0
 public function add(ProviderInterface $provider)
 {
     $this->provider[$provider->getId()] = $provider;
 }
Example #9
0
 public function disable(array $options = []) : ProviderInterface
 {
     $this->provider->disable($options);
     $this->data['profile'] = $this->provider->getData();
     return $this;
 }
Example #10
0
File: Pool.php Project: echo58/sms
 /**
  * 添加一个短信接口供应商
  *
  * @param ProviderInterface $provider
  * @return $this
  */
 public function registerProvider(ProviderInterface $provider)
 {
     $this->providers[$provider->getName()] = $provider;
     $this->sortProviders();
     return $this;
 }