Beispiel #1
0
 /**
  * Constructor
  *
  * @author Art <*****@*****.**>
  *
  * @param int|array $typeOrData The error code or array of error_get_last()
  * @param string    $message    The error message
  * @param string    $file       The error file
  * @param int       $line       The error line
  */
 public function __construct($typeOrData, $message = null, $file = null, $line = null)
 {
     if (empty($typeOrData)) {
         parent::__construct(['type' => null, 'message' => null, 'file' => null, 'line' => null]);
     } else {
         if (is_array($typeOrData)) {
             $message = Alo::get($typeOrData['message']);
             $file = Alo::get($typeOrData['file']);
             $line = Alo::get($typeOrData['line']);
             $typeOrData = Alo::get($typeOrData['type']);
         }
         if (!is_numeric($typeOrData)) {
             $typeOrData = null;
         }
         parent::__construct(['type' => $typeOrData, 'message' => $message, 'file' => $file, 'line' => $line]);
     }
 }
Beispiel #2
0
 /**
  * Returns a configuration item or NULL if it's not set
  *
  * @author Art <*****@*****.**>
  *
  * @param string $k The configuration item key
  *
  * @return mixed
  */
 public function get($k)
 {
     return Alo::get($this->merged[$k]);
 }
 /**
  * Offset to retrieve
  *
  * @author Art <*****@*****.**>
  * @link   http://php.net/manual/en/arrayaccess.offsetget.php
  *
  * @param string $offset The key
  *
  * @return mixed
  */
 public function offsetGet($offset)
 {
     if (!self::isActive()) {
         self::sessionRequiredWarning(__METHOD__);
         //@codeCoverageIgnoreStart
         return null;
         //@codeCoverageIgnoreEnd
     }
     return Alo::get($_SESSION[$offset]);
 }
Beispiel #4
0
 /**
  * Creates and returns a token
  *
  * @author Art <*****@*****.**>
  *
  * @param string $hash Hash algorithm to use for the token
  *
  * @return string|null
  */
 public function create($hash = 'sha256')
 {
     if (!Sess::isActive()) {
         self::sessionRequiredWarning(__METHOD__);
         // @codeCoverageIgnoreStart
         return null;
         // @codeCoverageIgnoreEnd
     }
     $entry =& $_SESSION[$this->tokenKey];
     if (!Alo::get($entry) || !is_array($entry)) {
         $entry = [];
     }
     $entry[$this->name] = Alo::getUniqid($hash, __METHOD__);
     return $entry[$this->name];
 }
Beispiel #5
0
 /**
  * Offset to retrieve
  *
  * @author Art <*****@*****.**>
  * @see    http://php.net/manual/en/arrayaccess.offsetget.php
  *
  * @param string $offset The offset to retrieve.
  *
  * @return mixed Can return all value types.
  */
 public function offsetGet($offset)
 {
     return Alo::get($this->options[$offset]);
 }