code
stringlengths
17
296k
docstring
stringlengths
30
30.3k
func_name
stringlengths
1
89
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
153
url
stringlengths
51
209
license
stringclasses
4 values
public function __call (string $name, array $args) { return self::$app->$name(...$args); }
Magic call to any of the Slim App methods like add, addMidleware, handle, run, etc... See the full list of available methods: https://github.com/slimphp/Slim/blob/4.x/Slim/App.php @param string $name @param array $args @return mixed
__call
php
gotzmann/comet
src/Comet.php
https://github.com/gotzmann/comet/blob/master/src/Comet.php
MIT
private static function parse(string $url) { /* FIXME Disable IPv6 // If IPv6 $prefix = ''; if (preg_match('%^(.*://\[[0-9:a-f]+\])(.*?)$%', $url, $matches)) { $prefix = $matches[1]; $url = $matches[2]; } */ $encodedUrl = preg_replace_callback( '%[^:/@?&=#]+%usD', static function ($matches) { return urlencode($matches[0]); }, $url ); $result = parse_url($prefix . $encodedUrl); if ($result === false) { return false; } return array_map('urldecode', $result); }
UTF-8 aware \parse_url() replacement. The internal function produces broken output for non ASCII domain names (IDN) when used with locales other than "C". On the other hand, cURL understands IDN correctly only when UTF-8 locale is configured ("C.UTF-8", "en_US.UTF-8", etc.). @see https://bugs.php.net/bug.php?id=52923 @see https://www.php.net/manual/en/function.parse-url.php#114817 @see https://curl.haxx.se/libcurl/c/CURLOPT_URL.html#ENCODING @return array|false
parse
php
gotzmann/comet
src/Uri.php
https://github.com/gotzmann/comet/blob/master/src/Uri.php
MIT
public function __construct($config) { if (false === extension_loaded('redis')) { throw new \RuntimeException('Please install redis extension.'); } $this->_maxLifeTime = (int)ini_get('session.gc_maxlifetime'); if (!isset($config['timeout'])) { $config['timeout'] = 2; } $this->_redis = new \Redis(); if (false === $this->_redis->connect($config['host'], $config['port'], $config['timeout'])) { throw new \RuntimeException("Redis connect {$config['host']}:{$config['port']} fail."); } if (!empty($config['auth'])) { $this->_redis->auth($config['auth']); } if (!empty($config['database'])) { $this->_redis->select($config['database']); } if (empty($config['prefix'])) { $config['prefix'] = 'redis_session_'; } $this->_redis->setOption(\Redis::OPT_PREFIX, $config['prefix']); }
RedisSessionHandler constructor. @param $config = [ 'host' => '127.0.0.1', 'port' => 6379, 'timeout' => 2, 'auth' => '******', 'database' => 2, 'prefix' => 'redis_session_', ]
__construct
php
gotzmann/comet
src/Session/RedisSessionHandler.php
https://github.com/gotzmann/comet/blob/master/src/Session/RedisSessionHandler.php
MIT
public function __get(string $name) { if ($name === 'stream') { $this->stream = $this->createStream(); return $this->stream; } throw new \UnexpectedValueException("$name not found on class"); }
Magic method used to create a new stream if streams are not added in the constructor of a decorator (e.g., LazyOpenStream). @return StreamInterface
__get
php
gotzmann/comet
src/Psr/StreamDecoratorTrait.php
https://github.com/gotzmann/comet/blob/master/src/Psr/StreamDecoratorTrait.php
MIT
public function __call(string $method, array $args) { /** @var callable $callable */ $callable = [$this->stream, $method]; $result = call_user_func_array($callable, $args); // Always return the wrapped object if the result is a return $this return $result === $this->stream ? $this : $result; }
Allow decorators to implement custom methods @return mixed
__call
php
gotzmann/comet
src/Psr/StreamDecoratorTrait.php
https://github.com/gotzmann/comet/blob/master/src/Psr/StreamDecoratorTrait.php
MIT
public function __construct(callable $source, array $options = []) { $this->source = $source; $this->size = $options['size'] ?? null; $this->metadata = $options['metadata'] ?? []; $this->buffer = new BufferStream(); }
@param callable(int): (string|null|false) $source Source of the stream data. The callable MAY accept an integer argument used to control the amount of data to return. The callable MUST return a string when called, or false|null on error or EOF. @param array{size?: int, metadata?: array} $options Stream options: - metadata: Hash of metadata to use with stream. - size: Size of the stream, if known.
__construct
php
gotzmann/comet
src/Psr/PumpStream.php
https://github.com/gotzmann/comet/blob/master/src/Psr/PumpStream.php
MIT
private function trimHeaderValues(array $values) { return array_map(function ($value) { if (!is_scalar($value) && null !== $value) { throw new \InvalidArgumentException(sprintf( 'Header value must be scalar or null but %s provided.', is_object($value) ? get_class($value) : gettype($value) )); } return trim((string) $value, " \t"); }, array_values($values)); }
@deprecated Trims whitespace from the header values. Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field. header-field = field-name ":" OWS field-value OWS OWS = *( SP / HTAB ) @param string[] $values Header values @return string[] Trimmed header values @see https://tools.ietf.org/html/rfc7230#section-3.2.4
trimHeaderValues
php
gotzmann/comet
src/Psr/MessageTrait.php
https://github.com/gotzmann/comet/blob/master/src/Psr/MessageTrait.php
MIT
public function getErrors() { $errors = []; foreach ($this->errors->toArray() as $key => $error) { foreach ($error as $rule => $message) { $errors[$key] = $message; } } return $errors; }
Return errors from ErrorBag as array @return array
getErrors
php
gotzmann/comet
src/Validation/Validation.php
https://github.com/gotzmann/comet/blob/master/src/Validation/Validation.php
MIT
public function get(string $key) { $this->assertInit(); return $this->data['parsed_data'][$key] ?? ''; }
Get specific value from session by key. @param string $key The key of a data field. @return mixed
get
php
terrylinooo/shieldon
src/Firewall/Session.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Session.php
MIT
protected function parsedData() { $data = $this->data['data'] ?? '{}'; $this->data['parsed_data'] = json_decode($data, true); }
Parse JSON data and store it into parsed_data field. @return void
parsedData
php
terrylinooo/shieldon
src/Firewall/Session.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Session.php
MIT
protected function setRouteBase(string $base) { if (!defined('SHIELDON_PANEL_BASE')) { // @codeCoverageIgnoreStart define('SHIELDON_PANEL_BASE', $base); // @codeCoverageIgnoreEnd } }
Set the base route for the panel. @param string $base The base path. @return void
setRouteBase
php
terrylinooo/shieldon
src/Firewall/Panel.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Panel.php
MIT
public function __call($method, $args) { if (property_exists($this, $method)) { $callable = $this->{$method}; if (isset($args[0]) && $args[0] instanceof ResponseInterface) { return $callable($args[0]); } } // @codeCoverageIgnoreStart }
Magic method. Helps the property `$resolver` to work like a function. @param string $method The method name. @param array $args The arguments. @return mixed
__call
php
terrylinooo/shieldon
src/Firewall/Panel.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Panel.php
MIT
function create_new_session_instance(string $sessionId) { Container::set('session_id', $sessionId, true); $session = Container::get('session'); if ($session instanceof Session) { $session->setId($sessionId); set_session_instance($session); } }
For unit testing purpose. Not use in production. Create new session by specifying a session ID. @param string $sessionId A session ID string. @return void
create_new_session_instance
php
terrylinooo/shieldon
src/Firewall/Helpers.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Helpers.php
MIT
public function getConfig(string $field) { $v = explode('.', $field); $c = count($v); switch ($c) { case 1: return $this->configuration[$v[0]] ?? ''; case 2: return $this->configuration[$v[0]][$v[1]] ?? ''; case 3: return $this->configuration[$v[0]][$v[1]][$v[2]] ?? ''; case 4: return $this->configuration[$v[0]][$v[1]][$v[2]][$v[3]] ?? ''; case 5: return $this->configuration[$v[0]][$v[1]][$v[2]][$v[3]][$v[4]] ?? ''; } return ''; }
Get a variable from configuration. @param string $field The field of the configuration. @return mixed
getConfig
php
terrylinooo/shieldon
src/Firewall/FirewallTrait.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/FirewallTrait.php
MIT
protected function getOption(string $option, string $section = '') { if (!empty($this->configuration[$section][$option])) { return $this->configuration[$section][$option]; } if (!empty($this->configuration[$option]) && $section === '') { return $this->configuration[$option]; } return false; }
Get options from the configuration file. This method is same as `$this->getConfig()` but returning value from array directly. @param string $option The option of the section in the the configuration. @param string $section The section in the configuration. @return mixed
getOption
php
terrylinooo/shieldon
src/Firewall/FirewallTrait.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/FirewallTrait.php
MIT
public static function get(string $id) { if (self::has($id)) { return self::$instances[$id]; } return null; }
Find an entry of the container by its identifier and returns it. @param string $id Identifier of the entry to look for. @return mixed Entry.
get
php
terrylinooo/shieldon
src/Firewall/Container.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Container.php
MIT
public function getDeniedItem(string $key) { return $this->deniedList[$key] ?? ''; }
Get an item from the blacklist pool. @param string $key The key of the data field. @return string|array
getDeniedItem
php
terrylinooo/shieldon
src/Firewall/Component/DeniedTrait.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Component/DeniedTrait.php
MIT
public function getAllowedItem(string $key) { return $this->allowedList[$key] ?? ''; }
Get an item from the whitelist pool. @return string|array
getAllowedItem
php
terrylinooo/shieldon
src/Firewall/Component/AllowedTrait.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Component/AllowedTrait.php
MIT
public function addTrustedBot(string $name, string $useragent, string $rdns) { $this->setAllowedItem( [ 'userAgent' => $useragent, 'rdns' => $rdns, ], $name ); }
Add new items to the allowed list. @param string $name The key for this inforamtion. @param string $useragent A piece of user-agent string that can identify. @param string $rdns The RDNS inforamtion of the bot. @return void
addTrustedBot
php
terrylinooo/shieldon
src/Firewall/Component/TrustedBot.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Component/TrustedBot.php
MIT
public function before(Request $request) { if ($request->isCLI()) { return; } // CodeIgniter 4 is not a PSR-7 compatible framework, therefore we don't // pass the Reqest and Reposne to Firewall instance. // Shieldon will create them by its HTTP factory. $firewall = new Firewall(); $firewall->configure($this->storage); $firewall->controlPanel($this->panelUri); // Pass CodeIgniter CSRF Token to Captcha form. $firewall->getKernel()->setCaptcha( new Csrf([ 'name' => csrf_token(), 'value' => csrf_hash(), ]) ); $response = $firewall->run(); if ($response->getStatusCode() !== 200) { $httpResolver = new HttpResolver(); $httpResolver($response); } }
Shieldon middleware invokable class. @param Request $request @return mixed
before
php
terrylinooo/shieldon
src/Firewall/Integration/CodeIgniter4.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Integration/CodeIgniter4.php
MIT
public function after(Request $request, Response $response) { // We don't have anything to do here. }
We don't have anything to do here. @param Response $request @param Response $response @return mixed
after
php
terrylinooo/shieldon
src/Firewall/Integration/CodeIgniter4.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Integration/CodeIgniter4.php
MIT
public function __construct(string $storage = '', string $requestUri = '') { // Prevent possible issues occur in CLI command line. if (isset($_SERVER['REQUEST_URI'])) { $serverRequestUri = $_SERVER['REQUEST_URI']; $scriptFilename = $_SERVER['SCRIPT_FILENAME']; if ('' === $storage) { // The storage folder should be placed above www-root for best security, // this folder must be writable. $storage = dirname($scriptFilename) . '/../shieldon_firewall'; } if ('' === $requestUri) { $requestUri = '/firewall/panel/'; } $firewall = new Firewall(); $firewall->configure($storage); $firewall->controlPanel($requestUri); if ($requestUri !== '' && strpos($serverRequestUri, $requestUri) === 0 ) { // Get into the Firewall Panel. $panel = new Panel(); $panel->entry(); } } }
Constuctor. @param string $storage The absolute path of the storage where stores Shieldon generated data. @param string $requestUri The entry URL of Firewall Panel. @return void
__construct
php
terrylinooo/shieldon
src/Firewall/Integration/Bootstrap.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Integration/Bootstrap.php
MIT
public static function get(array $setting) { $instance = null; try { $host = 'mysql' . ':host=' . $setting['host'] . ';dbname=' . $setting['dbname'] . ';charset=' . $setting['charset']; $user = (string) $setting['user']; $pass = (string) $setting['pass']; // Create a PDO instance. $pdoInstance = new PDO($host, $user, $pass); // Use MySQL data driver. $instance = new MysqlDriver($pdoInstance); // @codeCoverageIgnoreStart } catch (PDOException $e) { echo $e->getMessage(); } // @codeCoverageIgnoreEnd return $instance; }
Initialize and get the instance. @param array $setting The configuration of that driver. @return MysqlDriver|null
get
php
terrylinooo/shieldon
src/Firewall/Firewall/Driver/ItemMysqlDriver.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Firewall/Driver/ItemMysqlDriver.php
MIT
public static function get(array $setting) { $instance = null; if (empty($setting['directory_path'])) { return null; } try { // Specify the sqlite file location. $sqliteLocation = $setting['directory_path'] . '/shieldon.sqlite3'; $pdoInstance = new PDO('sqlite:' . $sqliteLocation); $instance = new SqliteDriver($pdoInstance); // @codeCoverageIgnoreStart } catch (PDOException $e) { echo $e->getMessage(); } // @codeCoverageIgnoreEnd return $instance; }
Initialize and get the instance. @param array $setting The configuration of that driver. @return SqliteDriver|null
get
php
terrylinooo/shieldon
src/Firewall/Firewall/Driver/ItemSqliteDriver.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Firewall/Driver/ItemSqliteDriver.php
MIT
public static function get(array $setting) { $instance = null; try { $host = '127.0.0.1'; $port = 6379; if (!empty($setting['host'])) { $host = $setting['host']; } if (!empty($setting['port'])) { $port = $setting['port']; } // Create a Redis instance. $redis = new Redis(); if (empty($setting['port'])) { $redis->connect($host); } else { $redis->connect($host, $port); } if (!empty($setting['auth'])) { // @codeCoverageIgnoreStart $redis->auth($setting['auth']); // @codeCoverageIgnoreEnd } // Use Redis data driver. $instance = new RedisDriver($redis); // @codeCoverageIgnoreStart } catch (Exception $e) { echo $e->getMessage(); } // @codeCoverageIgnoreEnd return $instance; }
Initialize and get the instance. @param array $setting The configuration of that driver. @return RedisDriver|null
get
php
terrylinooo/shieldon
src/Firewall/Firewall/Driver/ItemRedisDriver.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Firewall/Driver/ItemRedisDriver.php
MIT
public static function get(array $setting) { $instance = null; if (empty($setting['directory_path'])) { return $instance; } $instance = new FileDriver($setting['directory_path']); return $instance; }
Initialize and get the instance. @param array $setting The configuration of that driver. @return FileDriver|null
get
php
terrylinooo/shieldon
src/Firewall/Firewall/Driver/ItemFileDriver.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Firewall/Driver/ItemFileDriver.php
MIT
private function overviewFormPost() { $postParams = get_request()->getParsedBody(); if (!isset($postParams['action_type'])) { return; } switch ($postParams['action_type']) { case 'reset_data_circle': $this->setConfig('cronjob.reset_circle.config.last_update', date('Y-m-d H:i:s')); $this->kernel->driver->rebuild(); sleep(2); unset_superglobal('action_type', 'post'); $this->saveConfig(); $this->pushMessage( 'success', __( 'panel', 'reset_data_circle', 'Data circle tables have been reset.' ) ); break; case 'reset_action_logs': $this->kernel->logger->purgeLogs(); sleep(2); $this->pushMessage( 'success', __( 'panel', 'reset_action_logs', 'Action logs have been removed.' ) ); break; } }
Detect and handle form post action. @return void
overviewFormPost
php
terrylinooo/shieldon
src/Firewall/Panel/Home.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Panel/Home.php
MIT
public function __construct() { $firewall = Container::get('firewall'); if (!($firewall instanceof Firewall)) { throw new RuntimeException( 'The Firewall instance should be initialized first.' ); } $this->mode = 'managed'; $this->kernel = $firewall->getKernel(); $this->configuration = $firewall->getConfiguration(); $this->directory = $firewall->getDirectory(); $this->filename = $firewall->getFilename(); $this->base = SHIELDON_PANEL_BASE; if (!empty($this->kernel->logger)) { // We need to know where the logs stored in. $logDirectory = $this->kernel->logger->getDirectory(); // Load ActionLogParser for parsing log files. $this->parser = new ActionLogParser($logDirectory); $this->pageAvailability['logs'] = true; } $flashMessage = get_session_instance()->get('flash_messages'); // Flash message, use it when redirecting page. if (!empty($flashMessage) && is_array($flashMessage)) { $this->messages = $flashMessage; get_session_instance()->remove('flash_messages'); } $this->locate = get_user_lang(); }
Firewall panel base controller.
__construct
php
terrylinooo/shieldon
src/Firewall/Panel/BaseController.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Panel/BaseController.php
MIT
protected function isRuleExist() { $ipRule = $this->driver->get($this->ip, 'rule'); if (empty($ipRule)) { return false; } $this->reason = $ipRule['reason']; $ruleType = (int) $ipRule['type']; // Apply the status code. $this->setResultCode($ruleType); if ($ruleType === Enum::ACTION_ALLOW) { return true; } // Current visitor has been blocked. If he still attempts accessing the site, // then we can drop him into the permanent block list. $attempts = $ipRule['attempts'] ?? 0; $attempts = (int) $attempts; $now = time(); $logData = []; $handleType = 0; $logData['log_ip'] = $ipRule['log_ip']; $logData['ip_resolve'] = $ipRule['ip_resolve']; $logData['time'] = $now; $logData['type'] = $ipRule['type']; $logData['reason'] = $ipRule['reason']; $logData['attempts'] = $attempts; // @since 0.2.0 $attemptPeriod = $this->properties['record_attempt_detection_period']; $attemptReset = $this->properties['reset_attempt_counter']; $lastTimeDiff = $now - $ipRule['time']; if ($lastTimeDiff <= $attemptPeriod) { $logData['attempts'] = ++$attempts; } if ($lastTimeDiff > $attemptReset) { $logData['attempts'] = 0; } if ($ruleType === Enum::ACTION_TEMPORARILY_DENY) { $ratd = $this->determineAttemptsTemporaryDeny($logData, $handleType, $attempts); $logData = $ratd['log_data']; $handleType = $ratd['handle_type']; } if ($ruleType === Enum::ACTION_DENY) { $rapd = $this->determineAttemptsPermanentDeny($logData, $handleType, $attempts); $logData = $rapd['log_data']; $handleType = $rapd['handle_type']; } // We only update data when `deny_attempt_enable` is enable. // Because we want to get the last visited time and attempt counter. // Otherwise, we don't update it everytime to avoid wasting CPU resource. if ($this->event['update_rule_table']) { $this->driver->save($this->ip, $logData, 'rule'); } // Notify this event to messenger. if ($this->event['trigger_messengers']) { $message = $this->prepareMessengerBody($logData, $handleType); // Method from MessageTrait. $this->setMessageBody($message); } return true; }
Look up the rule table. If a specific IP address doesn't exist, return false. Otherwise, return true. @return bool
isRuleExist
php
terrylinooo/shieldon
src/Firewall/Kernel/RuleTrait.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Kernel/RuleTrait.php
MIT
public function getComponent(string $name) { if (!isset($this->component[$name])) { return null; } return $this->component[$name]; }
Get a component instance from component's container. @param string $name The component's class name. @return ComponentProvider|null
getComponent
php
terrylinooo/shieldon
src/Firewall/Kernel/ComponentTrait.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Kernel/ComponentTrait.php
MIT
public function __construct(array $config = []) { $defaults = [ 'img_width' => 250, 'img_height' => 50, 'word_length' => 8, 'font_spacing' => 10, 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'colors' => [ 'background' => [255, 255, 255], 'border' => [153, 200, 255], 'text' => [51, 153, 255], 'grid' => [153, 200, 255], ], ]; foreach ($defaults as $k => $v) { if (isset($config[$k])) { $this->properties[$k] = $config[$k]; } else { $this->properties[$k] = $defaults[$k]; } } if (!is_array($this->properties['colors'])) { $this->properties['colors'] = $defaults['colors']; } foreach ($defaults['colors'] as $k => $v) { if (!is_array($this->properties['colors'][$k])) { $this->properties['colors'][$k] = $defaults['colors'][$k]; } } }
Constructor. It will implement default configuration settings here. @param array $config The settings for creating Captcha. @return void
__construct
php
terrylinooo/shieldon
src/Firewall/Captcha/ImageCaptcha.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Captcha/ImageCaptcha.php
MIT
private function createRandomWords() { $this->word = ''; $poolLength = strlen($this->properties['pool']); $randMax = $poolLength - 1; for ($i = 0; $i < $this->properties['word_length']; $i++) { $this->word .= $this->properties['pool'][random_int(0, $randMax)]; } $this->length = strlen($this->word); }
Prepare the random words that want to display to front. @return void
createRandomWords
php
terrylinooo/shieldon
src/Firewall/Captcha/ImageCaptcha.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Captcha/ImageCaptcha.php
MIT
private function createCanvas(int $imgWidth, int $imgHeight) { if (function_exists('imagecreatetruecolor')) { $this->im = imagecreatetruecolor($imgWidth, $imgHeight); // @codeCoverageIgnoreStart } else { $this->im = imagecreate($imgWidth, $imgHeight); } // @codeCoverageIgnoreEnd }
Create a canvas. This method initialize the $im. @param int $imgWidth The width of the image. @param int $imgHeight The height of the image. @return void
createCanvas
php
terrylinooo/shieldon
src/Firewall/Captcha/ImageCaptcha.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Captcha/ImageCaptcha.php
MIT
private function writeText(int $imgWidth, int $imgHeight, $textColor) { $im = $this->getImageResource(); $z = (int) ($imgWidth / ($this->length / 3)); $x = mt_rand(0, $z); // $y = 0; for ($i = 0; $i < $this->length; $i++) { $y = mt_rand(0, $imgHeight / 2); imagestring($im, 5, $x, $y, $this->word[$i], $textColor); $x += ($this->properties['font_spacing'] * 2); } }
Write the text into the image canvas. @param int $imgWidth The width of the image. @param int $imgHeight The height of the image. @param int $textColor The RGB color for the grid of the image. @return void
writeText
php
terrylinooo/shieldon
src/Firewall/Captcha/ImageCaptcha.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Captcha/ImageCaptcha.php
MIT
public function __construct(array $config = []) { parent::__construct(); foreach ($config as $k => $v) { if (isset($this->{$k})) { $this->{$k} = $v; } } }
Constructor. It will implement default configuration settings here. @param array $config The field of the CSRF configuration. @return void
__construct
php
terrylinooo/shieldon
src/Firewall/Captcha/Csrf.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Captcha/Csrf.php
MIT
public function __construct() { parent::__construct(); }
Constructor. It will implement default configuration settings here. @array $config @return void
__construct
php
terrylinooo/shieldon
src/Firewall/Captcha/Foundation.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Captcha/Foundation.php
MIT
public function __construct(array $config = []) { parent::__construct(); foreach ($config as $k => $v) { if (isset($this->{$k})) { $this->{$k} = $v; } } }
Constructor. It will implement default configuration settings here. @param array $config The settings of Google ReCpatcha. @return void
__construct
php
terrylinooo/shieldon
src/Firewall/Captcha/ReCaptcha.php
https://github.com/terrylinooo/shieldon/blob/master/src/Firewall/Captcha/ReCaptcha.php
MIT
public function mockUserSession($key = '', $value = '') { $sessionId = '624689c34690a1d0a8c5658db66cf73d'; $_COOKIE['_shieldon'] = $sessionId; $data['id'] = $sessionId; $data['ip'] = '192.168.95.1'; $data['time'] = '1597028827'; $data['microtimestamp'] = '159702882767804400'; $data['parsed_data']['shieldon_ui_lang'] = 'en'; $data['parsed_data']['shieldon_user_login'] = true; if (is_string($key) && $key !== '') { $data['parsed_data'][$key] = $value; } if (is_array($key)) { foreach ($key as $k => $v) { $data['parsed_data'][$k] = $v; } } $data['data'] = json_encode($data['parsed_data']); $json = json_encode($data); $dir = BOOTSTRAP_DIR . '/../tmp/shieldon/data_driver_file/shieldon_sessions'; $file = $dir . '/' . $sessionId . '.json'; $originalUmask = umask(0); if (!is_dir($dir)) { mkdir($dir, 0777, true); } umask($originalUmask); file_put_contents($file, $json); }
Mock the user session for tests which need session to test. @param string|array $key @param string $value @return void
mockUserSession
php
terrylinooo/shieldon
tests/Firewall/ShieldonTestCase.php
https://github.com/terrylinooo/shieldon/blob/master/tests/Firewall/ShieldonTestCase.php
MIT
public function assertOutputContainsString(string $uri, string $string) { $_SERVER['REQUEST_URI'] = '/' . trim($uri, '/'); ob_start(); $this->route(); $output = ob_get_contents(); ob_end_clean(); $this->assertStringContainsString($string, $output); }
Check whether the page contains a string. @param string $uri The page's URI path. @param string $string Usually the page title. @return void
assertOutputContainsString
php
terrylinooo/shieldon
tests/Firewall/Panel/RouteTestTrait.php
https://github.com/terrylinooo/shieldon/blob/master/tests/Firewall/Panel/RouteTestTrait.php
MIT
public function assertOutputNotContainsString(string $uri, string $string) { $response = $this->getRouteResponse($uri); $stream = $response->getBody(); if (strpos($stream->getContents(), $string) === false) { $this->assertTrue(true); } else { $this->assertTrue(false); } }
Check whether the page "NOT" contains a string. @param string $uri The page's URI path. @param string $string Usually the page title. @return void
assertOutputNotContainsString
php
terrylinooo/shieldon
tests/Firewall/Panel/RouteTestTrait.php
https://github.com/terrylinooo/shieldon/blob/master/tests/Firewall/Panel/RouteTestTrait.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
SeasonListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/SeasonList/SeasonListItemParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/SeasonList/SeasonListItemParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
CharacterSearchParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Club/UserListParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Club/UserListParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
CharacterSearchParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Club/UserProfileParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Club/UserProfileParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
CharacterListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Top/TopPeopleParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Top/TopPeopleParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
CharacterListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Top/TopCharactersParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Top/TopCharactersParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
CharacterListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Top/TopListItemParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Top/TopListItemParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
CharacterListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Top/TopAnimeParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Top/TopAnimeParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
CharacterListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Top/TopMangaParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Top/TopMangaParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
WatchEpisodesParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Watch/WatchEpisodesParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Watch/WatchEpisodesParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
PromotionalVideoListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Watch/PromotionalVideoListItemParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Watch/PromotionalVideoListItemParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
EpisodeListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Watch/EpisodeListItemParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Watch/EpisodeListItemParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
WatchPromotionalVideosParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Watch/WatchPromotionalVideosParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Watch/WatchPromotionalVideosParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
CharacterListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Character/CharacterListItemParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Character/CharacterListItemParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; parent::__construct($this->crawler); }
VoiceActingRoleParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Character/MangaographyParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Character/MangaographyParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; parent::__construct($this->crawler); }
VoiceActingRoleParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Character/AnimeographyParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Character/AnimeographyParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
CharacterListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Recommendations/UserRecommendationsParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Recommendations/UserRecommendationsParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
CharacterListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Recommendations/RecentRecommendationsParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Recommendations/RecentRecommendationsParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
RecommendationListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Recommendations/RecommendationListItemParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Recommendations/RecommendationListItemParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
EpisodeListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Common/AlternativeTitleParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Common/AlternativeTitleParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
DefaultPicturesPageParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Common/DefaultPicturesPageParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Common/DefaultPicturesPageParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
UsernameByIdParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/User/UsernameByIdParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/User/UsernameByIdParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
HistoryItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/User/History/HistoryItemParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/User/History/HistoryItemParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
UsernameByIdParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/User/Reviews/UserReviewsParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/User/Reviews/UserReviewsParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
PublishedMangaParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Person/PublishedMangaParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Person/PublishedMangaParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
VoiceActingRoleParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Person/VoiceActingRoleParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Person/VoiceActingRoleParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
AnimeStaffPositionParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Person/AnimeStaffPositionParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Person/AnimeStaffPositionParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
MangaReviewsParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Manga/MangaReviewsParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Manga/MangaReviewsParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
MangaReviewScoresParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Manga/MangaReviewScoresParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Manga/MangaReviewScoresParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
MangaRecentlyUpdatedByUsersParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Manga/MangaRecentlyUpdatedByUsersParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Manga/MangaRecentlyUpdatedByUsersParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
AnimeReviewsParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Anime/AnimeReviewsParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Anime/AnimeReviewsParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
EpisodeListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Anime/StreamEpisodeListItemParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Anime/StreamEpisodeListItemParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
EpisodeListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Anime/AnimeEpisodeParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Anime/AnimeEpisodeParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
EpisodeListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Anime/EpisodeListItemParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Anime/EpisodeListItemParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
StaffListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Anime/StaffListItemParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Anime/StaffListItemParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
AnimeRecentlyUpdatedByUsersParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Anime/AnimeRecentlyUpdatedByUsersParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Anime/AnimeRecentlyUpdatedByUsersParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
MusicVideoListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Anime/MusicVideoListItemParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Anime/MusicVideoListItemParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
AnimeReviewParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Reviews/AnimeReviewParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Reviews/AnimeReviewParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
CharacterListItemParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Reviews/ReviewsParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Reviews/ReviewsParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
MangaReviewParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Reviews/MangaReviewParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Reviews/MangaReviewParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
CharacterSearchParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Search/CharacterSearchListItemParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Search/CharacterSearchListItemParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
CharacterSearchParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Search/CharacterSearchParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Search/CharacterSearchParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
AnimeSearchParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Search/AnimeSearchParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Search/AnimeSearchParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
MangaSearchParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Search/MangaSearchListItemParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Search/MangaSearchListItemParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
PersonSearchParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Search/PersonSearchListItemParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Search/PersonSearchListItemParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
AnimeSearchParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Search/AnimeSearchListItemParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Search/AnimeSearchListItemParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
MangaSearchParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Search/MangaSearchParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Search/MangaSearchParser.php
MIT
public function __construct(Crawler $crawler) { $this->crawler = $crawler; }
PersonSearchParser constructor. @param Crawler $crawler
__construct
php
jikan-me/jikan
src/Parser/Search/PersonSearchParser.php
https://github.com/jikan-me/jikan/blob/master/src/Parser/Search/PersonSearchParser.php
MIT
public function __construct(string $name, string $url, string $imageUrl, MalUrl $malUrl) { parent::__construct($name, $url, $imageUrl); $this->entry = new FavoriteCharacterRelatedEntry($malUrl); }
FavoriteCharacter constructor. @param string $name @param string $url @param string $imageUrl @param MalUrl $malUrl
__construct
php
jikan-me/jikan
src/Model/User/FavoriteCharacter.php
https://github.com/jikan-me/jikan/blob/master/src/Model/User/FavoriteCharacter.php
MIT
public function __construct(string $name, string $url, string $imageUrl, string $typeAndYear) { parent::__construct($name, $url, $imageUrl); $typeAndYearArr = explode("·", $typeAndYear); $this->type = trim($typeAndYearArr[0]); $this->startYear = (int) trim($typeAndYearArr[1]); }
FavoriteListEntry constructor. @param string $name @param string $url @param string $imageUrl @param string $typeAndYear
__construct
php
jikan-me/jikan
src/Model/User/FavoriteListEntry.php
https://github.com/jikan-me/jikan/blob/master/src/Model/User/FavoriteListEntry.php
MIT
public function __construct(int $page = 1) { $this->page = $page; }
RecentPromotionalVideosRequest constructor. @param int $page starts at 1
__construct
php
jikan-me/jikan
src/Request/Watch/RecentPromotionalVideosRequest.php
https://github.com/jikan-me/jikan/blob/master/src/Request/Watch/RecentPromotionalVideosRequest.php
MIT
public function __construct(int $id) { $this->id = $id; }
CharacterPicturesRequest constructor. @param int $id
__construct
php
jikan-me/jikan
src/Request/Character/CharacterPicturesRequest.php
https://github.com/jikan-me/jikan/blob/master/src/Request/Character/CharacterPicturesRequest.php
MIT
public function __construct(string $type = Constants::RECENT_RECOMMENDATION_ANIME, int $page = 1) { $this->page = $page; if (null !== $type) { if (!\in_array( $type, [ Constants::RECENT_RECOMMENDATION_ANIME, Constants::RECENT_RECOMMENDATION_MANGA ], true ) ) { throw new \InvalidArgumentException(sprintf('Recommendation type %s is not valid', $type)); } $this->type = $type; } }
RecentRecommendationsRequest constructor. @param int $page @param string $type @throws \InvalidArgumentException
__construct
php
jikan-me/jikan
src/Request/Recommendations/RecentRecommendationsRequest.php
https://github.com/jikan-me/jikan/blob/master/src/Request/Recommendations/RecentRecommendationsRequest.php
MIT
public function __construct(int $id, int $page = 1) { $this->id = $id; $this->page = $page; }
AnimeGenreRequest constructor. @param int $id @param int $page
__construct
php
jikan-me/jikan
src/Request/Genre/AnimeGenreRequest.php
https://github.com/jikan-me/jikan/blob/master/src/Request/Genre/AnimeGenreRequest.php
MIT
public function __construct(int $id, int $page = 1) { $this->id = $id; $this->page = $page; }
MangaGenreRequest constructor. @param int $id @param int $page
__construct
php
jikan-me/jikan
src/Request/Genre/MangaGenreRequest.php
https://github.com/jikan-me/jikan/blob/master/src/Request/Genre/MangaGenreRequest.php
MIT
public function __construct(string $username, ?int $page = 1) { $this->username = $username; $this->page = $page; }
UserReviewsRequest constructor. @param string $username @param int|null $page
__construct
php
jikan-me/jikan
src/Request/User/UserRecommendationsRequest.php
https://github.com/jikan-me/jikan/blob/master/src/Request/User/UserRecommendationsRequest.php
MIT
public function __construct(string $username, int $page = 1, int $status = 7) { $this->username = $username; $this->page = ($page - 1) * 300; $this->status = $status; }
UserMangaListRequest constructor. @param string $username @param int $page @param int $status
__construct
php
jikan-me/jikan
src/Request/User/UserMangaListRequest.php
https://github.com/jikan-me/jikan/blob/master/src/Request/User/UserMangaListRequest.php
MIT
public function __construct(string $username, int $page = 1) { $this->username = $username; $this->page = $page; }
UserProfileRequest constructor. @param string $username @param int $page starts at 1
__construct
php
jikan-me/jikan
src/Request/User/UserFriendsRequest.php
https://github.com/jikan-me/jikan/blob/master/src/Request/User/UserFriendsRequest.php
MIT
public function __construct(string $username, ?int $page = 1) { $this->username = $username; $this->page = $page; }
UserReviewsRequest constructor. @param string $username @param int|null $page
__construct
php
jikan-me/jikan
src/Request/User/UserReviewsRequest.php
https://github.com/jikan-me/jikan/blob/master/src/Request/User/UserReviewsRequest.php
MIT
public function __construct(string $username, int $page = 1, int $status = Constants::USER_ANIME_LIST_ALL) { $this->username = $username; $this->page = ($page - 1) * 300; $this->status = $status; }
UserAnimeListRequest constructor. @param string $username @param int $page @param int $status
__construct
php
jikan-me/jikan
src/Request/User/UserAnimeListRequest.php
https://github.com/jikan-me/jikan/blob/master/src/Request/User/UserAnimeListRequest.php
MIT
public function __construct(string $username, $type = null) { $this->username = $username; if (null !== $type) { if (!\in_array($type, ['anime', 'manga'])) { throw new \InvalidArgumentException(sprintf('Type %s is not valid', $type)); } $this->type = $type; } }
UserHistoryRequest constructor. @param string $username @param null $type @throws \InvalidArgumentException
__construct
php
jikan-me/jikan
src/Request/User/UserHistoryRequest.php
https://github.com/jikan-me/jikan/blob/master/src/Request/User/UserHistoryRequest.php
MIT