Ejemplo n.º 1
0
 /**
  * Construct a new response object
  * @param $content Response content
  * @param $statusCode Http status code
  * @param $headers Http headers
  * @param $format Format of the response ['html', 'json']
  */
 public function __construct($content = '', $statusCode = 200, array $headers = array())
 {
     $this->content = $content;
     $this->headers = $headers;
     $this->statusCode = $statusCode;
     $this->charset = Config::get('app.charset') ?: 'UTF-8';
 }
Ejemplo n.º 2
0
 private function getKey()
 {
     if (!AppConfig::isDefined('security.jwt_key')) {
         throw new JwtKeyNotConfiguredException($this->translator->tr(self::JWT_KEY_NOT_CONFIGURED));
     }
     return AppConfig::get('security.jwt_key');
 }
Ejemplo n.º 3
0
 public function getFieldParameters()
 {
     $fields = array();
     $path = "entities." . ucfirst($this->tableName) . ".fields";
     if (AppConfig::isDefined($path)) {
         $fields = AppConfig::get($path);
     }
     return $fields;
 }
Ejemplo n.º 4
0
 public static function getClass()
 {
     if (AppConfig::isDefined('security.authentication')) {
         $auth = AppConfig::get('security.authentication');
         if ('jwt' === $auth) {
             return self::JWT;
         } elseif ('session' === $auth) {
             return self::SESSION;
         }
         throw new AuthenticatorUnknownException("The authenticator \"{$auth}\" is unknown.");
     } else {
         return self::SESSION;
     }
 }
Ejemplo n.º 5
0
 public static function getDefinitionObject($serviceDef)
 {
     $arguments = array();
     if (isset($serviceDef['arguments'])) {
         foreach ($serviceDef['arguments'] as $argument) {
             if (preg_match('#^@#', $argument)) {
                 $argument = preg_replace_callback('#%([0-9\\w\\.]+)%#', function ($matches) {
                     array_shift($matches);
                     $key = $matches[0];
                     return strtolower(AppConfig::get($key));
                 }, $argument);
                 array_push($arguments, new Reference(ltrim($argument, '@')));
             } else {
                 if (preg_match('#%([0-9\\w\\.]+)%#', $argument, $matches)) {
                     array_shift($matches);
                     $key = $matches[0];
                     array_push($arguments, AppConfig::get($key));
                 }
             }
         }
     }
     return new Definition($serviceDef['class'], $arguments);
 }