public static function startsWith($haystack, $needle, $ignoreCase = false) { if ($ignoreCase) { return stripos($haystack, $needle) === 0; } else { return strpos($haystack, $needle) === 0; } }
/** * Mwt constructor. * * @param array $options */ public function __construct($options = []) { foreach (get_object_vars($this) as $field => $_) { if (!Text::startsWith($field, '_')) { $this->_fields[] = $field; } } if (isset($options['type'])) { $this->_type = $options['type']; } if (isset($options['keys'])) { $this->_keys = $options['keys']; } else { $this->_keys = [$this->configure->getSecretKey('mwt:' . $this->_type)]; } if (isset($options['ttl'])) { $this->_ttl = $options['ttl']; } }