/** * @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; }
/** * {@inheritdoc} */ public function where($property, $operator, $value = null) { if ($value === null) { $value = $operator; $operator = '='; } $this->provider->getQueryBuilder()->where($property, $operator, $value); return $this; }
/** * Add a packaged configuration (a "provider") to this container. * * @see ProviderInterface * * @param ProviderInterface $provider * * @return void */ public function add(ProviderInterface $provider) { $provider->register($this); }
/** * 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); } } }
/** * 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; }
/** * 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); }
public function add(ProviderInterface $provider) { $this->provider[$provider->getId()] = $provider; }
public function disable(array $options = []) : ProviderInterface { $this->provider->disable($options); $this->data['profile'] = $this->provider->getData(); return $this; }
/** * 添加一个短信接口供应商 * * @param ProviderInterface $provider * @return $this */ public function registerProvider(ProviderInterface $provider) { $this->providers[$provider->getName()] = $provider; $this->sortProviders(); return $this; }