Ejemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public final function compareTo($other) : int
 {
     $result = parent::compareTo($other);
     if (\PHP_INT_MIN === $result) {
         return \PHP_INT_MAX;
     }
     return $result * -1;
 }
Ejemplo n.º 2
0
 /**
  * Returns the original string if the signature is valid or FALSE if not.
  *
  * @access  public
  * @param   string          $string  The string you want to validate
  * @return  string|boolean
  */
 public function validate($string)
 {
     $validated = substr($string, static::MAC_LENGTH);
     if (Comparer::compare($this->getSignature($validated), substr($string, 0, static::MAC_LENGTH))) {
         return $validated;
     }
     return false;
 }
 /**
  * @param callback $callback any type of callable. See http://www.php.net/manual/en/language.types.callable.php
  * @param string $direction
  *
  * @throws \InvalidArgumentException
  */
 public function __construct($callback, $direction = self::ASC)
 {
     $this->setCallback($callback);
     parent::__construct($direction);
 }