Overview

Namespaces

  • Racoon
    • Api
      • Auth
      • Exception
      • Response
        • Format
        • Generate
      • Schema

Classes

  • Racoon\Api\App
  • Racoon\Api\Auth\ApiKeyAuthenticator
  • Racoon\Api\Auth\NoAuthenticator
  • Racoon\Api\Controller
  • Racoon\Api\Request
  • Racoon\Api\Response\Format\JsonFormatter
  • Racoon\Api\Response\Generate\DetailedResponse
  • Racoon\Api\Schema\Item
  • Racoon\Api\Schema\Schema
  • Racoon\Api\Schema\Translator

Interfaces

  • Racoon\Api\Auth\AuthInterface
  • Racoon\Api\Response\Format\FormatterInterface
  • Racoon\Api\Response\Generate\GeneratorInterface

Exceptions

  • Racoon\Api\Exception\AuthenticationException
  • Racoon\Api\Exception\Exception
  • Racoon\Api\Exception\InvalidArgumentException
  • Racoon\Api\Exception\InvalidJsonException
  • Racoon\Api\Exception\InvalidRouteException
  • Racoon\Api\Exception\NotFoundException
  • Racoon\Api\Exception\ResponseFormattingException
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: namespace Racoon\Api;
 4: 
 5: 
 6: use Racoon\Api\Schema\Schema;
 7: 
 8: abstract class Controller
 9: {
10: 
11:     /**
12:      * @var Request
13:      */
14:     protected $request;
15: 
16: 
17:     /**
18:      * @return Request
19:      */
20:     public function getRequest()
21:     {
22:         return $this->request;
23:     }
24: 
25: 
26:     /**
27:      * @param Request $request
28:      */
29:     public function setRequest($request)
30:     {
31:         $this->request = $request;
32:     }
33: 
34: 
35:     /**
36:      * @param Schema $schema
37:      */
38:     public function setSchema(Schema $schema)
39:     {
40:         $this->getRequest()->setSchema($schema);
41:     }
42: 
43: 
44:     /**
45:      * @param Schema|null $schema
46:      * @param bool $setSchema
47:      * @throws Exception\InvalidArgumentException
48:      */
49:     public function validateSchema(Schema $schema = null, $setSchema = true)
50:     {
51:         if ($schema === null) {
52:             $schema = $this->getRequest()->getSchema();
53:         }
54: 
55:         if (is_object($schema)) {
56:             if ($setSchema) {
57:                 $this->setSchema($schema);
58:             }
59:             $schema->validate($this->getRequest()->getRequestData());
60:         }
61:     }
62: 
63: }
API documentation generated by ApiGen