*/ class CorsOptions extends AbstractOptions { /** * Set the list of allowed origins domain with protocol. * * @var array */ protected $allowedOrigins = array(); /** * Set the list of HTTP verbs. * * @var array */ protected $allowedMethods = array(); /** * Set the list of headers. * * @var array */ protected $allowedHeaders = array(); /** * Set the max age of the authorize request in seconds. * * @var int */ protected $maxAge = 0; /** * Set the list of exposed headers. * * @var array */ protected $exposedHeaders = array(); /** * Allow CORS request with credential. * * @var bool */ protected $allowedCredentials = false; /** * @param array $allowedOrigins * @return void */ public function setAllowedOrigins($allowedOrigins = []) { $this->allowedOrigins = $allowedOrigins; } /** * @return array */ public function getAllowedOrigins() { return $this->allowedOrigins; } /** * @param array $allowedMethods * @return void */ public function setAllowedMethods(array $allowedMethods) { foreach ($allowedMethods as &$allowedMethod) { $allowedMethod = strtoupper($allowedMethod); } $this->allowedMethods = $allowedMethods; } /** * @return array */ public function getAllowedMethods() { return $this->allowedMethods; } /** * @param array $allowedHeaders * @return void */ public function setAllowedHeaders(array $allowedHeaders) { $this->allowedHeaders = $allowedHeaders; } /** * @return array */ public function getAllowedHeaders() { return $this->allowedHeaders; } /** * @param int $maxAge * @return void */ public function setMaxAge($maxAge) { $this->maxAge = (int) $maxAge; } /** * @return int */ public function getMaxAge() { return $this->maxAge; } /** * @param array $exposedHeaders * @return void */ public function setExposedHeaders(array $exposedHeaders) { $this->exposedHeaders = $exposedHeaders; } /** * @return array */ public function getExposedHeaders() { return $this->exposedHeaders; } /** * @param bool $allowedCredentials * @return void */ public function setAllowedCredentials($allowedCredentials) { $this->allowedCredentials = (bool) $allowedCredentials; } /** * @return boolean */ public function getAllowedCredentials() { return $this->allowedCredentials; } }