부터: 2.0.0
저자: Luís Otávio Cobucci Oblonczyk (lcobucci@gmail.com)
예제 #1
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->decoder = $this->getMock(Decoder::class);
     $this->claimFactory = $this->getMock(ClaimFactory::class, [], [], '', false);
     $this->defaultClaim = $this->getMock(Claim::class);
     $this->claimFactory->expects($this->any())->method('create')->willReturn($this->defaultClaim);
 }
예제 #2
0
파일: ParserTest.php 프로젝트: lcobucci/jwt
 /**
  * @before
  */
 public function createDependencies()
 {
     $this->decoder = $this->createMock(Decoder::class);
     $this->claimFactory = $this->createMock(ClaimFactory::class);
     $this->defaultClaim = $this->createMock(Claim::class);
     $this->claimFactory->method('create')->willReturn($this->defaultClaim);
 }
예제 #3
0
 /**
  * @before
  */
 public function initializeDependencies()
 {
     $this->encoder = $this->createMock(Encoder::class);
     $this->claimFactory = $this->createMock(ClaimFactory::class);
     $this->defaultClaim = $this->createMock(Claim::class);
     $this->claimFactory->expects($this->any())->method('create')->willReturn($this->defaultClaim);
 }
예제 #4
0
파일: Parser.php 프로젝트: AlefeVariani/jwt
 /**
  * Parses the claim set from a string
  *
  * @param string $data
  *
  * @return array
  */
 protected function parseClaims($data)
 {
     $claims = (array) $this->decoder->jsonDecode($this->decoder->base64UrlDecode($data));
     foreach ($claims as $name => &$value) {
         $value = $this->claimFactory->create($name, $value);
     }
     return $claims;
 }
예제 #5
0
파일: Builder.php 프로젝트: jackysong/jwt
 /**
  * Configures a claim item
  *
  * @param string $name
  * @param mixed $value
  *
  * @return Builder
  *
  * @throws BadMethodCallException When data has been already signed
  */
 public function set($name, $value)
 {
     if ($this->signature) {
         throw new BadMethodCallException('You must unsign before make changes');
     }
     $this->claims[(string) $name] = $this->claimFactory->create($name, $value);
     return $this;
 }
예제 #6
0
파일: Builder.php 프로젝트: lcobucci/jwt
 /**
  * Configures a claim item
  *
  * @param string $name
  * @param mixed $value
  *
  * @return Builder
  *
  * @throws BadMethodCallException When data has been already signed
  */
 public function with(string $name, $value) : Builder
 {
     if ($this->signature) {
         throw new BadMethodCallException('You must unsign before making changes');
     }
     $this->claims[$name] = $this->claimFactory->create($name, $value);
     return $this;
 }