$value) { $this->$pkey = $value; } } /** * Byte-safe substr() * * @param string $str * @param integer $start * @param integer $length * @return string */ protected static function substr($str, $start, $length = null) { return mb_substr($str, $start, $length, '8bit'); } /** * __get() magic, providing readonly access to some of our properties * * @param string $key Property name * @return mixed */ public function __get($key) { if (in_array($key, ['cipher', 'key'], true)) { return $this->{$key}; } return null; } /** * __isset() magic, providing checking for some of our properties * * @param string $key Property name * @return boolean */ public function __isset($key): bool { return in_array($key, ['cipher', 'key'], true); } }