/**
  * @param Identity $identity
  * @param string $channel
  * @return mixed
  * @throws \Exception
  */
 protected function verifyThatIdentityCanAccessChannel(Identity $identity, $channel)
 {
     foreach ($this->channels as $key => $callback) {
         if (!StrUtil::is($key, $channel)) {
             continue;
         }
         $parameters = $this->getAuthenticationParameters($key, $channel);
         if ($response = $callback($identity, ...$parameters)) {
             return $this->validAuthenticationResponse($identity, $response);
         }
     }
     throw new \Exception('Unauthorized', 403);
 }
Example #2
0
 public function testStringNotEquals()
 {
     $result = StrUtil::is('A', 'a');
     $this->assertFalse($result);
 }