/**
  * Create filters with AND conjunction
  *
  * @param array $options
  * @param array $filters
  * @param bool $placeholder
  *
  * @return string
  */
 public static function andFilter(array $options, array $filters, $placeholder = true)
 {
     $condition = "";
     if (empty($options) || empty($filters)) {
         return $condition;
     }
     $clause = array();
     foreach ($filters as $key => $value) {
         $value = $placeholder === true ? ":{$key}" : (Steelcode_Types_Helper::isNumeric($value) ? $value : "'{$value}'");
         $clause[] = $options[$key] . "=" . $value;
     }
     if (!empty($clause)) {
         $condition = " WHERE " . Steelcode_Array_Helper::implode(' AND ', $clause);
     }
     return $condition;
 }
 /**
  * Set long options
  *
  * @param string|array $option
  * @param string $accept
  */
 public function setLongOption($option, $accept = self::REQUIRED)
 {
     if ($this->_longOptions === null) {
         $this->_longOptions = array();
     }
     $build = !Steelcode_Array_Helper::isEmpty($option) ? $option : array($option => $accept);
     foreach ($build as $option => $accept) {
         if ($accept === self::REQUIRED) {
             $value = "{$option}:";
         } elseif ($accept === self::OPTIONAL) {
             $value = "{$option}::";
         } else {
             $value = $option;
         }
         array_push($this->_longOptions, $value);
     }
 }
 /**
  * Class constructor
  *
  * @param string $key
  * @param string $algorithm
  *
  * @throws Steelcode_Token_Exception
  */
 public function __construct($key, $algorithm = 'HS256')
 {
     if (!empty($algorithm) && !Steelcode_Array_Helper::hasKey($algorithm, $this->_methods)) {
         throw new Steelcode_Token_Exception('Unsupported algorithm');
     } else {
         $this->_algorithm = $algorithm;
     }
     $this->_key = $key;
 }
 /**
  * Generate request path from $_SERVER variable
  *
  * @return string
  */
 public function _generatePath()
 {
     if (isset($_SERVER['REDIRECT_URL']) && isset($_SERVER['SCRIPT_NAME']) && !isset($_SERVER['FCGI_ROLE'])) {
         $requestUrl = $_SERVER['REDIRECT_URL'];
         $scriptName = $_SERVER['SCRIPT_NAME'];
     } elseif (isset($_SERVER['REQUEST_URI'])) {
         list($requestUrl) = Steelcode_String_Helper::explode('?', $_SERVER['REQUEST_URI']);
         $scriptName = $_SERVER['SCRIPT_NAME'];
     } else {
         return '/';
     }
     if ($requestUrl == '' || $requestUrl == '/') {
         return '/';
     }
     $arrayUrl = Steelcode_String_Helper::explode('/', $requestUrl);
     $arrayScript = Steelcode_String_Helper::explode('/', $scriptName);
     foreach ($arrayScript as $key => $value) {
         if ($arrayUrl[$key] == $value) {
             unset($arrayUrl[$key]);
         }
     }
     return '/' . Steelcode_Array_Helper::implode('/', $arrayUrl);
 }