repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
spatie/laravel-uptime-monitor
src/UptimeMonitorServiceProvider.php
UptimeMonitorServiceProvider.boot
public function boot() { if ($this->app->runningInConsole()) { $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); $this->publishes([ __DIR__.'/../config/uptime-monitor.php' => config_path('uptime-monitor.php'), ], 'config'); } ...
php
public function boot() { if ($this->app->runningInConsole()) { $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); $this->publishes([ __DIR__.'/../config/uptime-monitor.php' => config_path('uptime-monitor.php'), ], 'config'); } ...
[ "public", "function", "boot", "(", ")", "{", "if", "(", "$", "this", "->", "app", "->", "runningInConsole", "(", ")", ")", "{", "$", "this", "->", "loadMigrationsFrom", "(", "__DIR__", ".", "'/../database/migrations'", ")", ";", "$", "this", "->", "publi...
Bootstrap the application services.
[ "Bootstrap", "the", "application", "services", "." ]
train
https://github.com/spatie/laravel-uptime-monitor/blob/d3452a18c67babfdac013e53f24df952291ed3cb/src/UptimeMonitorServiceProvider.php#L22-L39
spatie/laravel-uptime-monitor
src/UptimeMonitorServiceProvider.php
UptimeMonitorServiceProvider.register
public function register() { $this->mergeConfigFrom(__DIR__.'/../config/uptime-monitor.php', 'uptime-monitor'); $this->app['events']->subscribe(EventHandler::class); $this->app->bind('command.monitor:check-uptime', CheckUptime::class); $this->app->bind('command.monitor:check-certif...
php
public function register() { $this->mergeConfigFrom(__DIR__.'/../config/uptime-monitor.php', 'uptime-monitor'); $this->app['events']->subscribe(EventHandler::class); $this->app->bind('command.monitor:check-uptime', CheckUptime::class); $this->app->bind('command.monitor:check-certif...
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "mergeConfigFrom", "(", "__DIR__", ".", "'/../config/uptime-monitor.php'", ",", "'uptime-monitor'", ")", ";", "$", "this", "->", "app", "[", "'events'", "]", "->", "subscribe", "(", "EventHand...
Register the application services.
[ "Register", "the", "application", "services", "." ]
train
https://github.com/spatie/laravel-uptime-monitor/blob/d3452a18c67babfdac013e53f24df952291ed3cb/src/UptimeMonitorServiceProvider.php#L44-L74
maiconpinto/cakephp-adminlte-theme
src/Model/Behavior/DatepickerBehavior.php
DatepickerBehavior.beforeMarshal
public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options) { if (!empty($this->_config) && !empty($this->_config['fields'])) { $separator = $this->_config['date_separator'] ? : '/'; $locale = Configure::read('App.defaultLocale'); foreach ($this->_co...
php
public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options) { if (!empty($this->_config) && !empty($this->_config['fields'])) { $separator = $this->_config['date_separator'] ? : '/'; $locale = Configure::read('App.defaultLocale'); foreach ($this->_co...
[ "public", "function", "beforeMarshal", "(", "Event", "$", "event", ",", "ArrayObject", "$", "data", ",", "ArrayObject", "$", "options", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "_config", ")", "&&", "!", "empty", "(", "$", "this", "...
Preparing the data @param \Cake\Event\Event $event @param \ArrayObject $data @param \ArrayObject $options @return void
[ "Preparing", "the", "data" ]
train
https://github.com/maiconpinto/cakephp-adminlte-theme/blob/4b8d7cd4ab895751176704f16443f4ace87b1fed/src/Model/Behavior/DatepickerBehavior.php#L40-L57
Nyholm/psr7
src/Stream.php
Stream.create
public static function create($body = ''): StreamInterface { if ($body instanceof StreamInterface) { return $body; } if (\is_string($body)) { $resource = \fopen('php://temp', 'rw+'); \fwrite($resource, $body); $body = $resource; } ...
php
public static function create($body = ''): StreamInterface { if ($body instanceof StreamInterface) { return $body; } if (\is_string($body)) { $resource = \fopen('php://temp', 'rw+'); \fwrite($resource, $body); $body = $resource; } ...
[ "public", "static", "function", "create", "(", "$", "body", "=", "''", ")", ":", "StreamInterface", "{", "if", "(", "$", "body", "instanceof", "StreamInterface", ")", "{", "return", "$", "body", ";", "}", "if", "(", "\\", "is_string", "(", "$", "body",...
Creates a new PSR-7 stream. @param string|resource|StreamInterface $body @return StreamInterface @throws \InvalidArgumentException
[ "Creates", "a", "new", "PSR", "-", "7", "stream", "." ]
train
https://github.com/Nyholm/psr7/blob/f3d331dca621d1e60dbcf7ae11e25f06369a0d83/src/Stream.php#L63-L88
GrahamCampbell/Laravel-DigitalOcean
src/DigitalOceanServiceProvider.php
DigitalOceanServiceProvider.registerDigitalOceanFactory
protected function registerDigitalOceanFactory() { $this->app->singleton('digitalocean.factory', function (Container $app) { $adapter = $app['digitalocean.adapterfactory']; return new DigitalOceanFactory($adapter); }); $this->app->alias('digitalocean.factory', Digit...
php
protected function registerDigitalOceanFactory() { $this->app->singleton('digitalocean.factory', function (Container $app) { $adapter = $app['digitalocean.adapterfactory']; return new DigitalOceanFactory($adapter); }); $this->app->alias('digitalocean.factory', Digit...
[ "protected", "function", "registerDigitalOceanFactory", "(", ")", "{", "$", "this", "->", "app", "->", "singleton", "(", "'digitalocean.factory'", ",", "function", "(", "Container", "$", "app", ")", "{", "$", "adapter", "=", "$", "app", "[", "'digitalocean.ada...
Register the digitalocean factory class. @return void
[ "Register", "the", "digitalocean", "factory", "class", "." ]
train
https://github.com/GrahamCampbell/Laravel-DigitalOcean/blob/071b48771f7f63dadb77ead8eacca926de05cde1/src/DigitalOceanServiceProvider.php#L90-L99
GrahamCampbell/Laravel-DigitalOcean
src/Adapters/ConnectionFactory.php
ConnectionFactory.createConnector
public function createConnector(array $config) { if (!isset($config['driver'])) { throw new InvalidArgumentException('A driver must be specified.'); } switch ($config['driver']) { case 'buzz': return new BuzzConnector(); case 'guzzle': ...
php
public function createConnector(array $config) { if (!isset($config['driver'])) { throw new InvalidArgumentException('A driver must be specified.'); } switch ($config['driver']) { case 'buzz': return new BuzzConnector(); case 'guzzle': ...
[ "public", "function", "createConnector", "(", "array", "$", "config", ")", "{", "if", "(", "!", "isset", "(", "$", "config", "[", "'driver'", "]", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'A driver must be specified.'", ")", ";", "}",...
Create a connector instance based on the configuration. @param array $config @throws \InvalidArgumentException @return \GrahamCampbell\Manager\ConnectorInterface
[ "Create", "a", "connector", "instance", "based", "on", "the", "configuration", "." ]
train
https://github.com/GrahamCampbell/Laravel-DigitalOcean/blob/071b48771f7f63dadb77ead8eacca926de05cde1/src/Adapters/ConnectionFactory.php#L46-L62
danielstjules/Stringy
src/Stringy.php
Stringy.between
public function between($start, $end, $offset = 0) { $startIndex = $this->indexOf($start, $offset); if ($startIndex === false) { return static::create('', $this->encoding); } $substrIndex = $startIndex + \mb_strlen($start, $this->encoding); $endIndex = $this->ind...
php
public function between($start, $end, $offset = 0) { $startIndex = $this->indexOf($start, $offset); if ($startIndex === false) { return static::create('', $this->encoding); } $substrIndex = $startIndex + \mb_strlen($start, $this->encoding); $endIndex = $this->ind...
[ "public", "function", "between", "(", "$", "start", ",", "$", "end", ",", "$", "offset", "=", "0", ")", "{", "$", "startIndex", "=", "$", "this", "->", "indexOf", "(", "$", "start", ",", "$", "offset", ")", ";", "if", "(", "$", "startIndex", "===...
Returns the substring between $start and $end, if found, or an empty string. An optional offset may be supplied from which to begin the search for the start string. @param string $start Delimiter marking the start of the substring @param string $end Delimiter marking the end of the substring @param int $offs...
[ "Returns", "the", "substring", "between", "$start", "and", "$end", "if", "found", "or", "an", "empty", "string", ".", "An", "optional", "offset", "may", "be", "supplied", "from", "which", "to", "begin", "the", "search", "for", "the", "start", "string", "."...
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L118-L132
danielstjules/Stringy
src/Stringy.php
Stringy.camelize
public function camelize() { $encoding = $this->encoding; $stringy = $this->trim()->lowerCaseFirst(); $stringy->str = preg_replace('/^[-_]+/', '', $stringy->str); $stringy->str = preg_replace_callback( '/[-_\s]+(.)?/u', function ($match) use ($encoding) { ...
php
public function camelize() { $encoding = $this->encoding; $stringy = $this->trim()->lowerCaseFirst(); $stringy->str = preg_replace('/^[-_]+/', '', $stringy->str); $stringy->str = preg_replace_callback( '/[-_\s]+(.)?/u', function ($match) use ($encoding) { ...
[ "public", "function", "camelize", "(", ")", "{", "$", "encoding", "=", "$", "this", "->", "encoding", ";", "$", "stringy", "=", "$", "this", "->", "trim", "(", ")", "->", "lowerCaseFirst", "(", ")", ";", "$", "stringy", "->", "str", "=", "preg_replac...
Returns a camelCase version of the string. Trims surrounding spaces, capitalizes letters following digits, spaces, dashes and underscores, and removes spaces, dashes, as well as underscores. @return static Object with $str in camelCase
[ "Returns", "a", "camelCase", "version", "of", "the", "string", ".", "Trims", "surrounding", "spaces", "capitalizes", "letters", "following", "digits", "spaces", "dashes", "and", "underscores", "and", "removes", "spaces", "dashes", "as", "well", "as", "underscores"...
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L141-L168
danielstjules/Stringy
src/Stringy.php
Stringy.chars
public function chars() { $chars = []; for ($i = 0, $l = $this->length(); $i < $l; $i++) { $chars[] = $this->at($i)->str; } return $chars; }
php
public function chars() { $chars = []; for ($i = 0, $l = $this->length(); $i < $l; $i++) { $chars[] = $this->at($i)->str; } return $chars; }
[ "public", "function", "chars", "(", ")", "{", "$", "chars", "=", "[", "]", ";", "for", "(", "$", "i", "=", "0", ",", "$", "l", "=", "$", "this", "->", "length", "(", ")", ";", "$", "i", "<", "$", "l", ";", "$", "i", "++", ")", "{", "$",...
Returns an array consisting of the characters in the string. @return array An array of string chars
[ "Returns", "an", "array", "consisting", "of", "the", "characters", "in", "the", "string", "." ]
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L175-L183
danielstjules/Stringy
src/Stringy.php
Stringy.countSubstr
public function countSubstr($substring, $caseSensitive = true) { if ($caseSensitive) { return \mb_substr_count($this->str, $substring, $this->encoding); } $str = \mb_strtoupper($this->str, $this->encoding); $substring = \mb_strtoupper($substring, $this->encoding); ...
php
public function countSubstr($substring, $caseSensitive = true) { if ($caseSensitive) { return \mb_substr_count($this->str, $substring, $this->encoding); } $str = \mb_strtoupper($this->str, $this->encoding); $substring = \mb_strtoupper($substring, $this->encoding); ...
[ "public", "function", "countSubstr", "(", "$", "substring", ",", "$", "caseSensitive", "=", "true", ")", "{", "if", "(", "$", "caseSensitive", ")", "{", "return", "\\", "mb_substr_count", "(", "$", "this", "->", "str", ",", "$", "substring", ",", "$", ...
Returns the number of occurrences of $substring in the given string. By default, the comparison is case-sensitive, but can be made insensitive by setting $caseSensitive to false. @param string $substring The substring to search for @param bool $caseSensitive Whether or not to enforce case-sensitivity @return i...
[ "Returns", "the", "number", "of", "occurrences", "of", "$substring", "in", "the", "given", "string", ".", "By", "default", "the", "comparison", "is", "case", "-", "sensitive", "but", "can", "be", "made", "insensitive", "by", "setting", "$caseSensitive", "to", ...
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L284-L294
danielstjules/Stringy
src/Stringy.php
Stringy.delimit
public function delimit($delimiter) { $regexEncoding = $this->regexEncoding(); $this->regexEncoding($this->encoding); $str = $this->eregReplace('\B([A-Z])', '-\1', $this->trim()); $str = \mb_strtolower($str, $this->encoding); $str = $this->eregReplace('[-_\s]+', $delimiter, ...
php
public function delimit($delimiter) { $regexEncoding = $this->regexEncoding(); $this->regexEncoding($this->encoding); $str = $this->eregReplace('\B([A-Z])', '-\1', $this->trim()); $str = \mb_strtolower($str, $this->encoding); $str = $this->eregReplace('[-_\s]+', $delimiter, ...
[ "public", "function", "delimit", "(", "$", "delimiter", ")", "{", "$", "regexEncoding", "=", "$", "this", "->", "regexEncoding", "(", ")", ";", "$", "this", "->", "regexEncoding", "(", "$", "this", "->", "encoding", ")", ";", "$", "str", "=", "$", "t...
Returns a lowercase and trimmed string separated by the given delimiter. Delimiters are inserted before uppercase characters (with the exception of the first character of the string), and in place of spaces, dashes, and underscores. Alpha delimiters are not converted to lowercase. @param string $delimiter Sequence us...
[ "Returns", "a", "lowercase", "and", "trimmed", "string", "separated", "by", "the", "given", "delimiter", ".", "Delimiters", "are", "inserted", "before", "uppercase", "characters", "(", "with", "the", "exception", "of", "the", "first", "character", "of", "the", ...
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L317-L329
danielstjules/Stringy
src/Stringy.php
Stringy.endsWith
public function endsWith($substring, $caseSensitive = true) { $substringLength = \mb_strlen($substring, $this->encoding); $strLength = $this->length(); $endOfStr = \mb_substr($this->str, $strLength - $substringLength, $substringLength, $this->encoding); if (!$caseSensit...
php
public function endsWith($substring, $caseSensitive = true) { $substringLength = \mb_strlen($substring, $this->encoding); $strLength = $this->length(); $endOfStr = \mb_substr($this->str, $strLength - $substringLength, $substringLength, $this->encoding); if (!$caseSensit...
[ "public", "function", "endsWith", "(", "$", "substring", ",", "$", "caseSensitive", "=", "true", ")", "{", "$", "substringLength", "=", "\\", "mb_strlen", "(", "$", "substring", ",", "$", "this", "->", "encoding", ")", ";", "$", "strLength", "=", "$", ...
Returns true if the string ends with $substring, false otherwise. By default, the comparison is case-sensitive, but can be made insensitive by setting $caseSensitive to false. @param string $substring The substring to look for @param bool $caseSensitive Whether or not to enforce case-sensitivity @return bool ...
[ "Returns", "true", "if", "the", "string", "ends", "with", "$substring", "false", "otherwise", ".", "By", "default", "the", "comparison", "is", "case", "-", "sensitive", "but", "can", "be", "made", "insensitive", "by", "setting", "$caseSensitive", "to", "false"...
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L340-L354
danielstjules/Stringy
src/Stringy.php
Stringy.endsWithAny
public function endsWithAny($substrings, $caseSensitive = true) { if (empty($substrings)) { return false; } foreach ($substrings as $substring) { if ($this->endsWith($substring, $caseSensitive)) { return true; } } return f...
php
public function endsWithAny($substrings, $caseSensitive = true) { if (empty($substrings)) { return false; } foreach ($substrings as $substring) { if ($this->endsWith($substring, $caseSensitive)) { return true; } } return f...
[ "public", "function", "endsWithAny", "(", "$", "substrings", ",", "$", "caseSensitive", "=", "true", ")", "{", "if", "(", "empty", "(", "$", "substrings", ")", ")", "{", "return", "false", ";", "}", "foreach", "(", "$", "substrings", "as", "$", "substr...
Returns true if the string ends with any of $substrings, false otherwise. By default, the comparison is case-sensitive, but can be made insensitive by setting $caseSensitive to false. @param string[] $substrings Substrings to look for @param bool $caseSensitive Whether or not to enforce case-sensitivity @retu...
[ "Returns", "true", "if", "the", "string", "ends", "with", "any", "of", "$substrings", "false", "otherwise", ".", "By", "default", "the", "comparison", "is", "case", "-", "sensitive", "but", "can", "be", "made", "insensitive", "by", "setting", "$caseSensitive",...
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L366-L379
danielstjules/Stringy
src/Stringy.php
Stringy.insert
public function insert($substring, $index) { $stringy = static::create($this->str, $this->encoding); if ($index > $stringy->length()) { return $stringy; } $start = \mb_substr($stringy->str, 0, $index, $stringy->encoding); $end = \mb_substr($stringy->str, $index, ...
php
public function insert($substring, $index) { $stringy = static::create($this->str, $this->encoding); if ($index > $stringy->length()) { return $stringy; } $start = \mb_substr($stringy->str, 0, $index, $stringy->encoding); $end = \mb_substr($stringy->str, $index, ...
[ "public", "function", "insert", "(", "$", "substring", ",", "$", "index", ")", "{", "$", "stringy", "=", "static", "::", "create", "(", "$", "this", "->", "str", ",", "$", "this", "->", "encoding", ")", ";", "if", "(", "$", "index", ">", "$", "st...
Inserts $substring into the string at the $index provided. @param string $substring String to be inserted @param int $index The index at which to insert the substring @return static Object with the resulting $str after the insertion
[ "Inserts", "$substring", "into", "the", "string", "at", "the", "$index", "provided", "." ]
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L562-L576
danielstjules/Stringy
src/Stringy.php
Stringy.lines
public function lines() { $array = $this->split('[\r\n]{1,2}', $this->str); for ($i = 0; $i < count($array); $i++) { $array[$i] = static::create($array[$i], $this->encoding); } return $array; }
php
public function lines() { $array = $this->split('[\r\n]{1,2}', $this->str); for ($i = 0; $i < count($array); $i++) { $array[$i] = static::create($array[$i], $this->encoding); } return $array; }
[ "public", "function", "lines", "(", ")", "{", "$", "array", "=", "$", "this", "->", "split", "(", "'[\\r\\n]{1,2}'", ",", "$", "this", "->", "str", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "count", "(", "$", "array", ")", ...
Splits on newlines and carriage returns, returning an array of Stringy objects corresponding to the lines in the string. @return static[] An array of Stringy objects
[ "Splits", "on", "newlines", "and", "carriage", "returns", "returning", "an", "array", "of", "Stringy", "objects", "corresponding", "to", "the", "lines", "in", "the", "string", "." ]
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L717-L725
danielstjules/Stringy
src/Stringy.php
Stringy.lowerCaseFirst
public function lowerCaseFirst() { $first = \mb_substr($this->str, 0, 1, $this->encoding); $rest = \mb_substr($this->str, 1, $this->length() - 1, $this->encoding); $str = \mb_strtolower($first, $this->encoding) . $rest; return static::create($str, $this->encoding); ...
php
public function lowerCaseFirst() { $first = \mb_substr($this->str, 0, 1, $this->encoding); $rest = \mb_substr($this->str, 1, $this->length() - 1, $this->encoding); $str = \mb_strtolower($first, $this->encoding) . $rest; return static::create($str, $this->encoding); ...
[ "public", "function", "lowerCaseFirst", "(", ")", "{", "$", "first", "=", "\\", "mb_substr", "(", "$", "this", "->", "str", ",", "0", ",", "1", ",", "$", "this", "->", "encoding", ")", ";", "$", "rest", "=", "\\", "mb_substr", "(", "$", "this", "...
Converts the first character of the string to lower case. @return static Object with the first character of $str being lower case
[ "Converts", "the", "first", "character", "of", "the", "string", "to", "lower", "case", "." ]
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L831-L840
danielstjules/Stringy
src/Stringy.php
Stringy.offsetExists
public function offsetExists($offset) { $length = $this->length(); $offset = (int) $offset; if ($offset >= 0) { return ($length > $offset); } return ($length >= abs($offset)); }
php
public function offsetExists($offset) { $length = $this->length(); $offset = (int) $offset; if ($offset >= 0) { return ($length > $offset); } return ($length >= abs($offset)); }
[ "public", "function", "offsetExists", "(", "$", "offset", ")", "{", "$", "length", "=", "$", "this", "->", "length", "(", ")", ";", "$", "offset", "=", "(", "int", ")", "$", "offset", ";", "if", "(", "$", "offset", ">=", "0", ")", "{", "return", ...
Returns whether or not a character exists at an index. Offsets may be negative to count from the last character in the string. Implements part of the ArrayAccess interface. @param mixed $offset The index to check @return boolean Whether or not the index exists
[ "Returns", "whether", "or", "not", "a", "character", "exists", "at", "an", "index", ".", "Offsets", "may", "be", "negative", "to", "count", "from", "the", "last", "character", "in", "the", "string", ".", "Implements", "part", "of", "the", "ArrayAccess", "i...
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L850-L860
danielstjules/Stringy
src/Stringy.php
Stringy.offsetGet
public function offsetGet($offset) { $offset = (int) $offset; $length = $this->length(); if (($offset >= 0 && $length <= $offset) || $length < abs($offset)) { throw new OutOfBoundsException('No character exists at the index'); } return \mb_substr($this->str, $of...
php
public function offsetGet($offset) { $offset = (int) $offset; $length = $this->length(); if (($offset >= 0 && $length <= $offset) || $length < abs($offset)) { throw new OutOfBoundsException('No character exists at the index'); } return \mb_substr($this->str, $of...
[ "public", "function", "offsetGet", "(", "$", "offset", ")", "{", "$", "offset", "=", "(", "int", ")", "$", "offset", ";", "$", "length", "=", "$", "this", "->", "length", "(", ")", ";", "if", "(", "(", "$", "offset", ">=", "0", "&&", "$", "leng...
Returns the character at the given index. Offsets may be negative to count from the last character in the string. Implements part of the ArrayAccess interface, and throws an OutOfBoundsException if the index does not exist. @param mixed $offset The index from which to retrieve the char @return mixed ...
[ "Returns", "the", "character", "at", "the", "given", "index", ".", "Offsets", "may", "be", "negative", "to", "count", "from", "the", "last", "character", "in", "the", "string", ".", "Implements", "part", "of", "the", "ArrayAccess", "interface", "and", "throw...
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L873-L883
danielstjules/Stringy
src/Stringy.php
Stringy.regexReplace
public function regexReplace($pattern, $replacement, $options = 'msr') { $regexEncoding = $this->regexEncoding(); $this->regexEncoding($this->encoding); $str = $this->eregReplace($pattern, $replacement, $this->str, $options); $this->regexEncoding($regexEncoding); return sta...
php
public function regexReplace($pattern, $replacement, $options = 'msr') { $regexEncoding = $this->regexEncoding(); $this->regexEncoding($this->encoding); $str = $this->eregReplace($pattern, $replacement, $this->str, $options); $this->regexEncoding($regexEncoding); return sta...
[ "public", "function", "regexReplace", "(", "$", "pattern", ",", "$", "replacement", ",", "$", "options", "=", "'msr'", ")", "{", "$", "regexEncoding", "=", "$", "this", "->", "regexEncoding", "(", ")", ";", "$", "this", "->", "regexEncoding", "(", "$", ...
Replaces all occurrences of $pattern in $str by $replacement. An alias for mb_ereg_replace(). Note that the 'i' option with multibyte patterns in mb_ereg_replace() requires PHP 5.6+ for correct results. This is due to a lack of support in the bundled version of Oniguruma in PHP < 5.6, and current versions of HHVM (3.8 ...
[ "Replaces", "all", "occurrences", "of", "$pattern", "in", "$str", "by", "$replacement", ".", "An", "alias", "for", "mb_ereg_replace", "()", ".", "Note", "that", "the", "i", "option", "with", "multibyte", "patterns", "in", "mb_ereg_replace", "()", "requires", "...
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L1008-L1017
danielstjules/Stringy
src/Stringy.php
Stringy.removeLeft
public function removeLeft($substring) { $stringy = static::create($this->str, $this->encoding); if ($stringy->startsWith($substring)) { $substringLength = \mb_strlen($substring, $stringy->encoding); return $stringy->substr($substringLength); } return $strin...
php
public function removeLeft($substring) { $stringy = static::create($this->str, $this->encoding); if ($stringy->startsWith($substring)) { $substringLength = \mb_strlen($substring, $stringy->encoding); return $stringy->substr($substringLength); } return $strin...
[ "public", "function", "removeLeft", "(", "$", "substring", ")", "{", "$", "stringy", "=", "static", "::", "create", "(", "$", "this", "->", "str", ",", "$", "this", "->", "encoding", ")", ";", "if", "(", "$", "stringy", "->", "startsWith", "(", "$", ...
Returns a new string with the prefix $substring removed, if present. @param string $substring The prefix to remove @return static Object having a $str without the prefix $substring
[ "Returns", "a", "new", "string", "with", "the", "prefix", "$substring", "removed", "if", "present", "." ]
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L1025-L1035
danielstjules/Stringy
src/Stringy.php
Stringy.repeat
public function repeat($multiplier) { $repeated = str_repeat($this->str, $multiplier); return static::create($repeated, $this->encoding); }
php
public function repeat($multiplier) { $repeated = str_repeat($this->str, $multiplier); return static::create($repeated, $this->encoding); }
[ "public", "function", "repeat", "(", "$", "multiplier", ")", "{", "$", "repeated", "=", "str_repeat", "(", "$", "this", "->", "str", ",", "$", "multiplier", ")", ";", "return", "static", "::", "create", "(", "$", "repeated", ",", "$", "this", "->", "...
Returns a repeated string given a multiplier. An alias for str_repeat. @param int $multiplier The number of times to repeat the string @return static Object with a repeated str
[ "Returns", "a", "repeated", "string", "given", "a", "multiplier", ".", "An", "alias", "for", "str_repeat", "." ]
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L1061-L1066
danielstjules/Stringy
src/Stringy.php
Stringy.shuffle
public function shuffle() { $indexes = range(0, $this->length() - 1); shuffle($indexes); $shuffledStr = ''; foreach ($indexes as $i) { $shuffledStr .= \mb_substr($this->str, $i, 1, $this->encoding); } return static::create($shuffledStr, $this->encoding);...
php
public function shuffle() { $indexes = range(0, $this->length() - 1); shuffle($indexes); $shuffledStr = ''; foreach ($indexes as $i) { $shuffledStr .= \mb_substr($this->str, $i, 1, $this->encoding); } return static::create($shuffledStr, $this->encoding);...
[ "public", "function", "shuffle", "(", ")", "{", "$", "indexes", "=", "range", "(", "0", ",", "$", "this", "->", "length", "(", ")", "-", "1", ")", ";", "shuffle", "(", "$", "indexes", ")", ";", "$", "shuffledStr", "=", "''", ";", "foreach", "(", ...
/* A multibyte str_shuffle() function. It returns a string with its characters in random order. @return static Object with a shuffled $str
[ "/", "*", "A", "multibyte", "str_shuffle", "()", "function", ".", "It", "returns", "a", "string", "with", "its", "characters", "in", "random", "order", "." ]
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L1142-L1153
danielstjules/Stringy
src/Stringy.php
Stringy.startsWith
public function startsWith($substring, $caseSensitive = true) { $substringLength = \mb_strlen($substring, $this->encoding); $startOfStr = \mb_substr($this->str, 0, $substringLength, $this->encoding); if (!$caseSensitive) { $substring = \mb_strtolower($substring, $thi...
php
public function startsWith($substring, $caseSensitive = true) { $substringLength = \mb_strlen($substring, $this->encoding); $startOfStr = \mb_substr($this->str, 0, $substringLength, $this->encoding); if (!$caseSensitive) { $substring = \mb_strtolower($substring, $thi...
[ "public", "function", "startsWith", "(", "$", "substring", ",", "$", "caseSensitive", "=", "true", ")", "{", "$", "substringLength", "=", "\\", "mb_strlen", "(", "$", "substring", ",", "$", "this", "->", "encoding", ")", ";", "$", "startOfStr", "=", "\\"...
Returns true if the string begins with $substring, false otherwise. By default, the comparison is case-sensitive, but can be made insensitive by setting $caseSensitive to false. @param string $substring The substring to look for @param bool $caseSensitive Whether or not to enforce case-sensitivity @return bool...
[ "Returns", "true", "if", "the", "string", "begins", "with", "$substring", "false", "otherwise", ".", "By", "default", "the", "comparison", "is", "case", "-", "sensitive", "but", "can", "be", "made", "insensitive", "by", "setting", "$caseSensitive", "to", "fals...
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L1190-L1202
danielstjules/Stringy
src/Stringy.php
Stringy.slice
public function slice($start, $end = null) { if ($end === null) { $length = $this->length(); } elseif ($end >= 0 && $end <= $start) { return static::create('', $this->encoding); } elseif ($end < 0) { $length = $this->length() + $end - $start; } els...
php
public function slice($start, $end = null) { if ($end === null) { $length = $this->length(); } elseif ($end >= 0 && $end <= $start) { return static::create('', $this->encoding); } elseif ($end < 0) { $length = $this->length() + $end - $start; } els...
[ "public", "function", "slice", "(", "$", "start", ",", "$", "end", "=", "null", ")", "{", "if", "(", "$", "end", "===", "null", ")", "{", "$", "length", "=", "$", "this", "->", "length", "(", ")", ";", "}", "elseif", "(", "$", "end", ">=", "0...
Returns the substring beginning at $start, and up to, but not including the index specified by $end. If $end is omitted, the function extracts the remaining string. If $end is negative, it is computed from the end of the string. @param int $start Initial index from which to begin extraction @param int $end O...
[ "Returns", "the", "substring", "beginning", "at", "$start", "and", "up", "to", "but", "not", "including", "the", "index", "specified", "by", "$end", ".", "If", "$end", "is", "omitted", "the", "function", "extracts", "the", "remaining", "string", ".", "If", ...
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L1239-L1252
danielstjules/Stringy
src/Stringy.php
Stringy.split
public function split($pattern, $limit = null) { if ($limit === 0) { return []; } // mb_split errors when supplied an empty pattern in < PHP 5.4.13 // and HHVM < 3.8 if ($pattern === '') { return [static::create($this->str, $this->encoding)]; ...
php
public function split($pattern, $limit = null) { if ($limit === 0) { return []; } // mb_split errors when supplied an empty pattern in < PHP 5.4.13 // and HHVM < 3.8 if ($pattern === '') { return [static::create($this->str, $this->encoding)]; ...
[ "public", "function", "split", "(", "$", "pattern", ",", "$", "limit", "=", "null", ")", "{", "if", "(", "$", "limit", "===", "0", ")", "{", "return", "[", "]", ";", "}", "// mb_split errors when supplied an empty pattern in < PHP 5.4.13", "// and HHVM < 3.8", ...
Splits the string with the provided regular expression, returning an array of Stringy objects. An optional integer $limit will truncate the results. @param string $pattern The regex with which to split the string @param int $limit Optional maximum number of results to return @return static[] An array of Str...
[ "Splits", "the", "string", "with", "the", "provided", "regular", "expression", "returning", "an", "array", "of", "Stringy", "objects", ".", "An", "optional", "integer", "$limit", "will", "truncate", "the", "results", "." ]
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L1263-L1304
danielstjules/Stringy
src/Stringy.php
Stringy.substr
public function substr($start, $length = null) { $length = $length === null ? $this->length() : $length; $str = \mb_substr($this->str, $start, $length, $this->encoding); return static::create($str, $this->encoding); }
php
public function substr($start, $length = null) { $length = $length === null ? $this->length() : $length; $str = \mb_substr($this->str, $start, $length, $this->encoding); return static::create($str, $this->encoding); }
[ "public", "function", "substr", "(", "$", "start", ",", "$", "length", "=", "null", ")", "{", "$", "length", "=", "$", "length", "===", "null", "?", "$", "this", "->", "length", "(", ")", ":", "$", "length", ";", "$", "str", "=", "\\", "mb_substr...
Returns the substring beginning at $start with the specified $length. It differs from the mb_substr() function in that providing a $length of null will return the rest of the string, rather than an empty string. @param int $start Position of the first character to use @param int $length Maximum number of char...
[ "Returns", "the", "substring", "beginning", "at", "$start", "with", "the", "specified", "$length", ".", "It", "differs", "from", "the", "mb_substr", "()", "function", "in", "that", "providing", "a", "$length", "of", "null", "will", "return", "the", "rest", "...
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L1327-L1333
danielstjules/Stringy
src/Stringy.php
Stringy.surround
public function surround($substring) { $str = implode('', [$substring, $this->str, $substring]); return static::create($str, $this->encoding); }
php
public function surround($substring) { $str = implode('', [$substring, $this->str, $substring]); return static::create($str, $this->encoding); }
[ "public", "function", "surround", "(", "$", "substring", ")", "{", "$", "str", "=", "implode", "(", "''", ",", "[", "$", "substring", ",", "$", "this", "->", "str", ",", "$", "substring", "]", ")", ";", "return", "static", "::", "create", "(", "$",...
Surrounds $str with the given substring. @param string $substring The substring to add to both sides @return static Object whose $str had the substring both prepended and appended
[ "Surrounds", "$str", "with", "the", "given", "substring", "." ]
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L1342-L1347
danielstjules/Stringy
src/Stringy.php
Stringy.titleize
public function titleize($ignore = null) { $stringy = static::create($this->trim(), $this->encoding); $encoding = $this->encoding; $stringy->str = preg_replace_callback( '/([\S]+)/u', function ($match) use ($encoding, $ignore) { if ($ignore && in_arra...
php
public function titleize($ignore = null) { $stringy = static::create($this->trim(), $this->encoding); $encoding = $this->encoding; $stringy->str = preg_replace_callback( '/([\S]+)/u', function ($match) use ($encoding, $ignore) { if ($ignore && in_arra...
[ "public", "function", "titleize", "(", "$", "ignore", "=", "null", ")", "{", "$", "stringy", "=", "static", "::", "create", "(", "$", "this", "->", "trim", "(", ")", ",", "$", "this", "->", "encoding", ")", ";", "$", "encoding", "=", "$", "this", ...
Returns a trimmed string with the first letter of each word capitalized. Also accepts an array, $ignore, allowing you to list words not to be capitalized. @param array $ignore An array of words not to capitalize @return static Object with a titleized $str
[ "Returns", "a", "trimmed", "string", "with", "the", "first", "letter", "of", "each", "word", "capitalized", ".", "Also", "accepts", "an", "array", "$ignore", "allowing", "you", "to", "list", "words", "not", "to", "be", "capitalized", "." ]
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L1406-L1426
danielstjules/Stringy
src/Stringy.php
Stringy.toAscii
public function toAscii($language = 'en', $removeUnsupported = true) { $str = $this->str; $langSpecific = $this->langSpecificCharsArray($language); if (!empty($langSpecific)) { $str = str_replace($langSpecific[0], $langSpecific[1], $str); } foreach ($this->chars...
php
public function toAscii($language = 'en', $removeUnsupported = true) { $str = $this->str; $langSpecific = $this->langSpecificCharsArray($language); if (!empty($langSpecific)) { $str = str_replace($langSpecific[0], $langSpecific[1], $str); } foreach ($this->chars...
[ "public", "function", "toAscii", "(", "$", "language", "=", "'en'", ",", "$", "removeUnsupported", "=", "true", ")", "{", "$", "str", "=", "$", "this", "->", "str", ";", "$", "langSpecific", "=", "$", "this", "->", "langSpecificCharsArray", "(", "$", "...
Returns an ASCII version of the string. A set of non-ASCII characters are replaced with their closest ASCII counterparts, and the rest are removed by default. The language or locale of the source string can be supplied for language-specific transliteration in any of the following formats: en, en_GB, or en-GB. For examp...
[ "Returns", "an", "ASCII", "version", "of", "the", "string", ".", "A", "set", "of", "non", "-", "ASCII", "characters", "are", "replaced", "with", "their", "closest", "ASCII", "counterparts", "and", "the", "rest", "are", "removed", "by", "default", ".", "The...
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L1441-L1459
danielstjules/Stringy
src/Stringy.php
Stringy.toBoolean
public function toBoolean() { $key = $this->toLowerCase()->str; $map = [ 'true' => true, '1' => true, 'on' => true, 'yes' => true, 'false' => false, '0' => false, 'off' => false, 'no' =...
php
public function toBoolean() { $key = $this->toLowerCase()->str; $map = [ 'true' => true, '1' => true, 'on' => true, 'yes' => true, 'false' => false, '0' => false, 'off' => false, 'no' =...
[ "public", "function", "toBoolean", "(", ")", "{", "$", "key", "=", "$", "this", "->", "toLowerCase", "(", ")", "->", "str", ";", "$", "map", "=", "[", "'true'", "=>", "true", ",", "'1'", "=>", "true", ",", "'on'", "=>", "true", ",", "'yes'", "=>"...
Returns a boolean representation of the given logical string value. For example, 'true', '1', 'on' and 'yes' will return true. 'false', '0', 'off', and 'no' will return false. In all instances, case is ignored. For other numeric strings, their sign will determine the return value. In addition, blank strings consisting ...
[ "Returns", "a", "boolean", "representation", "of", "the", "given", "logical", "string", "value", ".", "For", "example", "true", "1", "on", "and", "yes", "will", "return", "true", ".", "false", "0", "off", "and", "no", "will", "return", "false", ".", "In"...
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L1472-L1493
danielstjules/Stringy
src/Stringy.php
Stringy.toTitleCase
public function toTitleCase() { $str = \mb_convert_case($this->str, \MB_CASE_TITLE, $this->encoding); return static::create($str, $this->encoding); }
php
public function toTitleCase() { $str = \mb_convert_case($this->str, \MB_CASE_TITLE, $this->encoding); return static::create($str, $this->encoding); }
[ "public", "function", "toTitleCase", "(", ")", "{", "$", "str", "=", "\\", "mb_convert_case", "(", "$", "this", "->", "str", ",", "\\", "MB_CASE_TITLE", ",", "$", "this", "->", "encoding", ")", ";", "return", "static", "::", "create", "(", "$", "str", ...
Converts the first character of each word in the string to uppercase. @return static Object with all characters of $str being title-cased
[ "Converts", "the", "first", "character", "of", "each", "word", "in", "the", "string", "to", "uppercase", "." ]
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L1544-L1549
danielstjules/Stringy
src/Stringy.php
Stringy.regexEncoding
protected function regexEncoding() { static $functionExists; if ($functionExists === null) { $functionExists = function_exists('\mb_regex_encoding'); } if ($functionExists) { $args = func_get_args(); return call_user_func_array('\mb_regex_encodin...
php
protected function regexEncoding() { static $functionExists; if ($functionExists === null) { $functionExists = function_exists('\mb_regex_encoding'); } if ($functionExists) { $args = func_get_args(); return call_user_func_array('\mb_regex_encodin...
[ "protected", "function", "regexEncoding", "(", ")", "{", "static", "$", "functionExists", ";", "if", "(", "$", "functionExists", "===", "null", ")", "{", "$", "functionExists", "=", "function_exists", "(", "'\\mb_regex_encoding'", ")", ";", "}", "if", "(", "...
Alias for mb_regex_encoding which default to a noop if the mbstring module is not installed.
[ "Alias", "for", "mb_regex_encoding", "which", "default", "to", "a", "noop", "if", "the", "mbstring", "module", "is", "not", "installed", "." ]
train
https://github.com/danielstjules/Stringy/blob/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e/src/Stringy.php#L1960-L1972
minkphp/Mink
src/Element/Element.php
Element.waitFor
public function waitFor($timeout, $callback) { if (!is_callable($callback)) { throw new \InvalidArgumentException('Given callback is not a valid callable'); } $start = microtime(true); $end = $start + $timeout; do { $result = call_user_func($callback...
php
public function waitFor($timeout, $callback) { if (!is_callable($callback)) { throw new \InvalidArgumentException('Given callback is not a valid callable'); } $start = microtime(true); $end = $start + $timeout; do { $result = call_user_func($callback...
[ "public", "function", "waitFor", "(", "$", "timeout", ",", "$", "callback", ")", "{", "if", "(", "!", "is_callable", "(", "$", "callback", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Given callback is not a valid callable'", ")", ";...
{@inheritdoc}
[ "{" ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/Element.php#L119-L139
minkphp/Mink
src/Element/Element.php
Element.find
public function find($selector, $locator) { $items = $this->findAll($selector, $locator); return count($items) ? current($items) : null; }
php
public function find($selector, $locator) { $items = $this->findAll($selector, $locator); return count($items) ? current($items) : null; }
[ "public", "function", "find", "(", "$", "selector", ",", "$", "locator", ")", "{", "$", "items", "=", "$", "this", "->", "findAll", "(", "$", "selector", ",", "$", "locator", ")", ";", "return", "count", "(", "$", "items", ")", "?", "current", "(",...
{@inheritdoc}
[ "{" ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/Element.php#L144-L149
minkphp/Mink
src/Element/Element.php
Element.findAll
public function findAll($selector, $locator) { if ('named' === $selector) { $items = $this->findAll('named_exact', $locator); if (empty($items)) { $items = $this->findAll('named_partial', $locator); } return $items; } $xpath =...
php
public function findAll($selector, $locator) { if ('named' === $selector) { $items = $this->findAll('named_exact', $locator); if (empty($items)) { $items = $this->findAll('named_partial', $locator); } return $items; } $xpath =...
[ "public", "function", "findAll", "(", "$", "selector", ",", "$", "locator", ")", "{", "if", "(", "'named'", "===", "$", "selector", ")", "{", "$", "items", "=", "$", "this", "->", "findAll", "(", "'named_exact'", ",", "$", "locator", ")", ";", "if", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/Element.php#L154-L169
minkphp/Mink
src/Element/Element.php
Element.elementNotFound
protected function elementNotFound($type, $selector = null, $locator = null) { @trigger_error(sprintf('The method %s is deprecated as of 1.7 and will be removed in 2.0', __METHOD__), E_USER_DEPRECATED); return new ElementNotFoundException($this->driver, $type, $selector, $locator); }
php
protected function elementNotFound($type, $selector = null, $locator = null) { @trigger_error(sprintf('The method %s is deprecated as of 1.7 and will be removed in 2.0', __METHOD__), E_USER_DEPRECATED); return new ElementNotFoundException($this->driver, $type, $selector, $locator); }
[ "protected", "function", "elementNotFound", "(", "$", "type", ",", "$", "selector", "=", "null", ",", "$", "locator", "=", "null", ")", "{", "@", "trigger_error", "(", "sprintf", "(", "'The method %s is deprecated as of 1.7 and will be removed in 2.0'", ",", "__METH...
Builds an ElementNotFoundException. @param string $type @param string|null $selector @param string|null $locator @return ElementNotFoundException @deprecated as of 1.7, to be removed in 2.0
[ "Builds", "an", "ElementNotFoundException", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/Element.php#L208-L213
minkphp/Mink
src/Element/TraversableElement.php
TraversableElement.clickLink
public function clickLink($locator) { $link = $this->findLink($locator); if (null === $link) { throw new ElementNotFoundException($this->getDriver(), 'link', 'id|title|alt|text', $locator); } $link->click(); }
php
public function clickLink($locator) { $link = $this->findLink($locator); if (null === $link) { throw new ElementNotFoundException($this->getDriver(), 'link', 'id|title|alt|text', $locator); } $link->click(); }
[ "public", "function", "clickLink", "(", "$", "locator", ")", "{", "$", "link", "=", "$", "this", "->", "findLink", "(", "$", "locator", ")", ";", "if", "(", "null", "===", "$", "link", ")", "{", "throw", "new", "ElementNotFoundException", "(", "$", "...
Clicks link with specified locator. @param string $locator link id, title, text or image alt @throws ElementNotFoundException
[ "Clicks", "link", "with", "specified", "locator", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/TraversableElement.php#L65-L74
minkphp/Mink
src/Element/TraversableElement.php
TraversableElement.pressButton
public function pressButton($locator) { $button = $this->findButton($locator); if (null === $button) { throw new ElementNotFoundException($this->getDriver(), 'button', 'id|name|title|alt|value', $locator); } $button->press(); }
php
public function pressButton($locator) { $button = $this->findButton($locator); if (null === $button) { throw new ElementNotFoundException($this->getDriver(), 'button', 'id|name|title|alt|value', $locator); } $button->press(); }
[ "public", "function", "pressButton", "(", "$", "locator", ")", "{", "$", "button", "=", "$", "this", "->", "findButton", "(", "$", "locator", ")", ";", "if", "(", "null", "===", "$", "button", ")", "{", "throw", "new", "ElementNotFoundException", "(", ...
Presses button (input[type=submit|image|button|reset], button) with specified locator. @param string $locator button id, value or alt @throws ElementNotFoundException
[ "Presses", "button", "(", "input", "[", "type", "=", "submit|image|button|reset", "]", "button", ")", "with", "specified", "locator", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/TraversableElement.php#L107-L116
minkphp/Mink
src/Element/TraversableElement.php
TraversableElement.fillField
public function fillField($locator, $value) { $field = $this->findField($locator); if (null === $field) { throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value|placeholder', $locator); } $field->setValue($value); }
php
public function fillField($locator, $value) { $field = $this->findField($locator); if (null === $field) { throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value|placeholder', $locator); } $field->setValue($value); }
[ "public", "function", "fillField", "(", "$", "locator", ",", "$", "value", ")", "{", "$", "field", "=", "$", "this", "->", "findField", "(", "$", "locator", ")", ";", "if", "(", "null", "===", "$", "field", ")", "{", "throw", "new", "ElementNotFoundE...
Fills in field (input, textarea, select) with specified locator. @param string $locator input id, name or label @param string $value value @throws ElementNotFoundException @see NodeElement::setValue
[ "Fills", "in", "field", "(", "input", "textarea", "select", ")", "with", "specified", "locator", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/TraversableElement.php#L152-L161
minkphp/Mink
src/Element/TraversableElement.php
TraversableElement.hasCheckedField
public function hasCheckedField($locator) { $field = $this->findField($locator); return null !== $field && $field->isChecked(); }
php
public function hasCheckedField($locator) { $field = $this->findField($locator); return null !== $field && $field->isChecked(); }
[ "public", "function", "hasCheckedField", "(", "$", "locator", ")", "{", "$", "field", "=", "$", "this", "->", "findField", "(", "$", "locator", ")", ";", "return", "null", "!==", "$", "field", "&&", "$", "field", "->", "isChecked", "(", ")", ";", "}"...
Checks whether element has a checkbox with specified locator, which is checked. @param string $locator input id, name or label @return Boolean @see NodeElement::isChecked
[ "Checks", "whether", "element", "has", "a", "checkbox", "with", "specified", "locator", "which", "is", "checked", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/TraversableElement.php#L172-L177
minkphp/Mink
src/Element/TraversableElement.php
TraversableElement.hasUncheckedField
public function hasUncheckedField($locator) { $field = $this->findField($locator); return null !== $field && !$field->isChecked(); }
php
public function hasUncheckedField($locator) { $field = $this->findField($locator); return null !== $field && !$field->isChecked(); }
[ "public", "function", "hasUncheckedField", "(", "$", "locator", ")", "{", "$", "field", "=", "$", "this", "->", "findField", "(", "$", "locator", ")", ";", "return", "null", "!==", "$", "field", "&&", "!", "$", "field", "->", "isChecked", "(", ")", "...
Checks whether element has a checkbox with specified locator, which is unchecked. @param string $locator input id, name or label @return Boolean @see NodeElement::isChecked
[ "Checks", "whether", "element", "has", "a", "checkbox", "with", "specified", "locator", "which", "is", "unchecked", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/TraversableElement.php#L188-L193
minkphp/Mink
src/Element/TraversableElement.php
TraversableElement.checkField
public function checkField($locator) { $field = $this->findField($locator); if (null === $field) { throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator); } $field->check(); }
php
public function checkField($locator) { $field = $this->findField($locator); if (null === $field) { throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator); } $field->check(); }
[ "public", "function", "checkField", "(", "$", "locator", ")", "{", "$", "field", "=", "$", "this", "->", "findField", "(", "$", "locator", ")", ";", "if", "(", "null", "===", "$", "field", ")", "{", "throw", "new", "ElementNotFoundException", "(", "$",...
Checks checkbox with specified locator. @param string $locator input id, name or label @throws ElementNotFoundException
[ "Checks", "checkbox", "with", "specified", "locator", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/TraversableElement.php#L202-L211
minkphp/Mink
src/Element/TraversableElement.php
TraversableElement.uncheckField
public function uncheckField($locator) { $field = $this->findField($locator); if (null === $field) { throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator); } $field->uncheck(); }
php
public function uncheckField($locator) { $field = $this->findField($locator); if (null === $field) { throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator); } $field->uncheck(); }
[ "public", "function", "uncheckField", "(", "$", "locator", ")", "{", "$", "field", "=", "$", "this", "->", "findField", "(", "$", "locator", ")", ";", "if", "(", "null", "===", "$", "field", ")", "{", "throw", "new", "ElementNotFoundException", "(", "$...
Unchecks checkbox with specified locator. @param string $locator input id, name or label @throws ElementNotFoundException
[ "Unchecks", "checkbox", "with", "specified", "locator", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/TraversableElement.php#L220-L229
minkphp/Mink
src/Element/TraversableElement.php
TraversableElement.selectFieldOption
public function selectFieldOption($locator, $value, $multiple = false) { $field = $this->findField($locator); if (null === $field) { throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator); } $field->selectOption($value, $mu...
php
public function selectFieldOption($locator, $value, $multiple = false) { $field = $this->findField($locator); if (null === $field) { throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator); } $field->selectOption($value, $mu...
[ "public", "function", "selectFieldOption", "(", "$", "locator", ",", "$", "value", ",", "$", "multiple", "=", "false", ")", "{", "$", "field", "=", "$", "this", "->", "findField", "(", "$", "locator", ")", ";", "if", "(", "null", "===", "$", "field",...
Selects option from select field with specified locator. @param string $locator input id, name or label @param string $value option value @param Boolean $multiple select multiple options @throws ElementNotFoundException @see NodeElement::selectOption
[ "Selects", "option", "from", "select", "field", "with", "specified", "locator", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/TraversableElement.php#L254-L263
minkphp/Mink
src/Element/TraversableElement.php
TraversableElement.attachFileToField
public function attachFileToField($locator, $path) { $field = $this->findField($locator); if (null === $field) { throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator); } $field->attachFile($path); }
php
public function attachFileToField($locator, $path) { $field = $this->findField($locator); if (null === $field) { throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator); } $field->attachFile($path); }
[ "public", "function", "attachFileToField", "(", "$", "locator", ",", "$", "path", ")", "{", "$", "field", "=", "$", "this", "->", "findField", "(", "$", "locator", ")", ";", "if", "(", "null", "===", "$", "field", ")", "{", "throw", "new", "ElementNo...
Attach file to file field with specified locator. @param string $locator input id, name or label @param string $path path to file @throws ElementNotFoundException @see NodeElement::attachFile
[ "Attach", "file", "to", "file", "field", "with", "specified", "locator", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/TraversableElement.php#L287-L296
minkphp/Mink
src/WebAssert.php
WebAssert.addressNotEquals
public function addressNotEquals($page) { $expected = $this->cleanUrl($page); $actual = $this->getCurrentUrlPath(); $this->assert($actual !== $expected, sprintf('Current page is "%s", but should not be.', $actual)); }
php
public function addressNotEquals($page) { $expected = $this->cleanUrl($page); $actual = $this->getCurrentUrlPath(); $this->assert($actual !== $expected, sprintf('Current page is "%s", but should not be.', $actual)); }
[ "public", "function", "addressNotEquals", "(", "$", "page", ")", "{", "$", "expected", "=", "$", "this", "->", "cleanUrl", "(", "$", "page", ")", ";", "$", "actual", "=", "$", "this", "->", "getCurrentUrlPath", "(", ")", ";", "$", "this", "->", "asse...
Checks that current session address is not equals to provided one. @param string $page @throws ExpectationException
[ "Checks", "that", "current", "session", "address", "is", "not", "equals", "to", "provided", "one", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L64-L70
minkphp/Mink
src/WebAssert.php
WebAssert.addressMatches
public function addressMatches($regex) { $actual = $this->getCurrentUrlPath(); $message = sprintf('Current page "%s" does not match the regex "%s".', $actual, $regex); $this->assert((bool) preg_match($regex, $actual), $message); }
php
public function addressMatches($regex) { $actual = $this->getCurrentUrlPath(); $message = sprintf('Current page "%s" does not match the regex "%s".', $actual, $regex); $this->assert((bool) preg_match($regex, $actual), $message); }
[ "public", "function", "addressMatches", "(", "$", "regex", ")", "{", "$", "actual", "=", "$", "this", "->", "getCurrentUrlPath", "(", ")", ";", "$", "message", "=", "sprintf", "(", "'Current page \"%s\" does not match the regex \"%s\".'", ",", "$", "actual", ","...
Checks that current session address matches regex. @param string $regex @throws ExpectationException
[ "Checks", "that", "current", "session", "address", "matches", "regex", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L79-L85
minkphp/Mink
src/WebAssert.php
WebAssert.cookieEquals
public function cookieEquals($name, $value) { $this->cookieExists($name); $actualValue = $this->session->getCookie($name); $message = sprintf('Cookie "%s" value is "%s", but should be "%s".', $name, $actualValue, $value); $this->assert($actualValue == $value, $message); }
php
public function cookieEquals($name, $value) { $this->cookieExists($name); $actualValue = $this->session->getCookie($name); $message = sprintf('Cookie "%s" value is "%s", but should be "%s".', $name, $actualValue, $value); $this->assert($actualValue == $value, $message); }
[ "public", "function", "cookieEquals", "(", "$", "name", ",", "$", "value", ")", "{", "$", "this", "->", "cookieExists", "(", "$", "name", ")", ";", "$", "actualValue", "=", "$", "this", "->", "session", "->", "getCookie", "(", "$", "name", ")", ";", ...
Checks that specified cookie exists and its value equals to a given one. @param string $name cookie name @param string $value cookie value @throws ExpectationException
[ "Checks", "that", "specified", "cookie", "exists", "and", "its", "value", "equals", "to", "a", "given", "one", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L95-L103
minkphp/Mink
src/WebAssert.php
WebAssert.cookieExists
public function cookieExists($name) { $message = sprintf('Cookie "%s" is not set, but should be.', $name); $this->assert($this->session->getCookie($name) !== null, $message); }
php
public function cookieExists($name) { $message = sprintf('Cookie "%s" is not set, but should be.', $name); $this->assert($this->session->getCookie($name) !== null, $message); }
[ "public", "function", "cookieExists", "(", "$", "name", ")", "{", "$", "message", "=", "sprintf", "(", "'Cookie \"%s\" is not set, but should be.'", ",", "$", "name", ")", ";", "$", "this", "->", "assert", "(", "$", "this", "->", "session", "->", "getCookie"...
Checks that specified cookie exists. @param string $name cookie name @throws ExpectationException
[ "Checks", "that", "specified", "cookie", "exists", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L112-L116
minkphp/Mink
src/WebAssert.php
WebAssert.statusCodeEquals
public function statusCodeEquals($code) { $actual = $this->session->getStatusCode(); $message = sprintf('Current response status code is %d, but %d expected.', $actual, $code); $this->assert(intval($code) === intval($actual), $message); }
php
public function statusCodeEquals($code) { $actual = $this->session->getStatusCode(); $message = sprintf('Current response status code is %d, but %d expected.', $actual, $code); $this->assert(intval($code) === intval($actual), $message); }
[ "public", "function", "statusCodeEquals", "(", "$", "code", ")", "{", "$", "actual", "=", "$", "this", "->", "session", "->", "getStatusCode", "(", ")", ";", "$", "message", "=", "sprintf", "(", "'Current response status code is %d, but %d expected.'", ",", "$",...
Checks that current response code equals to provided one. @param int $code @throws ExpectationException
[ "Checks", "that", "current", "response", "code", "equals", "to", "provided", "one", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L125-L131
minkphp/Mink
src/WebAssert.php
WebAssert.responseHeaderEquals
public function responseHeaderEquals($name, $value) { $actual = $this->session->getResponseHeader($name); $message = sprintf('Current response header "%s" is "%s", but "%s" expected.', $name, $actual, $value); $this->assert($value === $actual, $message); }
php
public function responseHeaderEquals($name, $value) { $actual = $this->session->getResponseHeader($name); $message = sprintf('Current response header "%s" is "%s", but "%s" expected.', $name, $actual, $value); $this->assert($value === $actual, $message); }
[ "public", "function", "responseHeaderEquals", "(", "$", "name", ",", "$", "value", ")", "{", "$", "actual", "=", "$", "this", "->", "session", "->", "getResponseHeader", "(", "$", "name", ")", ";", "$", "message", "=", "sprintf", "(", "'Current response he...
Checks that current response header equals value. @param string $name @param string $value @throws ExpectationException
[ "Checks", "that", "current", "response", "header", "equals", "value", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L156-L162
minkphp/Mink
src/WebAssert.php
WebAssert.responseHeaderContains
public function responseHeaderContains($name, $value) { $actual = $this->session->getResponseHeader($name); $message = sprintf('The text "%s" was not found anywhere in the "%s" response header.', $value, $name); $this->assert(false !== stripos($actual, $value), $message); }
php
public function responseHeaderContains($name, $value) { $actual = $this->session->getResponseHeader($name); $message = sprintf('The text "%s" was not found anywhere in the "%s" response header.', $value, $name); $this->assert(false !== stripos($actual, $value), $message); }
[ "public", "function", "responseHeaderContains", "(", "$", "name", ",", "$", "value", ")", "{", "$", "actual", "=", "$", "this", "->", "session", "->", "getResponseHeader", "(", "$", "name", ")", ";", "$", "message", "=", "sprintf", "(", "'The text \"%s\" w...
Checks that current response header contains value. @param string $name @param string $value @throws ExpectationException
[ "Checks", "that", "current", "response", "header", "contains", "value", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L188-L194
minkphp/Mink
src/WebAssert.php
WebAssert.responseHeaderMatches
public function responseHeaderMatches($name, $regex) { $actual = $this->session->getResponseHeader($name); $message = sprintf('The pattern "%s" was not found anywhere in the "%s" response header.', $regex, $name); $this->assert((bool) preg_match($regex, $actual), $message); }
php
public function responseHeaderMatches($name, $regex) { $actual = $this->session->getResponseHeader($name); $message = sprintf('The pattern "%s" was not found anywhere in the "%s" response header.', $regex, $name); $this->assert((bool) preg_match($regex, $actual), $message); }
[ "public", "function", "responseHeaderMatches", "(", "$", "name", ",", "$", "regex", ")", "{", "$", "actual", "=", "$", "this", "->", "session", "->", "getResponseHeader", "(", "$", "name", ")", ";", "$", "message", "=", "sprintf", "(", "'The pattern \"%s\"...
Checks that current response header matches regex. @param string $name @param string $regex @throws ExpectationException
[ "Checks", "that", "current", "response", "header", "matches", "regex", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L220-L226
minkphp/Mink
src/WebAssert.php
WebAssert.responseHeaderNotMatches
public function responseHeaderNotMatches($name, $regex) { $actual = $this->session->getResponseHeader($name); $message = sprintf( 'The pattern "%s" was found in the text of the "%s" response header, but it should not.', $regex, $name ); $this->ass...
php
public function responseHeaderNotMatches($name, $regex) { $actual = $this->session->getResponseHeader($name); $message = sprintf( 'The pattern "%s" was found in the text of the "%s" response header, but it should not.', $regex, $name ); $this->ass...
[ "public", "function", "responseHeaderNotMatches", "(", "$", "name", ",", "$", "regex", ")", "{", "$", "actual", "=", "$", "this", "->", "session", "->", "getResponseHeader", "(", "$", "name", ")", ";", "$", "message", "=", "sprintf", "(", "'The pattern \"%...
Checks that current response header does not match regex. @param string $name @param string $regex @throws ExpectationException
[ "Checks", "that", "current", "response", "header", "does", "not", "match", "regex", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L236-L246
minkphp/Mink
src/WebAssert.php
WebAssert.pageTextContains
public function pageTextContains($text) { $actual = $this->session->getPage()->getText(); $actual = preg_replace('/\s+/u', ' ', $actual); $regex = '/'.preg_quote($text, '/').'/ui'; $message = sprintf('The text "%s" was not found anywhere in the text of the current page.', $text); ...
php
public function pageTextContains($text) { $actual = $this->session->getPage()->getText(); $actual = preg_replace('/\s+/u', ' ', $actual); $regex = '/'.preg_quote($text, '/').'/ui'; $message = sprintf('The text "%s" was not found anywhere in the text of the current page.', $text); ...
[ "public", "function", "pageTextContains", "(", "$", "text", ")", "{", "$", "actual", "=", "$", "this", "->", "session", "->", "getPage", "(", ")", "->", "getText", "(", ")", ";", "$", "actual", "=", "preg_replace", "(", "'/\\s+/u'", ",", "' '", ",", ...
Checks that current page contains text. @param string $text @throws ResponseTextException
[ "Checks", "that", "current", "page", "contains", "text", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L255-L263
minkphp/Mink
src/WebAssert.php
WebAssert.pageTextMatches
public function pageTextMatches($regex) { $actual = $this->session->getPage()->getText(); $message = sprintf('The pattern %s was not found anywhere in the text of the current page.', $regex); $this->assertResponseText((bool) preg_match($regex, $actual), $message); }
php
public function pageTextMatches($regex) { $actual = $this->session->getPage()->getText(); $message = sprintf('The pattern %s was not found anywhere in the text of the current page.', $regex); $this->assertResponseText((bool) preg_match($regex, $actual), $message); }
[ "public", "function", "pageTextMatches", "(", "$", "regex", ")", "{", "$", "actual", "=", "$", "this", "->", "session", "->", "getPage", "(", ")", "->", "getText", "(", ")", ";", "$", "message", "=", "sprintf", "(", "'The pattern %s was not found anywhere in...
Checks that current page text matches regex. @param string $regex @throws ResponseTextException
[ "Checks", "that", "current", "page", "text", "matches", "regex", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L289-L295
minkphp/Mink
src/WebAssert.php
WebAssert.pageTextNotMatches
public function pageTextNotMatches($regex) { $actual = $this->session->getPage()->getText(); $message = sprintf('The pattern %s was found in the text of the current page, but it should not.', $regex); $this->assertResponseText(!preg_match($regex, $actual), $message); }
php
public function pageTextNotMatches($regex) { $actual = $this->session->getPage()->getText(); $message = sprintf('The pattern %s was found in the text of the current page, but it should not.', $regex); $this->assertResponseText(!preg_match($regex, $actual), $message); }
[ "public", "function", "pageTextNotMatches", "(", "$", "regex", ")", "{", "$", "actual", "=", "$", "this", "->", "session", "->", "getPage", "(", ")", "->", "getText", "(", ")", ";", "$", "message", "=", "sprintf", "(", "'The pattern %s was found in the text ...
Checks that current page text does not matches regex. @param string $regex @throws ResponseTextException
[ "Checks", "that", "current", "page", "text", "does", "not", "matches", "regex", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L304-L310
minkphp/Mink
src/WebAssert.php
WebAssert.responseContains
public function responseContains($text) { $actual = $this->session->getPage()->getContent(); $message = sprintf('The string "%s" was not found anywhere in the HTML response of the current page.', $text); $this->assert(stripos($actual, $text) !== false, $message); }
php
public function responseContains($text) { $actual = $this->session->getPage()->getContent(); $message = sprintf('The string "%s" was not found anywhere in the HTML response of the current page.', $text); $this->assert(stripos($actual, $text) !== false, $message); }
[ "public", "function", "responseContains", "(", "$", "text", ")", "{", "$", "actual", "=", "$", "this", "->", "session", "->", "getPage", "(", ")", "->", "getContent", "(", ")", ";", "$", "message", "=", "sprintf", "(", "'The string \"%s\" was not found anywh...
Checks that page HTML (response content) contains text. @param string $text @throws ExpectationException
[ "Checks", "that", "page", "HTML", "(", "response", "content", ")", "contains", "text", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L319-L325
minkphp/Mink
src/WebAssert.php
WebAssert.responseMatches
public function responseMatches($regex) { $actual = $this->session->getPage()->getContent(); $message = sprintf('The pattern %s was not found anywhere in the HTML response of the page.', $regex); $this->assert((bool) preg_match($regex, $actual), $message); }
php
public function responseMatches($regex) { $actual = $this->session->getPage()->getContent(); $message = sprintf('The pattern %s was not found anywhere in the HTML response of the page.', $regex); $this->assert((bool) preg_match($regex, $actual), $message); }
[ "public", "function", "responseMatches", "(", "$", "regex", ")", "{", "$", "actual", "=", "$", "this", "->", "session", "->", "getPage", "(", ")", "->", "getContent", "(", ")", ";", "$", "message", "=", "sprintf", "(", "'The pattern %s was not found anywhere...
Checks that page HTML (response content) matches regex. @param string $regex @throws ExpectationException
[ "Checks", "that", "page", "HTML", "(", "response", "content", ")", "matches", "regex", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L349-L355
minkphp/Mink
src/WebAssert.php
WebAssert.responseNotMatches
public function responseNotMatches($regex) { $actual = $this->session->getPage()->getContent(); $message = sprintf('The pattern %s was found in the HTML response of the page, but it should not.', $regex); $this->assert(!preg_match($regex, $actual), $message); }
php
public function responseNotMatches($regex) { $actual = $this->session->getPage()->getContent(); $message = sprintf('The pattern %s was found in the HTML response of the page, but it should not.', $regex); $this->assert(!preg_match($regex, $actual), $message); }
[ "public", "function", "responseNotMatches", "(", "$", "regex", ")", "{", "$", "actual", "=", "$", "this", "->", "session", "->", "getPage", "(", ")", "->", "getContent", "(", ")", ";", "$", "message", "=", "sprintf", "(", "'The pattern %s was found in the HT...
Checks that page HTML (response content) does not matches regex. @param $regex @throws ExpectationException
[ "Checks", "that", "page", "HTML", "(", "response", "content", ")", "does", "not", "matches", "regex", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L364-L370
minkphp/Mink
src/WebAssert.php
WebAssert.elementsCount
public function elementsCount($selectorType, $selector, $count, ElementInterface $container = null) { $container = $container ?: $this->session->getPage(); $nodes = $container->findAll($selectorType, $selector); $message = sprintf( '%d %s found on the page, but should be %d.', ...
php
public function elementsCount($selectorType, $selector, $count, ElementInterface $container = null) { $container = $container ?: $this->session->getPage(); $nodes = $container->findAll($selectorType, $selector); $message = sprintf( '%d %s found on the page, but should be %d.', ...
[ "public", "function", "elementsCount", "(", "$", "selectorType", ",", "$", "selector", ",", "$", "count", ",", "ElementInterface", "$", "container", "=", "null", ")", "{", "$", "container", "=", "$", "container", "?", ":", "$", "this", "->", "session", "...
Checks that there is specified number of specific elements on the page. @param string $selectorType element selector type (css, xpath) @param string|array $selector element selector @param int $count expected count @param ElementInterface $container document to check against @...
[ "Checks", "that", "there", "is", "specified", "number", "of", "specific", "elements", "on", "the", "page", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L382-L395
minkphp/Mink
src/WebAssert.php
WebAssert.elementExists
public function elementExists($selectorType, $selector, ElementInterface $container = null) { $container = $container ?: $this->session->getPage(); $node = $container->find($selectorType, $selector); if (null === $node) { if (is_array($selector)) { $selector = im...
php
public function elementExists($selectorType, $selector, ElementInterface $container = null) { $container = $container ?: $this->session->getPage(); $node = $container->find($selectorType, $selector); if (null === $node) { if (is_array($selector)) { $selector = im...
[ "public", "function", "elementExists", "(", "$", "selectorType", ",", "$", "selector", ",", "ElementInterface", "$", "container", "=", "null", ")", "{", "$", "container", "=", "$", "container", "?", ":", "$", "this", "->", "session", "->", "getPage", "(", ...
Checks that specific element exists on the current page. @param string $selectorType element selector type (css, xpath) @param string|array $selector element selector @param ElementInterface $container document to check against @return NodeElement @throws ElementNotFoundException
[ "Checks", "that", "specific", "element", "exists", "on", "the", "current", "page", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L408-L422
minkphp/Mink
src/WebAssert.php
WebAssert.elementNotExists
public function elementNotExists($selectorType, $selector, ElementInterface $container = null) { $container = $container ?: $this->session->getPage(); $node = $container->find($selectorType, $selector); $message = sprintf( 'An %s appears on this page, but it should not.', ...
php
public function elementNotExists($selectorType, $selector, ElementInterface $container = null) { $container = $container ?: $this->session->getPage(); $node = $container->find($selectorType, $selector); $message = sprintf( 'An %s appears on this page, but it should not.', ...
[ "public", "function", "elementNotExists", "(", "$", "selectorType", ",", "$", "selector", ",", "ElementInterface", "$", "container", "=", "null", ")", "{", "$", "container", "=", "$", "container", "?", ":", "$", "this", "->", "session", "->", "getPage", "(...
Checks that specific element does not exists on the current page. @param string $selectorType element selector type (css, xpath) @param string|array $selector element selector @param ElementInterface $container document to check against @throws ExpectationException
[ "Checks", "that", "specific", "element", "does", "not", "exists", "on", "the", "current", "page", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L433-L444
minkphp/Mink
src/WebAssert.php
WebAssert.elementTextNotContains
public function elementTextNotContains($selectorType, $selector, $text) { $element = $this->elementExists($selectorType, $selector); $actual = $element->getText(); $regex = '/'.preg_quote($text, '/').'/ui'; $message = sprintf( 'The text "%s" appears in the text of the %s...
php
public function elementTextNotContains($selectorType, $selector, $text) { $element = $this->elementExists($selectorType, $selector); $actual = $element->getText(); $regex = '/'.preg_quote($text, '/').'/ui'; $message = sprintf( 'The text "%s" appears in the text of the %s...
[ "public", "function", "elementTextNotContains", "(", "$", "selectorType", ",", "$", "selector", ",", "$", "text", ")", "{", "$", "element", "=", "$", "this", "->", "elementExists", "(", "$", "selectorType", ",", "$", "selector", ")", ";", "$", "actual", ...
Checks that specific element does not contains text. @param string $selectorType element selector type (css, xpath) @param string|array $selector element selector @param string $text expected text @throws ElementTextException
[ "Checks", "that", "specific", "element", "does", "not", "contains", "text", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L479-L492
minkphp/Mink
src/WebAssert.php
WebAssert.elementContains
public function elementContains($selectorType, $selector, $html) { $element = $this->elementExists($selectorType, $selector); $actual = $element->getHtml(); $regex = '/'.preg_quote($html, '/').'/ui'; $message = sprintf( 'The string "%s" was not found in the HTML of the %...
php
public function elementContains($selectorType, $selector, $html) { $element = $this->elementExists($selectorType, $selector); $actual = $element->getHtml(); $regex = '/'.preg_quote($html, '/').'/ui'; $message = sprintf( 'The string "%s" was not found in the HTML of the %...
[ "public", "function", "elementContains", "(", "$", "selectorType", ",", "$", "selector", ",", "$", "html", ")", "{", "$", "element", "=", "$", "this", "->", "elementExists", "(", "$", "selectorType", ",", "$", "selector", ")", ";", "$", "actual", "=", ...
Checks that specific element contains HTML. @param string $selectorType element selector type (css, xpath) @param string|array $selector element selector @param string $html expected text @throws ElementHtmlException
[ "Checks", "that", "specific", "element", "contains", "HTML", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L503-L516
minkphp/Mink
src/WebAssert.php
WebAssert.elementAttributeExists
public function elementAttributeExists($selectorType, $selector, $attribute) { $element = $this->elementExists($selectorType, $selector); $message = sprintf( 'The attribute "%s" was not found in the %s.', $attribute, $this->getMatchingElementRepresentation($selec...
php
public function elementAttributeExists($selectorType, $selector, $attribute) { $element = $this->elementExists($selectorType, $selector); $message = sprintf( 'The attribute "%s" was not found in the %s.', $attribute, $this->getMatchingElementRepresentation($selec...
[ "public", "function", "elementAttributeExists", "(", "$", "selectorType", ",", "$", "selector", ",", "$", "attribute", ")", "{", "$", "element", "=", "$", "this", "->", "elementExists", "(", "$", "selectorType", ",", "$", "selector", ")", ";", "$", "messag...
Checks that an attribute exists in an element. @param string $selectorType @param string|array $selector @param string $attribute @return NodeElement @throws ElementHtmlException
[ "Checks", "that", "an", "attribute", "exists", "in", "an", "element", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L553-L566
minkphp/Mink
src/WebAssert.php
WebAssert.elementAttributeContains
public function elementAttributeContains($selectorType, $selector, $attribute, $text) { $element = $this->elementAttributeExists($selectorType, $selector, $attribute); $actual = $element->getAttribute($attribute); $regex = '/'.preg_quote($text, '/').'/ui'; $message = sprintf( ...
php
public function elementAttributeContains($selectorType, $selector, $attribute, $text) { $element = $this->elementAttributeExists($selectorType, $selector, $attribute); $actual = $element->getAttribute($attribute); $regex = '/'.preg_quote($text, '/').'/ui'; $message = sprintf( ...
[ "public", "function", "elementAttributeContains", "(", "$", "selectorType", ",", "$", "selector", ",", "$", "attribute", ",", "$", "text", ")", "{", "$", "element", "=", "$", "this", "->", "elementAttributeExists", "(", "$", "selectorType", ",", "$", "select...
Checks that an attribute of a specific elements contains text. @param string $selectorType @param string|array $selector @param string $attribute @param string $text @throws ElementHtmlException
[ "Checks", "that", "an", "attribute", "of", "a", "specific", "elements", "contains", "text", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L578-L592
minkphp/Mink
src/WebAssert.php
WebAssert.fieldExists
public function fieldExists($field, TraversableElement $container = null) { $container = $container ?: $this->session->getPage(); $node = $container->findField($field); if (null === $node) { throw new ElementNotFoundException($this->session->getDriver(), 'form field', 'id|name|l...
php
public function fieldExists($field, TraversableElement $container = null) { $container = $container ?: $this->session->getPage(); $node = $container->findField($field); if (null === $node) { throw new ElementNotFoundException($this->session->getDriver(), 'form field', 'id|name|l...
[ "public", "function", "fieldExists", "(", "$", "field", ",", "TraversableElement", "$", "container", "=", "null", ")", "{", "$", "container", "=", "$", "container", "?", ":", "$", "this", "->", "session", "->", "getPage", "(", ")", ";", "$", "node", "=...
Checks that specific field exists on the current page. @param string $field field id|name|label|value @param TraversableElement $container document to check against @return NodeElement @throws ElementNotFoundException
[ "Checks", "that", "specific", "field", "exists", "on", "the", "current", "page", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L630-L640
minkphp/Mink
src/WebAssert.php
WebAssert.fieldNotExists
public function fieldNotExists($field, TraversableElement $container = null) { $container = $container ?: $this->session->getPage(); $node = $container->findField($field); $this->assert(null === $node, sprintf('A field "%s" appears on this page, but it should not.', $field)); }
php
public function fieldNotExists($field, TraversableElement $container = null) { $container = $container ?: $this->session->getPage(); $node = $container->findField($field); $this->assert(null === $node, sprintf('A field "%s" appears on this page, but it should not.', $field)); }
[ "public", "function", "fieldNotExists", "(", "$", "field", ",", "TraversableElement", "$", "container", "=", "null", ")", "{", "$", "container", "=", "$", "container", "?", ":", "$", "this", "->", "session", "->", "getPage", "(", ")", ";", "$", "node", ...
Checks that specific field does not exists on the current page. @param string $field field id|name|label|value @param TraversableElement $container document to check against @throws ExpectationException
[ "Checks", "that", "specific", "field", "does", "not", "exists", "on", "the", "current", "page", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L650-L656
minkphp/Mink
src/WebAssert.php
WebAssert.fieldValueEquals
public function fieldValueEquals($field, $value, TraversableElement $container = null) { $node = $this->fieldExists($field, $container); $actual = $node->getValue(); $regex = '/^'.preg_quote($value, '/').'$/ui'; $message = sprintf('The field "%s" value is "%s", but "%s" expected.', ...
php
public function fieldValueEquals($field, $value, TraversableElement $container = null) { $node = $this->fieldExists($field, $container); $actual = $node->getValue(); $regex = '/^'.preg_quote($value, '/').'$/ui'; $message = sprintf('The field "%s" value is "%s", but "%s" expected.', ...
[ "public", "function", "fieldValueEquals", "(", "$", "field", ",", "$", "value", ",", "TraversableElement", "$", "container", "=", "null", ")", "{", "$", "node", "=", "$", "this", "->", "fieldExists", "(", "$", "field", ",", "$", "container", ")", ";", ...
Checks that specific field have provided value. @param string $field field id|name|label|value @param string $value field value @param TraversableElement $container document to check against @throws ExpectationException
[ "Checks", "that", "specific", "field", "have", "provided", "value", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L667-L676
minkphp/Mink
src/WebAssert.php
WebAssert.checkboxChecked
public function checkboxChecked($field, TraversableElement $container = null) { $node = $this->fieldExists($field, $container); $this->assert($node->isChecked(), sprintf('Checkbox "%s" is not checked, but it should be.', $field)); }
php
public function checkboxChecked($field, TraversableElement $container = null) { $node = $this->fieldExists($field, $container); $this->assert($node->isChecked(), sprintf('Checkbox "%s" is not checked, but it should be.', $field)); }
[ "public", "function", "checkboxChecked", "(", "$", "field", ",", "TraversableElement", "$", "container", "=", "null", ")", "{", "$", "node", "=", "$", "this", "->", "fieldExists", "(", "$", "field", ",", "$", "container", ")", ";", "$", "this", "->", "...
Checks that specific checkbox is checked. @param string $field field id|name|label|value @param TraversableElement $container document to check against @throws ExpectationException
[ "Checks", "that", "specific", "checkbox", "is", "checked", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L706-L711
minkphp/Mink
src/WebAssert.php
WebAssert.cleanUrl
protected function cleanUrl($url) { $parts = parse_url($url); $fragment = empty($parts['fragment']) ? '' : '#'.$parts['fragment']; $path = empty($parts['path']) ? '/' : $parts['path']; return preg_replace('/^\/[^\.\/]+\.php\//', '/', $path).$fragment; }
php
protected function cleanUrl($url) { $parts = parse_url($url); $fragment = empty($parts['fragment']) ? '' : '#'.$parts['fragment']; $path = empty($parts['path']) ? '/' : $parts['path']; return preg_replace('/^\/[^\.\/]+\.php\//', '/', $path).$fragment; }
[ "protected", "function", "cleanUrl", "(", "$", "url", ")", "{", "$", "parts", "=", "parse_url", "(", "$", "url", ")", ";", "$", "fragment", "=", "empty", "(", "$", "parts", "[", "'fragment'", "]", ")", "?", "''", ":", "'#'", ".", "$", "parts", "[...
Trims scriptname from the URL. @param string $url @return string
[ "Trims", "scriptname", "from", "the", "URL", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L745-L752
minkphp/Mink
src/WebAssert.php
WebAssert.assertElement
private function assertElement($condition, $message, Element $element) { if ($condition) { return; } throw new ElementHtmlException($message, $this->session->getDriver(), $element); }
php
private function assertElement($condition, $message, Element $element) { if ($condition) { return; } throw new ElementHtmlException($message, $this->session->getDriver(), $element); }
[ "private", "function", "assertElement", "(", "$", "condition", ",", "$", "message", ",", "Element", "$", "element", ")", "{", "if", "(", "$", "condition", ")", "{", "return", ";", "}", "throw", "new", "ElementHtmlException", "(", "$", "message", ",", "$"...
Asserts a condition on an element. @param bool $condition @param string $message Failure message @param Element $element @throws ElementHtmlException when the condition is not fulfilled
[ "Asserts", "a", "condition", "on", "an", "element", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L797-L804
minkphp/Mink
src/WebAssert.php
WebAssert.assertElementText
private function assertElementText($condition, $message, Element $element) { if ($condition) { return; } throw new ElementTextException($message, $this->session->getDriver(), $element); }
php
private function assertElementText($condition, $message, Element $element) { if ($condition) { return; } throw new ElementTextException($message, $this->session->getDriver(), $element); }
[ "private", "function", "assertElementText", "(", "$", "condition", ",", "$", "message", ",", "Element", "$", "element", ")", "{", "if", "(", "$", "condition", ")", "{", "return", ";", "}", "throw", "new", "ElementTextException", "(", "$", "message", ",", ...
Asserts a condition involving the text of an element. @param bool $condition @param string $message Failure message @param Element $element @throws ElementTextException when the condition is not fulfilled
[ "Asserts", "a", "condition", "involving", "the", "text", "of", "an", "element", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L815-L822
minkphp/Mink
src/WebAssert.php
WebAssert.getMatchingElementRepresentation
private function getMatchingElementRepresentation($selectorType, $selector, $plural = false) { $pluralization = $plural ? 's' : ''; if (in_array($selectorType, array('named', 'named_exact', 'named_partial')) && is_array($selector) && 2 === count($selector) ) { return...
php
private function getMatchingElementRepresentation($selectorType, $selector, $plural = false) { $pluralization = $plural ? 's' : ''; if (in_array($selectorType, array('named', 'named_exact', 'named_partial')) && is_array($selector) && 2 === count($selector) ) { return...
[ "private", "function", "getMatchingElementRepresentation", "(", "$", "selectorType", ",", "$", "selector", ",", "$", "plural", "=", "false", ")", "{", "$", "pluralization", "=", "$", "plural", "?", "'s'", ":", "''", ";", "if", "(", "in_array", "(", "$", ...
@param string $selectorType @param string|array $selector @param bool $plural @return string
[ "@param", "string", "$selectorType", "@param", "string|array", "$selector", "@param", "bool", "$plural" ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/WebAssert.php#L831-L846
minkphp/Mink
src/Session.php
Session.visit
public function visit($url) { // start session if needed if (!$this->isStarted()) { $this->start(); } $this->driver->visit($url); }
php
public function visit($url) { // start session if needed if (!$this->isStarted()) { $this->start(); } $this->driver->visit($url); }
[ "public", "function", "visit", "(", "$", "url", ")", "{", "// start session if needed", "if", "(", "!", "$", "this", "->", "isStarted", "(", ")", ")", "{", "$", "this", "->", "start", "(", ")", ";", "}", "$", "this", "->", "driver", "->", "visit", ...
Visit specified URL and automatically start session if not already running. @param string $url url of the page
[ "Visit", "specified", "URL", "and", "automatically", "start", "session", "if", "not", "already", "running", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Session.php#L141-L149
minkphp/Mink
src/Session.php
Session.getResponseHeader
public function getResponseHeader($name) { $headers = $this->driver->getResponseHeaders(); $name = strtolower($name); $headers = array_change_key_case($headers, CASE_LOWER); if (!isset($headers[$name])) { return null; } return is_array($headers[$name]) ...
php
public function getResponseHeader($name) { $headers = $this->driver->getResponseHeaders(); $name = strtolower($name); $headers = array_change_key_case($headers, CASE_LOWER); if (!isset($headers[$name])) { return null; } return is_array($headers[$name]) ...
[ "public", "function", "getResponseHeader", "(", "$", "name", ")", "{", "$", "headers", "=", "$", "this", "->", "driver", "->", "getResponseHeaders", "(", ")", ";", "$", "name", "=", "strtolower", "(", "$", "name", ")", ";", "$", "headers", "=", "array_...
Returns specific response header. @param string $name @return string|null
[ "Returns", "specific", "response", "header", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Session.php#L190-L202
minkphp/Mink
src/Session.php
Session.resizeWindow
public function resizeWindow($width, $height, $name = null) { $this->driver->resizeWindow($width, $height, $name); }
php
public function resizeWindow($width, $height, $name = null) { $this->driver->resizeWindow($width, $height, $name); }
[ "public", "function", "resizeWindow", "(", "$", "width", ",", "$", "height", ",", "$", "name", "=", "null", ")", "{", "$", "this", "->", "driver", "->", "resizeWindow", "(", "$", "width", ",", "$", "height", ",", "$", "name", ")", ";", "}" ]
Set the dimensions of the window. @param int $width set the window width, measured in pixels @param int $height set the window height, measured in pixels @param string $name window name (null for the main window)
[ "Set", "the", "dimensions", "of", "the", "window", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Session.php#L364-L367
minkphp/Mink
src/Selector/SelectorsHandler.php
SelectorsHandler.getSelector
public function getSelector($name) { if ('named' === $name) { @trigger_error( 'Using the "named" selector directly from the handler is deprecated as of 1.6 and will be removed in 2.0.' .' Use the "named_partial" or use the "named" selector through the Element API ...
php
public function getSelector($name) { if ('named' === $name) { @trigger_error( 'Using the "named" selector directly from the handler is deprecated as of 1.6 and will be removed in 2.0.' .' Use the "named_partial" or use the "named" selector through the Element API ...
[ "public", "function", "getSelector", "(", "$", "name", ")", "{", "if", "(", "'named'", "===", "$", "name", ")", "{", "@", "trigger_error", "(", "'Using the \"named\" selector directly from the handler is deprecated as of 1.6 and will be removed in 2.0.'", ".", "' Use the \"...
Returns selector engine with specified name. @param string $name selector engine name @return SelectorInterface @throws \InvalidArgumentException
[ "Returns", "selector", "engine", "with", "specified", "name", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Selector/SelectorsHandler.php#L75-L91
minkphp/Mink
src/Selector/SelectorsHandler.php
SelectorsHandler.selectorToXpath
public function selectorToXpath($selector, $locator) { if ('xpath' === $selector) { if (!is_string($locator)) { throw new \InvalidArgumentException('The xpath selector expects to get a string as locator'); } return $locator; } return $thi...
php
public function selectorToXpath($selector, $locator) { if ('xpath' === $selector) { if (!is_string($locator)) { throw new \InvalidArgumentException('The xpath selector expects to get a string as locator'); } return $locator; } return $thi...
[ "public", "function", "selectorToXpath", "(", "$", "selector", ",", "$", "locator", ")", "{", "if", "(", "'xpath'", "===", "$", "selector", ")", "{", "if", "(", "!", "is_string", "(", "$", "locator", ")", ")", "{", "throw", "new", "\\", "InvalidArgumen...
Translates selector with specified name to XPath. @param string $selector selector engine name (registered) @param string|array $locator selector locator (an array or a string depending of the selector being used) @return string
[ "Translates", "selector", "with", "specified", "name", "to", "XPath", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Selector/SelectorsHandler.php#L101-L112
minkphp/Mink
src/Driver/CoreDriver.php
CoreDriver.find
public function find($xpath) { $elements = array(); foreach ($this->findElementXpaths($xpath) as $xpath) { $elements[] = new NodeElement($xpath, $this->session); } return $elements; }
php
public function find($xpath) { $elements = array(); foreach ($this->findElementXpaths($xpath) as $xpath) { $elements[] = new NodeElement($xpath, $this->session); } return $elements; }
[ "public", "function", "find", "(", "$", "xpath", ")", "{", "$", "elements", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "findElementXpaths", "(", "$", "xpath", ")", "as", "$", "xpath", ")", "{", "$", "elements", "[", "]", "=", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Driver/CoreDriver.php#L97-L106
minkphp/Mink
src/Exception/ExpectationException.php
ExpectationException.getSession
protected function getSession() { if (null === $this->session) { throw new \LogicException(sprintf('The deprecated method %s cannot be used when passing a driver in the constructor', __METHOD__)); } @trigger_error(sprintf('The method %s is deprecated as of Mink 1.7 and will be r...
php
protected function getSession() { if (null === $this->session) { throw new \LogicException(sprintf('The deprecated method %s cannot be used when passing a driver in the constructor', __METHOD__)); } @trigger_error(sprintf('The method %s is deprecated as of Mink 1.7 and will be r...
[ "protected", "function", "getSession", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "session", ")", "{", "throw", "new", "\\", "LogicException", "(", "sprintf", "(", "'The deprecated method %s cannot be used when passing a driver in the constructor'", "...
Returns exception session. @return Session @deprecated since 1.7, to be removed in 2.0. Use getDriver and the driver API instead.
[ "Returns", "exception", "session", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Exception/ExpectationException.php#L100-L109
minkphp/Mink
src/Exception/ExpectationException.php
ExpectationException.trimString
protected function trimString($string, $count = 1000) { $string = trim($string); if ($count < mb_strlen($string)) { return mb_substr($string, 0, $count - 3).'...'; } return $string; }
php
protected function trimString($string, $count = 1000) { $string = trim($string); if ($count < mb_strlen($string)) { return mb_substr($string, 0, $count - 3).'...'; } return $string; }
[ "protected", "function", "trimString", "(", "$", "string", ",", "$", "count", "=", "1000", ")", "{", "$", "string", "=", "trim", "(", "$", "string", ")", ";", "if", "(", "$", "count", "<", "mb_strlen", "(", "$", "string", ")", ")", "{", "return", ...
Trims string to specified number of chars. @param string $string response content @param int $count trim count @return string
[ "Trims", "string", "to", "specified", "number", "of", "chars", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Exception/ExpectationException.php#L145-L154
minkphp/Mink
src/Exception/ExpectationException.php
ExpectationException.getResponseInfo
protected function getResponseInfo() { $driver = basename(str_replace('\\', '/', get_class($this->driver))); $info = '+--[ '; try { $info .= 'HTTP/1.1 '.$this->driver->getStatusCode().' | '; } catch (UnsupportedDriverActionException $e) { // Ignore the status...
php
protected function getResponseInfo() { $driver = basename(str_replace('\\', '/', get_class($this->driver))); $info = '+--[ '; try { $info .= 'HTTP/1.1 '.$this->driver->getStatusCode().' | '; } catch (UnsupportedDriverActionException $e) { // Ignore the status...
[ "protected", "function", "getResponseInfo", "(", ")", "{", "$", "driver", "=", "basename", "(", "str_replace", "(", "'\\\\'", ",", "'/'", ",", "get_class", "(", "$", "this", "->", "driver", ")", ")", ")", ";", "$", "info", "=", "'+--[ '", ";", "try", ...
Returns response information string. @return string
[ "Returns", "response", "information", "string", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Exception/ExpectationException.php#L161-L174
minkphp/Mink
src/Selector/NamedSelector.php
NamedSelector.translateToXPath
public function translateToXPath($locator) { if (\is_array($locator)) { if (2 !== \count($locator)) { throw new \InvalidArgumentException('NamedSelector expects array(name, locator) as argument'); } $selector = $locator[0]; $locator = $locator...
php
public function translateToXPath($locator) { if (\is_array($locator)) { if (2 !== \count($locator)) { throw new \InvalidArgumentException('NamedSelector expects array(name, locator) as argument'); } $selector = $locator[0]; $locator = $locator...
[ "public", "function", "translateToXPath", "(", "$", "locator", ")", "{", "if", "(", "\\", "is_array", "(", "$", "locator", ")", ")", "{", "if", "(", "2", "!==", "\\", "count", "(", "$", "locator", ")", ")", "{", "throw", "new", "\\", "InvalidArgument...
Translates provided locator into XPath. @param string|array $locator selector name or array of (selector_name, locator) @return string @throws \InvalidArgumentException
[ "Translates", "provided", "locator", "into", "XPath", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Selector/NamedSelector.php#L200-L229
minkphp/Mink
src/Mink.php
Mink.registerSession
public function registerSession($name, Session $session) { $name = strtolower($name); $this->sessions[$name] = $session; }
php
public function registerSession($name, Session $session) { $name = strtolower($name); $this->sessions[$name] = $session; }
[ "public", "function", "registerSession", "(", "$", "name", ",", "Session", "$", "session", ")", "{", "$", "name", "=", "strtolower", "(", "$", "name", ")", ";", "$", "this", "->", "sessions", "[", "$", "name", "]", "=", "$", "session", ";", "}" ]
Registers new session. @param string $name @param Session $session
[ "Registers", "new", "session", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Mink.php#L55-L60
minkphp/Mink
src/Mink.php
Mink.setDefaultSessionName
public function setDefaultSessionName($name) { $name = strtolower($name); if (!isset($this->sessions[$name])) { throw new \InvalidArgumentException(sprintf('Session "%s" is not registered.', $name)); } $this->defaultSessionName = $name; }
php
public function setDefaultSessionName($name) { $name = strtolower($name); if (!isset($this->sessions[$name])) { throw new \InvalidArgumentException(sprintf('Session "%s" is not registered.', $name)); } $this->defaultSessionName = $name; }
[ "public", "function", "setDefaultSessionName", "(", "$", "name", ")", "{", "$", "name", "=", "strtolower", "(", "$", "name", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "sessions", "[", "$", "name", "]", ")", ")", "{", "throw", "new"...
Sets default session name to use. @param string $name name of the registered session @throws \InvalidArgumentException
[ "Sets", "default", "session", "name", "to", "use", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Mink.php#L81-L90
minkphp/Mink
src/Mink.php
Mink.assertSession
public function assertSession($session = null) { if (!($session instanceof Session)) { $session = $this->getSession($session); } return new WebAssert($session); }
php
public function assertSession($session = null) { if (!($session instanceof Session)) { $session = $this->getSession($session); } return new WebAssert($session); }
[ "public", "function", "assertSession", "(", "$", "session", "=", "null", ")", "{", "if", "(", "!", "(", "$", "session", "instanceof", "Session", ")", ")", "{", "$", "session", "=", "$", "this", "->", "getSession", "(", "$", "session", ")", ";", "}", ...
Returns session asserter. @param Session|string $session session object or name @return WebAssert
[ "Returns", "session", "asserter", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Mink.php#L139-L146
minkphp/Mink
src/Mink.php
Mink.locateSession
protected function locateSession($name = null) { $name = strtolower($name) ?: $this->defaultSessionName; if (null === $name) { throw new \InvalidArgumentException('Specify session name to get'); } if (!isset($this->sessions[$name])) { throw new \InvalidArgum...
php
protected function locateSession($name = null) { $name = strtolower($name) ?: $this->defaultSessionName; if (null === $name) { throw new \InvalidArgumentException('Specify session name to get'); } if (!isset($this->sessions[$name])) { throw new \InvalidArgum...
[ "protected", "function", "locateSession", "(", "$", "name", "=", "null", ")", "{", "$", "name", "=", "strtolower", "(", "$", "name", ")", "?", ":", "$", "this", "->", "defaultSessionName", ";", "if", "(", "null", "===", "$", "name", ")", "{", "throw"...
Returns the named or default session without starting it. @param string $name session name @return Session @throws \InvalidArgumentException If the named session is not registered
[ "Returns", "the", "named", "or", "default", "session", "without", "starting", "it", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Mink.php#L193-L208
minkphp/Mink
src/Selector/CssSelector.php
CssSelector.translateToXPath
public function translateToXPath($locator) { if (!is_string($locator)) { throw new \InvalidArgumentException('The CssSelector expects to get a string as locator'); } // Symfony 2.8+ API if (class_exists('Symfony\Component\CssSelector\CssSelectorConverter')) { ...
php
public function translateToXPath($locator) { if (!is_string($locator)) { throw new \InvalidArgumentException('The CssSelector expects to get a string as locator'); } // Symfony 2.8+ API if (class_exists('Symfony\Component\CssSelector\CssSelectorConverter')) { ...
[ "public", "function", "translateToXPath", "(", "$", "locator", ")", "{", "if", "(", "!", "is_string", "(", "$", "locator", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The CssSelector expects to get a string as locator'", ")", ";", "}", ...
Translates CSS into XPath. @param string|array $locator current selector locator @return string
[ "Translates", "CSS", "into", "XPath", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Selector/CssSelector.php#L30-L45
minkphp/Mink
src/Selector/Xpath/Manipulator.php
Manipulator.prepend
public function prepend($xpath, $prefix) { $expressions = array(); // If the xpath prefix contains a union we need to wrap it in parentheses. if (preg_match(self::UNION_PATTERN, $prefix)) { $prefix = '('.$prefix.')'; } // Split any unions into individual express...
php
public function prepend($xpath, $prefix) { $expressions = array(); // If the xpath prefix contains a union we need to wrap it in parentheses. if (preg_match(self::UNION_PATTERN, $prefix)) { $prefix = '('.$prefix.')'; } // Split any unions into individual express...
[ "public", "function", "prepend", "(", "$", "xpath", ",", "$", "prefix", ")", "{", "$", "expressions", "=", "array", "(", ")", ";", "// If the xpath prefix contains a union we need to wrap it in parentheses.", "if", "(", "preg_match", "(", "self", "::", "UNION_PATTER...
Prepends the XPath prefix to the given XPath. The returned XPath will match elements matching the XPath inside an element matching the prefix. @param string $xpath @param string $prefix @return string
[ "Prepends", "the", "XPath", "prefix", "to", "the", "given", "XPath", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Selector/Xpath/Manipulator.php#L37-L68
minkphp/Mink
src/Selector/Xpath/Manipulator.php
Manipulator.splitUnionParts
private function splitUnionParts($xpath) { if (false === strpos($xpath, '|')) { return array($xpath); // If there is no pipe in the string, we know for sure that there is no union } $xpathLen = strlen($xpath); $openedBrackets = 0; // Consume whitespaces chars at ...
php
private function splitUnionParts($xpath) { if (false === strpos($xpath, '|')) { return array($xpath); // If there is no pipe in the string, we know for sure that there is no union } $xpathLen = strlen($xpath); $openedBrackets = 0; // Consume whitespaces chars at ...
[ "private", "function", "splitUnionParts", "(", "$", "xpath", ")", "{", "if", "(", "false", "===", "strpos", "(", "$", "xpath", ",", "'|'", ")", ")", "{", "return", "array", "(", "$", "xpath", ")", ";", "// If there is no pipe in the string, we know for sure th...
Splits the XPath into parts that are separated by the union operator. @param string $xpath @return string[]
[ "Splits", "the", "XPath", "into", "parts", "that", "are", "separated", "by", "the", "union", "operator", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Selector/Xpath/Manipulator.php#L77-L127
minkphp/Mink
src/Element/NodeElement.php
NodeElement.hasClass
public function hasClass($className) { if ($this->hasAttribute('class')) { return in_array($className, preg_split('/\s+/', $this->getAttribute('class'))); } return false; }
php
public function hasClass($className) { if ($this->hasAttribute('class')) { return in_array($className, preg_split('/\s+/', $this->getAttribute('class'))); } return false; }
[ "public", "function", "hasClass", "(", "$", "className", ")", "{", "if", "(", "$", "this", "->", "hasAttribute", "(", "'class'", ")", ")", "{", "return", "in_array", "(", "$", "className", ",", "preg_split", "(", "'/\\s+/'", ",", "$", "this", "->", "ge...
Checks whether an element has a named CSS class. @param string $className Name of the class @return bool
[ "Checks", "whether", "an", "element", "has", "a", "named", "CSS", "class", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/NodeElement.php#L139-L146
minkphp/Mink
src/Element/NodeElement.php
NodeElement.selectOption
public function selectOption($option, $multiple = false) { if ('select' !== $this->getTagName()) { $this->getDriver()->selectOption($this->getXpath(), $option, $multiple); return; } $opt = $this->find('named', array('option', $option)); if (null === $opt) {...
php
public function selectOption($option, $multiple = false) { if ('select' !== $this->getTagName()) { $this->getDriver()->selectOption($this->getXpath(), $option, $multiple); return; } $opt = $this->find('named', array('option', $option)); if (null === $opt) {...
[ "public", "function", "selectOption", "(", "$", "option", ",", "$", "multiple", "=", "false", ")", "{", "if", "(", "'select'", "!==", "$", "this", "->", "getTagName", "(", ")", ")", "{", "$", "this", "->", "getDriver", "(", ")", "->", "selectOption", ...
Selects specified option for select field or specified radio button in the group. If the current node is a select box, this selects the option found by its value or its text. If the current node is a radio button, this selects the radio button with the given value in the radio button group of the current node. Callin...
[ "Selects", "specified", "option", "for", "select", "field", "or", "specified", "radio", "button", "in", "the", "group", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/NodeElement.php#L223-L238
minkphp/Mink
src/Element/NodeElement.php
NodeElement.dragTo
public function dragTo(ElementInterface $destination) { $this->getDriver()->dragTo($this->getXpath(), $destination->getXpath()); }
php
public function dragTo(ElementInterface $destination) { $this->getDriver()->dragTo($this->getXpath(), $destination->getXpath()); }
[ "public", "function", "dragTo", "(", "ElementInterface", "$", "destination", ")", "{", "$", "this", "->", "getDriver", "(", ")", "->", "dragTo", "(", "$", "this", "->", "getXpath", "(", ")", ",", "$", "destination", "->", "getXpath", "(", ")", ")", ";"...
Drags current node onto other node. @param ElementInterface $destination other node
[ "Drags", "current", "node", "onto", "other", "node", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/NodeElement.php#L287-L290
minkphp/Mink
src/Element/NodeElement.php
NodeElement.keyPress
public function keyPress($char, $modifier = null) { $this->getDriver()->keyPress($this->getXpath(), $char, $modifier); }
php
public function keyPress($char, $modifier = null) { $this->getDriver()->keyPress($this->getXpath(), $char, $modifier); }
[ "public", "function", "keyPress", "(", "$", "char", ",", "$", "modifier", "=", "null", ")", "{", "$", "this", "->", "getDriver", "(", ")", "->", "keyPress", "(", "$", "this", "->", "getXpath", "(", ")", ",", "$", "char", ",", "$", "modifier", ")", ...
Presses specific keyboard key. @param string|int $char could be either char ('b') or char-code (98) @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta')
[ "Presses", "specific", "keyboard", "key", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/NodeElement.php#L314-L317
minkphp/Mink
src/Element/NodeElement.php
NodeElement.keyDown
public function keyDown($char, $modifier = null) { $this->getDriver()->keyDown($this->getXpath(), $char, $modifier); }
php
public function keyDown($char, $modifier = null) { $this->getDriver()->keyDown($this->getXpath(), $char, $modifier); }
[ "public", "function", "keyDown", "(", "$", "char", ",", "$", "modifier", "=", "null", ")", "{", "$", "this", "->", "getDriver", "(", ")", "->", "keyDown", "(", "$", "this", "->", "getXpath", "(", ")", ",", "$", "char", ",", "$", "modifier", ")", ...
Pressed down specific keyboard key. @param string|int $char could be either char ('b') or char-code (98) @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta')
[ "Pressed", "down", "specific", "keyboard", "key", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/NodeElement.php#L325-L328
minkphp/Mink
src/Element/NodeElement.php
NodeElement.keyUp
public function keyUp($char, $modifier = null) { $this->getDriver()->keyUp($this->getXpath(), $char, $modifier); }
php
public function keyUp($char, $modifier = null) { $this->getDriver()->keyUp($this->getXpath(), $char, $modifier); }
[ "public", "function", "keyUp", "(", "$", "char", ",", "$", "modifier", "=", "null", ")", "{", "$", "this", "->", "getDriver", "(", ")", "->", "keyUp", "(", "$", "this", "->", "getXpath", "(", ")", ",", "$", "char", ",", "$", "modifier", ")", ";",...
Pressed up specific keyboard key. @param string|int $char could be either char ('b') or char-code (98) @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta')
[ "Pressed", "up", "specific", "keyboard", "key", "." ]
train
https://github.com/minkphp/Mink/blob/d5ee350c40baff5f331a05ebdbe1927345c9ac8b/src/Element/NodeElement.php#L336-L339
ramsey/uuid-doctrine
src/UuidBinaryType.php
UuidBinaryType.convertToPHPValue
public function convertToPHPValue($value, AbstractPlatform $platform) { if (empty($value)) { return null; } if ($value instanceof UuidInterface) { return $value; } try { $uuid = Uuid::fromBytes($value); } catch (InvalidArgumentExc...
php
public function convertToPHPValue($value, AbstractPlatform $platform) { if (empty($value)) { return null; } if ($value instanceof UuidInterface) { return $value; } try { $uuid = Uuid::fromBytes($value); } catch (InvalidArgumentExc...
[ "public", "function", "convertToPHPValue", "(", "$", "value", ",", "AbstractPlatform", "$", "platform", ")", "{", "if", "(", "empty", "(", "$", "value", ")", ")", "{", "return", "null", ";", "}", "if", "(", "$", "value", "instanceof", "UuidInterface", ")...
{@inheritdoc} @param string|UuidInterface|null $value @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
[ "{", "@inheritdoc", "}" ]
train
https://github.com/ramsey/uuid-doctrine/blob/b1c6b9a8cc6c93faf7ce45abc6988fb0dd8628de/src/UuidBinaryType.php#L58-L75
ramsey/uuid-doctrine
src/UuidBinaryType.php
UuidBinaryType.convertToDatabaseValue
public function convertToDatabaseValue($value, AbstractPlatform $platform) { if (empty($value)) { return null; } if ($value instanceof UuidInterface) { return $value->getBytes(); } try { if (is_string($value) || method_exists($value, '__t...
php
public function convertToDatabaseValue($value, AbstractPlatform $platform) { if (empty($value)) { return null; } if ($value instanceof UuidInterface) { return $value->getBytes(); } try { if (is_string($value) || method_exists($value, '__t...
[ "public", "function", "convertToDatabaseValue", "(", "$", "value", ",", "AbstractPlatform", "$", "platform", ")", "{", "if", "(", "empty", "(", "$", "value", ")", ")", "{", "return", "null", ";", "}", "if", "(", "$", "value", "instanceof", "UuidInterface",...
{@inheritdoc} @param UuidInterface|string|null $value @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
[ "{", "@inheritdoc", "}" ]
train
https://github.com/ramsey/uuid-doctrine/blob/b1c6b9a8cc6c93faf7ce45abc6988fb0dd8628de/src/UuidBinaryType.php#L83-L102