id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
39,100
richardfullmer/php-rabbitmq-management-api
src/Api/Queue.php
Queue.purgeMessages
public function purgeMessages($vhost, $name) { return $this->client->send(sprintf('/api/queues/%s/%s/contents', urlencode($vhost), urlencode($name)), 'DELETE'); }
php
public function purgeMessages($vhost, $name) { return $this->client->send(sprintf('/api/queues/%s/%s/contents', urlencode($vhost), urlencode($name)), 'DELETE'); }
[ "public", "function", "purgeMessages", "(", "$", "vhost", ",", "$", "name", ")", "{", "return", "$", "this", "->", "client", "->", "send", "(", "sprintf", "(", "'/api/queues/%s/%s/contents'", ",", "urlencode", "(", "$", "vhost", ")", ",", "urlencode", "(",...
Contents of a queue. DELETE to purge. Note you can't GET this. @param string $vhost @param string $name @return array
[ "Contents", "of", "a", "queue", ".", "DELETE", "to", "purge", ".", "Note", "you", "can", "t", "GET", "this", "." ]
047383f9fc9dd0287e914f4a6f6c8ba9115e9aba
https://github.com/richardfullmer/php-rabbitmq-management-api/blob/047383f9fc9dd0287e914f4a6f6c8ba9115e9aba/src/Api/Queue.php#L94-L97
39,101
richardfullmer/php-rabbitmq-management-api
src/Api/Binding.php
Binding.all
public function all($vhost = null) { if ($vhost) { return $this->client->send(sprintf('/api/bindings/%s', urlencode($vhost))); } else { return $this->client->send('/api/bindings'); } }
php
public function all($vhost = null) { if ($vhost) { return $this->client->send(sprintf('/api/bindings/%s', urlencode($vhost))); } else { return $this->client->send('/api/bindings'); } }
[ "public", "function", "all", "(", "$", "vhost", "=", "null", ")", "{", "if", "(", "$", "vhost", ")", "{", "return", "$", "this", "->", "client", "->", "send", "(", "sprintf", "(", "'/api/bindings/%s'", ",", "urlencode", "(", "$", "vhost", ")", ")", ...
A list of all bindings. OR A list of all bindings in a given virtual host. @param string|null $vhost @return array
[ "A", "list", "of", "all", "bindings", "." ]
047383f9fc9dd0287e914f4a6f6c8ba9115e9aba
https://github.com/richardfullmer/php-rabbitmq-management-api/blob/047383f9fc9dd0287e914f4a6f6c8ba9115e9aba/src/Api/Binding.php#L20-L27
39,102
richardfullmer/php-rabbitmq-management-api
src/Api/Binding.php
Binding.binding
public function binding($vhost, $exchange, $queue) { return $this->client->send(sprintf('/api/bindings/%s/e/%s/q/%s', urlencode($vhost), urlencode($exchange), urlencode($queue))); }
php
public function binding($vhost, $exchange, $queue) { return $this->client->send(sprintf('/api/bindings/%s/e/%s/q/%s', urlencode($vhost), urlencode($exchange), urlencode($queue))); }
[ "public", "function", "binding", "(", "$", "vhost", ",", "$", "exchange", ",", "$", "queue", ")", "{", "return", "$", "this", "->", "client", "->", "send", "(", "sprintf", "(", "'/api/bindings/%s/e/%s/q/%s'", ",", "urlencode", "(", "$", "vhost", ")", ","...
A list of all bindings between an exchange and a queue. Remember, an exchange and a queue can be bound together many times! @param string $vhost @param string $exchange @param string $queue @return array
[ "A", "list", "of", "all", "bindings", "between", "an", "exchange", "and", "a", "queue", ".", "Remember", "an", "exchange", "and", "a", "queue", "can", "be", "bound", "together", "many", "times!" ]
047383f9fc9dd0287e914f4a6f6c8ba9115e9aba
https://github.com/richardfullmer/php-rabbitmq-management-api/blob/047383f9fc9dd0287e914f4a6f6c8ba9115e9aba/src/Api/Binding.php#L38-L41
39,103
richardfullmer/php-rabbitmq-management-api
src/Api/Binding.php
Binding.exchangeBinding
public function exchangeBinding($vhost, $source, $destination) { return $this->client->send(sprintf('/api/bindings/%s/e/%s/e/%s', urlencode($vhost), urlencode($source), urlencode($destination))); }
php
public function exchangeBinding($vhost, $source, $destination) { return $this->client->send(sprintf('/api/bindings/%s/e/%s/e/%s', urlencode($vhost), urlencode($source), urlencode($destination))); }
[ "public", "function", "exchangeBinding", "(", "$", "vhost", ",", "$", "source", ",", "$", "destination", ")", "{", "return", "$", "this", "->", "client", "->", "send", "(", "sprintf", "(", "'/api/bindings/%s/e/%s/e/%s'", ",", "urlencode", "(", "$", "vhost", ...
A list of all bindings between two exchanges. Remember, two exchanges can be bound together many times with different parameters! @param string $vhost @param string $source @param string $destination @return array
[ "A", "list", "of", "all", "bindings", "between", "two", "exchanges", ".", "Remember", "two", "exchanges", "can", "be", "bound", "together", "many", "times", "with", "different", "parameters!" ]
047383f9fc9dd0287e914f4a6f6c8ba9115e9aba
https://github.com/richardfullmer/php-rabbitmq-management-api/blob/047383f9fc9dd0287e914f4a6f6c8ba9115e9aba/src/Api/Binding.php#L53-L56
39,104
richardfullmer/php-rabbitmq-management-api
src/Api/Binding.php
Binding.delete
public function delete($vhost, $exchange, $queue, $props) { return $this->client->send(sprintf('/api/bindings/%s/e/%s/q/%s/%s', urlencode($vhost), urlencode($exchange), urlencode($queue), urlencode($props)), 'DELETE'); }
php
public function delete($vhost, $exchange, $queue, $props) { return $this->client->send(sprintf('/api/bindings/%s/e/%s/q/%s/%s', urlencode($vhost), urlencode($exchange), urlencode($queue), urlencode($props)), 'DELETE'); }
[ "public", "function", "delete", "(", "$", "vhost", ",", "$", "exchange", ",", "$", "queue", ",", "$", "props", ")", "{", "return", "$", "this", "->", "client", "->", "send", "(", "sprintf", "(", "'/api/bindings/%s/e/%s/q/%s/%s'", ",", "urlencode", "(", "...
Remove an individual binding between an exchange and a queue. @param string $vhost @param string $exchange @param string $queue @param string $props @return array
[ "Remove", "an", "individual", "binding", "between", "an", "exchange", "and", "a", "queue", "." ]
047383f9fc9dd0287e914f4a6f6c8ba9115e9aba
https://github.com/richardfullmer/php-rabbitmq-management-api/blob/047383f9fc9dd0287e914f4a6f6c8ba9115e9aba/src/Api/Binding.php#L163-L166
39,105
richardfullmer/php-rabbitmq-management-api
src/Api/Binding.php
Binding.deleteExchange
public function deleteExchange($vhost, $source, $destination, $props) { return $this->client->send(sprintf('/api/bindings/%s/e/%s/e/%s/%s', urlencode($vhost), urlencode($source), urlencode($destination), urlencode($props)), 'DELETE'); }
php
public function deleteExchange($vhost, $source, $destination, $props) { return $this->client->send(sprintf('/api/bindings/%s/e/%s/e/%s/%s', urlencode($vhost), urlencode($source), urlencode($destination), urlencode($props)), 'DELETE'); }
[ "public", "function", "deleteExchange", "(", "$", "vhost", ",", "$", "source", ",", "$", "destination", ",", "$", "props", ")", "{", "return", "$", "this", "->", "client", "->", "send", "(", "sprintf", "(", "'/api/bindings/%s/e/%s/e/%s/%s'", ",", "urlencode"...
Remove an individual binding between two exchanges. @param string $vhost @param string $source @param string $destination @param string $props @return array
[ "Remove", "an", "individual", "binding", "between", "two", "exchanges", "." ]
047383f9fc9dd0287e914f4a6f6c8ba9115e9aba
https://github.com/richardfullmer/php-rabbitmq-management-api/blob/047383f9fc9dd0287e914f4a6f6c8ba9115e9aba/src/Api/Binding.php#L177-L180
39,106
amphp/sync
lib/PosixSemaphore.php
PosixSemaphore.create
public static function create(string $id, int $maxLocks, int $permissions = 0600): self { if ($maxLocks < 1) { throw new \Error("Number of locks must be greater than 0"); } $semaphore = new self($id); $semaphore->init($maxLocks, $permissions); return $semaphore; }
php
public static function create(string $id, int $maxLocks, int $permissions = 0600): self { if ($maxLocks < 1) { throw new \Error("Number of locks must be greater than 0"); } $semaphore = new self($id); $semaphore->init($maxLocks, $permissions); return $semaphore; }
[ "public", "static", "function", "create", "(", "string", "$", "id", ",", "int", "$", "maxLocks", ",", "int", "$", "permissions", "=", "0600", ")", ":", "self", "{", "if", "(", "$", "maxLocks", "<", "1", ")", "{", "throw", "new", "\\", "Error", "(",...
Creates a new semaphore with a given ID and number of locks. @param string $id The unique name for the new semaphore. @param int $maxLocks The maximum number of locks that can be acquired from the semaphore. @param int $permissions Permissions to access the semaphore. Use file permission format specified as 0xxx. @throws SyncException If the semaphore could not be created due to an internal error.
[ "Creates", "a", "new", "semaphore", "with", "a", "given", "ID", "and", "number", "of", "locks", "." ]
f91ee6ddc2b80848bd3906a6b0a8a442d9801093
https://github.com/amphp/sync/blob/f91ee6ddc2b80848bd3906a6b0a8a442d9801093/lib/PosixSemaphore.php#L41-L49
39,107
richardfullmer/php-rabbitmq-management-api
src/Api/Exchange.php
Exchange.get
public function get($vhost, $name) { return $this->client->send(sprintf('/api/exchanges/%s/%s', urlencode($vhost), urlencode($name))); }
php
public function get($vhost, $name) { return $this->client->send(sprintf('/api/exchanges/%s/%s', urlencode($vhost), urlencode($name))); }
[ "public", "function", "get", "(", "$", "vhost", ",", "$", "name", ")", "{", "return", "$", "this", "->", "client", "->", "send", "(", "sprintf", "(", "'/api/exchanges/%s/%s'", ",", "urlencode", "(", "$", "vhost", ")", ",", "urlencode", "(", "$", "name"...
An individual exchange. @param string $vhost @param string $name @return array
[ "An", "individual", "exchange", "." ]
047383f9fc9dd0287e914f4a6f6c8ba9115e9aba
https://github.com/richardfullmer/php-rabbitmq-management-api/blob/047383f9fc9dd0287e914f4a6f6c8ba9115e9aba/src/Api/Exchange.php#L40-L43
39,108
richardfullmer/php-rabbitmq-management-api
src/Api/Exchange.php
Exchange.sourceBindings
public function sourceBindings($vhost, $name) { return $this->client->send(sprintf('/api/exchanges/%s/%s/bindings/source', urlencode($vhost), urlencode($name))); }
php
public function sourceBindings($vhost, $name) { return $this->client->send(sprintf('/api/exchanges/%s/%s/bindings/source', urlencode($vhost), urlencode($name))); }
[ "public", "function", "sourceBindings", "(", "$", "vhost", ",", "$", "name", ")", "{", "return", "$", "this", "->", "client", "->", "send", "(", "sprintf", "(", "'/api/exchanges/%s/%s/bindings/source'", ",", "urlencode", "(", "$", "vhost", ")", ",", "urlenco...
A list of all bindings in which a given exchange is the source. @param string $vhost @param string $name @return array
[ "A", "list", "of", "all", "bindings", "in", "which", "a", "given", "exchange", "is", "the", "source", "." ]
047383f9fc9dd0287e914f4a6f6c8ba9115e9aba
https://github.com/richardfullmer/php-rabbitmq-management-api/blob/047383f9fc9dd0287e914f4a6f6c8ba9115e9aba/src/Api/Exchange.php#L92-L95
39,109
richardfullmer/php-rabbitmq-management-api
src/Api/Exchange.php
Exchange.destinationBindings
public function destinationBindings($vhost, $name) { return $this->client->send(sprintf('/api/exchanges/%s/%s/bindings/destination', urlencode($vhost), urlencode($name))); }
php
public function destinationBindings($vhost, $name) { return $this->client->send(sprintf('/api/exchanges/%s/%s/bindings/destination', urlencode($vhost), urlencode($name))); }
[ "public", "function", "destinationBindings", "(", "$", "vhost", ",", "$", "name", ")", "{", "return", "$", "this", "->", "client", "->", "send", "(", "sprintf", "(", "'/api/exchanges/%s/%s/bindings/destination'", ",", "urlencode", "(", "$", "vhost", ")", ",", ...
A list of all bindings in which a given exchange is the destination. @param string $vhost @param string $name @return array
[ "A", "list", "of", "all", "bindings", "in", "which", "a", "given", "exchange", "is", "the", "destination", "." ]
047383f9fc9dd0287e914f4a6f6c8ba9115e9aba
https://github.com/richardfullmer/php-rabbitmq-management-api/blob/047383f9fc9dd0287e914f4a6f6c8ba9115e9aba/src/Api/Exchange.php#L104-L107
39,110
richardfullmer/php-rabbitmq-management-api
src/Api/Node.php
Node.get
public function get($name, $memory = false) { return $this->client->send(sprintf('/api/nodes/%s%s', urlencode($name), $memory ? '?memory=true' : '')); }
php
public function get($name, $memory = false) { return $this->client->send(sprintf('/api/nodes/%s%s', urlencode($name), $memory ? '?memory=true' : '')); }
[ "public", "function", "get", "(", "$", "name", ",", "$", "memory", "=", "false", ")", "{", "return", "$", "this", "->", "client", "->", "send", "(", "sprintf", "(", "'/api/nodes/%s%s'", ",", "urlencode", "(", "$", "name", ")", ",", "$", "memory", "?"...
An individual node in the RabbitMQ cluster. Add "?memory=true" to get memory statistics. @param string $name @param bool $memory @return array
[ "An", "individual", "node", "in", "the", "RabbitMQ", "cluster", ".", "Add", "?memory", "=", "true", "to", "get", "memory", "statistics", "." ]
047383f9fc9dd0287e914f4a6f6c8ba9115e9aba
https://github.com/richardfullmer/php-rabbitmq-management-api/blob/047383f9fc9dd0287e914f4a6f6c8ba9115e9aba/src/Api/Node.php#L29-L32
39,111
amphp/sync
lib/Lock.php
Lock.release
public function release() { if (!$this->releaser) { return; } // Invoke the releaser function given to us by the synchronization source // to release the lock. $releaser = $this->releaser; $this->releaser = null; ($releaser)($this); }
php
public function release() { if (!$this->releaser) { return; } // Invoke the releaser function given to us by the synchronization source // to release the lock. $releaser = $this->releaser; $this->releaser = null; ($releaser)($this); }
[ "public", "function", "release", "(", ")", "{", "if", "(", "!", "$", "this", "->", "releaser", ")", "{", "return", ";", "}", "// Invoke the releaser function given to us by the synchronization source", "// to release the lock.", "$", "releaser", "=", "$", "this", "-...
Releases the lock. No-op if the lock has already been released.
[ "Releases", "the", "lock", ".", "No", "-", "op", "if", "the", "lock", "has", "already", "been", "released", "." ]
f91ee6ddc2b80848bd3906a6b0a8a442d9801093
https://github.com/amphp/sync/blob/f91ee6ddc2b80848bd3906a6b0a8a442d9801093/lib/Lock.php#L50-L60
39,112
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageUrlMatcher/ComponentPageUrlMatcher.php
ComponentPageUrlMatcher.matchComponent
protected function matchComponent(MatchUrlComponentAnnotation $annotation, $url) { $parser = new Parser($url); return $this->matchByProperty($annotation, $parser, 'path') && $this->matchParams($annotation, $parser) && $this->matchSecure($annotation, $parser) && $this->matchByProperty($annotation, $parser, 'anchor', 'fragment') && $this->matchByProperty($annotation, $parser, 'host') && $this->matchByProperty($annotation, $parser, 'port') && $this->matchByProperty($annotation, $parser, 'user') && $this->matchByProperty($annotation, $parser, 'pass'); }
php
protected function matchComponent(MatchUrlComponentAnnotation $annotation, $url) { $parser = new Parser($url); return $this->matchByProperty($annotation, $parser, 'path') && $this->matchParams($annotation, $parser) && $this->matchSecure($annotation, $parser) && $this->matchByProperty($annotation, $parser, 'anchor', 'fragment') && $this->matchByProperty($annotation, $parser, 'host') && $this->matchByProperty($annotation, $parser, 'port') && $this->matchByProperty($annotation, $parser, 'user') && $this->matchByProperty($annotation, $parser, 'pass'); }
[ "protected", "function", "matchComponent", "(", "MatchUrlComponentAnnotation", "$", "annotation", ",", "$", "url", ")", "{", "$", "parser", "=", "new", "Parser", "(", "$", "url", ")", ";", "return", "$", "this", "->", "matchByProperty", "(", "$", "annotation...
Matches components to url. @param MatchUrlComponentAnnotation $annotation The used annotation. @param string $url The current url. @return boolean
[ "Matches", "components", "to", "url", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageUrlMatcher/ComponentPageUrlMatcher.php#L82-L94
39,113
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageUrlMatcher/ComponentPageUrlMatcher.php
ComponentPageUrlMatcher.matchParams
protected function matchParams(MatchUrlComponentAnnotation $annotation, Parser $parser) { // Not specified means match anything. if ( !isset($annotation->params) ) { return true; } return $parser->getParams() == $annotation->params; }
php
protected function matchParams(MatchUrlComponentAnnotation $annotation, Parser $parser) { // Not specified means match anything. if ( !isset($annotation->params) ) { return true; } return $parser->getParams() == $annotation->params; }
[ "protected", "function", "matchParams", "(", "MatchUrlComponentAnnotation", "$", "annotation", ",", "Parser", "$", "parser", ")", "{", "// Not specified means match anything.", "if", "(", "!", "isset", "(", "$", "annotation", "->", "params", ")", ")", "{", "return...
Matches query params. @param MatchUrlComponentAnnotation $annotation The annotation. @param Parser $parser Parser instance to match against. @return boolean
[ "Matches", "query", "params", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageUrlMatcher/ComponentPageUrlMatcher.php#L104-L112
39,114
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageUrlMatcher/ComponentPageUrlMatcher.php
ComponentPageUrlMatcher.matchSecure
protected function matchSecure(MatchUrlComponentAnnotation $annotation, Parser $parser) { // Not specified means match anything. if ( !isset($annotation->secure) ) { return true; } return $parser->getComponent('scheme') === ($annotation->secure ? 'https' : 'http'); }
php
protected function matchSecure(MatchUrlComponentAnnotation $annotation, Parser $parser) { // Not specified means match anything. if ( !isset($annotation->secure) ) { return true; } return $parser->getComponent('scheme') === ($annotation->secure ? 'https' : 'http'); }
[ "protected", "function", "matchSecure", "(", "MatchUrlComponentAnnotation", "$", "annotation", ",", "Parser", "$", "parser", ")", "{", "// Not specified means match anything.", "if", "(", "!", "isset", "(", "$", "annotation", "->", "secure", ")", ")", "{", "return...
Matches secure option. @param MatchUrlComponentAnnotation $annotation The annotation. @param Parser $parser Parser instance to match against. @return boolean
[ "Matches", "secure", "option", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageUrlMatcher/ComponentPageUrlMatcher.php#L122-L130
39,115
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageUrlMatcher/ComponentPageUrlMatcher.php
ComponentPageUrlMatcher.matchByProperty
protected function matchByProperty( MatchUrlComponentAnnotation $annotation, Parser $parser, $property, $component = null ) { // Not specified means match anything. if ( !isset($annotation->$property) ) { return true; } return $parser->getComponent(isset($component) ? $component : $property) === $annotation->$property; }
php
protected function matchByProperty( MatchUrlComponentAnnotation $annotation, Parser $parser, $property, $component = null ) { // Not specified means match anything. if ( !isset($annotation->$property) ) { return true; } return $parser->getComponent(isset($component) ? $component : $property) === $annotation->$property; }
[ "protected", "function", "matchByProperty", "(", "MatchUrlComponentAnnotation", "$", "annotation", ",", "Parser", "$", "parser", ",", "$", "property", ",", "$", "component", "=", "null", ")", "{", "// Not specified means match anything.", "if", "(", "!", "isset", ...
Matches property. @param MatchUrlComponentAnnotation $annotation The annotation. @param Parser $parser Parser instance to match against. @param string $property Property name. @param string|null $component Component name. @return boolean
[ "Matches", "property", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageUrlMatcher/ComponentPageUrlMatcher.php#L142-L154
39,116
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/AbstractElementContainer.php
AbstractElementContainer.fromNodeElement
public static function fromNodeElement(NodeElement $node_element, IPageFactory $page_factory) { $wrapped_element = WebElement::fromNodeElement($node_element, $page_factory); return new static($wrapped_element, $page_factory); }
php
public static function fromNodeElement(NodeElement $node_element, IPageFactory $page_factory) { $wrapped_element = WebElement::fromNodeElement($node_element, $page_factory); return new static($wrapped_element, $page_factory); }
[ "public", "static", "function", "fromNodeElement", "(", "NodeElement", "$", "node_element", ",", "IPageFactory", "$", "page_factory", ")", "{", "$", "wrapped_element", "=", "WebElement", "::", "fromNodeElement", "(", "$", "node_element", ",", "$", "page_factory", ...
Creates Element instance based on existing NodeElement instance. @param NodeElement $node_element Node element. @param IPageFactory $page_factory Page factory. @return static
[ "Creates", "Element", "instance", "based", "on", "existing", "NodeElement", "instance", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/AbstractElementContainer.php#L50-L55
39,117
qa-tools/qa-tools
library/QATools/QATools/BEM/ElementLocator/BEMElementLocatorFactory.php
BEMElementLocatorFactory.createLocator
public function createLocator(Property $property) { return new BEMElementLocator($property, $this->searchContext, $this->annotationManager, $this->_locatorHelper); }
php
public function createLocator(Property $property) { return new BEMElementLocator($property, $this->searchContext, $this->annotationManager, $this->_locatorHelper); }
[ "public", "function", "createLocator", "(", "Property", "$", "property", ")", "{", "return", "new", "BEMElementLocator", "(", "$", "property", ",", "$", "this", "->", "searchContext", ",", "$", "this", "->", "annotationManager", ",", "$", "this", "->", "_loc...
When a field on a class needs to be decorated with an IElementLocator this method will be called. @param Property $property Property. @return IElementLocator
[ "When", "a", "field", "on", "a", "class", "needs", "to", "be", "decorated", "with", "an", "IElementLocator", "this", "method", "will", "be", "called", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/BEM/ElementLocator/BEMElementLocatorFactory.php#L58-L61
39,118
qa-tools/qa-tools
library/QATools/QATools/PageObject/Element/AbstractElementCollection.php
AbstractElementCollection.fromNodeElements
public static function fromNodeElements( array $node_elements, $element_class = null, IPageFactory $page_factory ) { $collection = new static(); if ( !isset($element_class) ) { $element_class = $collection->elementClass; } if ( !$collection->isNodeElementAware($element_class) ) { throw new ElementCollectionException( sprintf('Collection element class "%s" must implement INodeElementAware interface', $element_class), ElementCollectionException::TYPE_INCORRECT_ELEMENT_CLASS ); } foreach ( $node_elements as $node_element ) { $collection[] = call_user_func(array($element_class, 'fromNodeElement'), $node_element, $page_factory); } return $collection; }
php
public static function fromNodeElements( array $node_elements, $element_class = null, IPageFactory $page_factory ) { $collection = new static(); if ( !isset($element_class) ) { $element_class = $collection->elementClass; } if ( !$collection->isNodeElementAware($element_class) ) { throw new ElementCollectionException( sprintf('Collection element class "%s" must implement INodeElementAware interface', $element_class), ElementCollectionException::TYPE_INCORRECT_ELEMENT_CLASS ); } foreach ( $node_elements as $node_element ) { $collection[] = call_user_func(array($element_class, 'fromNodeElement'), $node_element, $page_factory); } return $collection; }
[ "public", "static", "function", "fromNodeElements", "(", "array", "$", "node_elements", ",", "$", "element_class", "=", "null", ",", "IPageFactory", "$", "page_factory", ")", "{", "$", "collection", "=", "new", "static", "(", ")", ";", "if", "(", "!", "iss...
Creates new collection by wrapping given array of Node elements. @param array|NodeElement[] $node_elements Node elements to wrap. @param string $element_class Class name to wrap Node elements with. @param IPageFactory $page_factory Page factory (optional) to use during wrapping. @return static @throws ElementCollectionException When element class used doesn't allow adding NodeElements inside.
[ "Creates", "new", "collection", "by", "wrapping", "given", "array", "of", "Node", "elements", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Element/AbstractElementCollection.php#L99-L122
39,119
qa-tools/qa-tools
library/QATools/QATools/PageObject/Element/AbstractElementCollection.php
AbstractElementCollection.isNodeElementAware
protected function isNodeElementAware($class_name) { $node_element_aware_interface = 'QATools\\QATools\\PageObject\\Element\\INodeElementAware'; if ( class_exists($class_name) ) { return in_array($node_element_aware_interface, class_implements($class_name)); } return false; }
php
protected function isNodeElementAware($class_name) { $node_element_aware_interface = 'QATools\\QATools\\PageObject\\Element\\INodeElementAware'; if ( class_exists($class_name) ) { return in_array($node_element_aware_interface, class_implements($class_name)); } return false; }
[ "protected", "function", "isNodeElementAware", "(", "$", "class_name", ")", "{", "$", "node_element_aware_interface", "=", "'QATools\\\\QATools\\\\PageObject\\\\Element\\\\INodeElementAware'", ";", "if", "(", "class_exists", "(", "$", "class_name", ")", ")", "{", "return"...
Determines if class is NodeElement aware. @param string $class_name Class name. @return boolean
[ "Determines", "if", "class", "is", "NodeElement", "aware", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Element/AbstractElementCollection.php#L131-L140
39,120
qa-tools/qa-tools
library/QATools/QATools/PageObject/Element/AbstractElementCollection.php
AbstractElementCollection.assertElement
protected function assertElement($element) { if ( !is_a($element, $this->elementClass) ) { $message = 'Collection element must be of "%s" class, but element of "%s" class given'; throw new ElementCollectionException( sprintf($message, $this->elementClass, get_class($element)), ElementCollectionException::TYPE_ELEMENT_CLASS_MISMATCH ); } return $this->acceptElement($element); }
php
protected function assertElement($element) { if ( !is_a($element, $this->elementClass) ) { $message = 'Collection element must be of "%s" class, but element of "%s" class given'; throw new ElementCollectionException( sprintf($message, $this->elementClass, get_class($element)), ElementCollectionException::TYPE_ELEMENT_CLASS_MISMATCH ); } return $this->acceptElement($element); }
[ "protected", "function", "assertElement", "(", "$", "element", ")", "{", "if", "(", "!", "is_a", "(", "$", "element", ",", "$", "this", "->", "elementClass", ")", ")", "{", "$", "message", "=", "'Collection element must be of \"%s\" class, but element of \"%s\" cl...
Checks that element's class is allowed in collection. @param mixed $element Element. @return boolean @throws ElementCollectionException When class of given element doesn't match one, that collection accepts.
[ "Checks", "that", "element", "s", "class", "is", "allowed", "in", "collection", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Element/AbstractElementCollection.php#L150-L162
39,121
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/LabeledElement.php
LabeledElement.getLabel
public function getLabel() { $label = null; $id = $this->getAttribute('id'); if ( !is_null($id) ) { // Label with matching "for" attribute. $escaped_id = $this->getXpathEscaper()->escapeLiteral($id); $xpath_expressions = array( 'preceding::label[@for = ' . $escaped_id . ']', 'following::label[@for = ' . $escaped_id . ']', ); $label = $this->getWrappedElement()->find('xpath', '(' . implode(' | ', $xpath_expressions) . ')[1]'); } if ( is_null($label) ) { // Label wrapped around checkbox. $label = $this->getWrappedElement()->find('xpath', 'parent::label'); } if ( is_null($label) ) { // Label right next to checkbox. $label = $this->getWrappedElement()->find('xpath', 'following-sibling::*[1][self::label]'); } return $label; }
php
public function getLabel() { $label = null; $id = $this->getAttribute('id'); if ( !is_null($id) ) { // Label with matching "for" attribute. $escaped_id = $this->getXpathEscaper()->escapeLiteral($id); $xpath_expressions = array( 'preceding::label[@for = ' . $escaped_id . ']', 'following::label[@for = ' . $escaped_id . ']', ); $label = $this->getWrappedElement()->find('xpath', '(' . implode(' | ', $xpath_expressions) . ')[1]'); } if ( is_null($label) ) { // Label wrapped around checkbox. $label = $this->getWrappedElement()->find('xpath', 'parent::label'); } if ( is_null($label) ) { // Label right next to checkbox. $label = $this->getWrappedElement()->find('xpath', 'following-sibling::*[1][self::label]'); } return $label; }
[ "public", "function", "getLabel", "(", ")", "{", "$", "label", "=", "null", ";", "$", "id", "=", "$", "this", "->", "getAttribute", "(", "'id'", ")", ";", "if", "(", "!", "is_null", "(", "$", "id", ")", ")", "{", "// Label with matching \"for\" attribu...
Finds label corresponding to current element. @return NodeElement|null Element representing label or null if no label has been found.
[ "Finds", "label", "corresponding", "to", "current", "element", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/LabeledElement.php#L27-L53
39,122
qa-tools/qa-tools
library/QATools/QATools/PageObject/Property.php
Property.getRawDataType
public function getRawDataType() { if ( !isset($this->dataType) ) { /* @var $annotations VarAnnotation[] */ $annotations = $this->annotationManager->getPropertyAnnotations($this, null, '@var'); if ( $annotations && ($annotations[0] instanceof VarAnnotation) ) { $this->dataType = $annotations[0]->type; } else { $this->dataType = ''; } } return $this->dataType; }
php
public function getRawDataType() { if ( !isset($this->dataType) ) { /* @var $annotations VarAnnotation[] */ $annotations = $this->annotationManager->getPropertyAnnotations($this, null, '@var'); if ( $annotations && ($annotations[0] instanceof VarAnnotation) ) { $this->dataType = $annotations[0]->type; } else { $this->dataType = ''; } } return $this->dataType; }
[ "public", "function", "getRawDataType", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "dataType", ")", ")", "{", "/* @var $annotations VarAnnotation[] */", "$", "annotations", "=", "$", "this", "->", "annotationManager", "->", "getPropertyAnnot...
Returns the raw data type. @return string
[ "Returns", "the", "raw", "data", "type", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Property.php#L74-L89
39,123
ikkez/f3-opauth
lib/opauth/Strategy/Twitter/Vendor/tmhOAuth/tmhUtilities.php
tmhUtilities.entify_with_options
public static function entify_with_options($tweet, $options=array(), &$replacements=array()) { $default_opts = array( 'encoding' => 'UTF-8', 'target' => '', ); $opts = array_merge($default_opts, $options); $encoding = mb_internal_encoding(); mb_internal_encoding($opts['encoding']); $keys = array(); $is_retweet = false; if (isset($tweet['retweeted_status'])) { $tweet = $tweet['retweeted_status']; $is_retweet = true; } if (!isset($tweet['entities'])) { return $tweet['text']; } $target = (!empty($opts['target'])) ? ' target="'.$opts['target'].'"' : ''; // prepare the entities foreach ($tweet['entities'] as $type => $things) { foreach ($things as $entity => $value) { $tweet_link = "<a href=\"https://twitter.com/{$tweet['user']['screen_name']}/statuses/{$tweet['id']}\"{$target}>{$tweet['created_at']}</a>"; switch ($type) { case 'hashtags': $href = "<a href=\"https://twitter.com/search?q=%23{$value['text']}\"{$target}>#{$value['text']}</a>"; break; case 'user_mentions': $href = "@<a href=\"https://twitter.com/{$value['screen_name']}\" title=\"{$value['name']}\"{$target}>{$value['screen_name']}</a>"; break; case 'urls': case 'media': $url = empty($value['expanded_url']) ? $value['url'] : $value['expanded_url']; $display = isset($value['display_url']) ? $value['display_url'] : str_replace('http://', '', $url); // Not all pages are served in UTF-8 so you may need to do this ... $display = urldecode(str_replace('%E2%80%A6', '&hellip;', urlencode($display))); $href = "<a href=\"{$value['url']}\"{$target}>{$display}</a>"; break; } $keys[$value['indices']['0']] = mb_substr( $tweet['text'], $value['indices']['0'], $value['indices']['1'] - $value['indices']['0'] ); $replacements[$value['indices']['0']] = $href; } } ksort($replacements); $replacements = array_reverse($replacements, true); $entified_tweet = $tweet['text']; foreach ($replacements as $k => $v) { $entified_tweet = mb_substr($entified_tweet, 0, $k).$v.mb_substr($entified_tweet, $k + strlen($keys[$k])); } $replacements = array( 'replacements' => $replacements, 'keys' => $keys ); mb_internal_encoding($encoding); return $entified_tweet; }
php
public static function entify_with_options($tweet, $options=array(), &$replacements=array()) { $default_opts = array( 'encoding' => 'UTF-8', 'target' => '', ); $opts = array_merge($default_opts, $options); $encoding = mb_internal_encoding(); mb_internal_encoding($opts['encoding']); $keys = array(); $is_retweet = false; if (isset($tweet['retweeted_status'])) { $tweet = $tweet['retweeted_status']; $is_retweet = true; } if (!isset($tweet['entities'])) { return $tweet['text']; } $target = (!empty($opts['target'])) ? ' target="'.$opts['target'].'"' : ''; // prepare the entities foreach ($tweet['entities'] as $type => $things) { foreach ($things as $entity => $value) { $tweet_link = "<a href=\"https://twitter.com/{$tweet['user']['screen_name']}/statuses/{$tweet['id']}\"{$target}>{$tweet['created_at']}</a>"; switch ($type) { case 'hashtags': $href = "<a href=\"https://twitter.com/search?q=%23{$value['text']}\"{$target}>#{$value['text']}</a>"; break; case 'user_mentions': $href = "@<a href=\"https://twitter.com/{$value['screen_name']}\" title=\"{$value['name']}\"{$target}>{$value['screen_name']}</a>"; break; case 'urls': case 'media': $url = empty($value['expanded_url']) ? $value['url'] : $value['expanded_url']; $display = isset($value['display_url']) ? $value['display_url'] : str_replace('http://', '', $url); // Not all pages are served in UTF-8 so you may need to do this ... $display = urldecode(str_replace('%E2%80%A6', '&hellip;', urlencode($display))); $href = "<a href=\"{$value['url']}\"{$target}>{$display}</a>"; break; } $keys[$value['indices']['0']] = mb_substr( $tweet['text'], $value['indices']['0'], $value['indices']['1'] - $value['indices']['0'] ); $replacements[$value['indices']['0']] = $href; } } ksort($replacements); $replacements = array_reverse($replacements, true); $entified_tweet = $tweet['text']; foreach ($replacements as $k => $v) { $entified_tweet = mb_substr($entified_tweet, 0, $k).$v.mb_substr($entified_tweet, $k + strlen($keys[$k])); } $replacements = array( 'replacements' => $replacements, 'keys' => $keys ); mb_internal_encoding($encoding); return $entified_tweet; }
[ "public", "static", "function", "entify_with_options", "(", "$", "tweet", ",", "$", "options", "=", "array", "(", ")", ",", "&", "$", "replacements", "=", "array", "(", ")", ")", "{", "$", "default_opts", "=", "array", "(", "'encoding'", "=>", "'UTF-8'",...
Entifies the tweet using the given entities element, using the provided options. @param array $tweet the json converted to normalised array @param array $options settings to be used when rendering the entities @param array $replacements if specified, the entities and their replacements will be stored to this variable @return the tweet text with entities replaced with hyperlinks
[ "Entifies", "the", "tweet", "using", "the", "given", "entities", "element", "using", "the", "provided", "options", "." ]
2f76ad82507202353de804a6885db8e58ccc6106
https://github.com/ikkez/f3-opauth/blob/2f76ad82507202353de804a6885db8e58ccc6106/lib/opauth/Strategy/Twitter/Vendor/tmhOAuth/tmhUtilities.php#L36-L104
39,124
ikkez/f3-opauth
lib/opauth/Strategy/Twitter/Vendor/tmhOAuth/tmhUtilities.php
tmhUtilities.pr
public static function pr($obj) { if (!self::is_cli()) echo '<pre style="word-wrap: break-word">'; if ( is_object($obj) ) print_r($obj); elseif ( is_array($obj) ) print_r($obj); else echo $obj; if (!self::is_cli()) echo '</pre>'; }
php
public static function pr($obj) { if (!self::is_cli()) echo '<pre style="word-wrap: break-word">'; if ( is_object($obj) ) print_r($obj); elseif ( is_array($obj) ) print_r($obj); else echo $obj; if (!self::is_cli()) echo '</pre>'; }
[ "public", "static", "function", "pr", "(", "$", "obj", ")", "{", "if", "(", "!", "self", "::", "is_cli", "(", ")", ")", "echo", "'<pre style=\"word-wrap: break-word\">'", ";", "if", "(", "is_object", "(", "$", "obj", ")", ")", "print_r", "(", "$", "obj...
Debug function for printing the content of an object @param mixes $obj
[ "Debug", "function", "for", "printing", "the", "content", "of", "an", "object" ]
2f76ad82507202353de804a6885db8e58ccc6106
https://github.com/ikkez/f3-opauth/blob/2f76ad82507202353de804a6885db8e58ccc6106/lib/opauth/Strategy/Twitter/Vendor/tmhOAuth/tmhUtilities.php#L156-L168
39,125
ikkez/f3-opauth
lib/opauth/Strategy/Twitter/Vendor/tmhOAuth/tmhUtilities.php
tmhUtilities.auto_fix_time_request
public static function auto_fix_time_request($tmhOAuth, $method, $url, $params=array(), $useauth=true, $multipart=false) { $tmhOAuth->request($method, $url, $params, $useauth, $multipart); // if we're not doing auth the timestamp isn't important if ( ! $useauth) return; // some error that isn't a 401 if ($tmhOAuth->response['code'] != 401) return; // some error that is a 401 but isn't because the OAuth token and signature are incorrect // TODO: this check is horrid but helps avoid requesting twice when the username and password are wrong if (stripos($tmhOAuth->response['response'], 'password') !== false) return; // force the timestamp to be the same as the Twitter servers, and re-request $tmhOAuth->auto_fixed_time = true; $tmhOAuth->config['force_timestamp'] = true; $tmhOAuth->config['timestamp'] = strtotime($tmhOAuth->response['headers']['date']); return $tmhOAuth->request($method, $url, $params, $useauth, $multipart); }
php
public static function auto_fix_time_request($tmhOAuth, $method, $url, $params=array(), $useauth=true, $multipart=false) { $tmhOAuth->request($method, $url, $params, $useauth, $multipart); // if we're not doing auth the timestamp isn't important if ( ! $useauth) return; // some error that isn't a 401 if ($tmhOAuth->response['code'] != 401) return; // some error that is a 401 but isn't because the OAuth token and signature are incorrect // TODO: this check is horrid but helps avoid requesting twice when the username and password are wrong if (stripos($tmhOAuth->response['response'], 'password') !== false) return; // force the timestamp to be the same as the Twitter servers, and re-request $tmhOAuth->auto_fixed_time = true; $tmhOAuth->config['force_timestamp'] = true; $tmhOAuth->config['timestamp'] = strtotime($tmhOAuth->response['headers']['date']); return $tmhOAuth->request($method, $url, $params, $useauth, $multipart); }
[ "public", "static", "function", "auto_fix_time_request", "(", "$", "tmhOAuth", ",", "$", "method", ",", "$", "url", ",", "$", "params", "=", "array", "(", ")", ",", "$", "useauth", "=", "true", ",", "$", "multipart", "=", "false", ")", "{", "$", "tmh...
Make an HTTP request using this library. This method is different to 'request' because on a 401 error it will retry the request. When a 401 error is returned it is possible the timestamp of the client is too different to that of the API server. In this situation it is recommended the request is retried with the OAuth timestamp set to the same as the API server. This method will automatically try that technique. This method doesn't return anything. Instead the response should be inspected directly. @param string $method the HTTP method being used. e.g. POST, GET, HEAD etc @param string $url the request URL without query string parameters @param array $params the request parameters as an array of key=value pairs @param string $useauth whether to use authentication when making the request. Default true. @param string $multipart whether this request contains multipart data. Default false
[ "Make", "an", "HTTP", "request", "using", "this", "library", ".", "This", "method", "is", "different", "to", "request", "because", "on", "a", "401", "error", "it", "will", "retry", "the", "request", "." ]
2f76ad82507202353de804a6885db8e58ccc6106
https://github.com/ikkez/f3-opauth/blob/2f76ad82507202353de804a6885db8e58ccc6106/lib/opauth/Strategy/Twitter/Vendor/tmhOAuth/tmhUtilities.php#L188-L209
39,126
ikkez/f3-opauth
lib/opauth/Strategy/Twitter/Vendor/tmhOAuth/tmhUtilities.php
tmhUtilities.read_input
public static function read_input($prompt) { echo $prompt; $handle = fopen("php://stdin","r"); $data = fgets($handle); return trim($data); }
php
public static function read_input($prompt) { echo $prompt; $handle = fopen("php://stdin","r"); $data = fgets($handle); return trim($data); }
[ "public", "static", "function", "read_input", "(", "$", "prompt", ")", "{", "echo", "$", "prompt", ";", "$", "handle", "=", "fopen", "(", "\"php://stdin\"", ",", "\"r\"", ")", ";", "$", "data", "=", "fgets", "(", "$", "handle", ")", ";", "return", "t...
Asks the user for input and returns the line they enter @param string $prompt the text to display to the user @return the text entered by the user
[ "Asks", "the", "user", "for", "input", "and", "returns", "the", "line", "they", "enter" ]
2f76ad82507202353de804a6885db8e58ccc6106
https://github.com/ikkez/f3-opauth/blob/2f76ad82507202353de804a6885db8e58ccc6106/lib/opauth/Strategy/Twitter/Vendor/tmhOAuth/tmhUtilities.php#L217-L222
39,127
ikkez/f3-opauth
lib/opauth/Strategy/Twitter/Vendor/tmhOAuth/tmhUtilities.php
tmhUtilities.endswith
public static function endswith($haystack, $needle) { $haylen = strlen($haystack); $needlelen = strlen($needle); if ($needlelen > $haylen) return false; return substr_compare($haystack, $needle, -$needlelen) === 0; }
php
public static function endswith($haystack, $needle) { $haylen = strlen($haystack); $needlelen = strlen($needle); if ($needlelen > $haylen) return false; return substr_compare($haystack, $needle, -$needlelen) === 0; }
[ "public", "static", "function", "endswith", "(", "$", "haystack", ",", "$", "needle", ")", "{", "$", "haylen", "=", "strlen", "(", "$", "haystack", ")", ";", "$", "needlelen", "=", "strlen", "(", "$", "needle", ")", ";", "if", "(", "$", "needlelen", ...
Check if one string ends with another @param string $haystack the string to check inside of @param string $needle the string to check $haystack ends with @return true if $haystack ends with $needle, false otherwise
[ "Check", "if", "one", "string", "ends", "with", "another" ]
2f76ad82507202353de804a6885db8e58ccc6106
https://github.com/ikkez/f3-opauth/blob/2f76ad82507202353de804a6885db8e58ccc6106/lib/opauth/Strategy/Twitter/Vendor/tmhOAuth/tmhUtilities.php#L272-L279
39,128
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/FileInput.php
FileInput.setFileToUpload
public function setFileToUpload($filename) { if ( !file_exists($filename) ) { throw new FileInputException( 'File "' . $filename . '" doesn\'t exist', FileInputException::TYPE_FILE_NOT_FOUND ); } $this->getWrappedElement()->attachFile($filename); return $this; }
php
public function setFileToUpload($filename) { if ( !file_exists($filename) ) { throw new FileInputException( 'File "' . $filename . '" doesn\'t exist', FileInputException::TYPE_FILE_NOT_FOUND ); } $this->getWrappedElement()->attachFile($filename); return $this; }
[ "public", "function", "setFileToUpload", "(", "$", "filename", ")", "{", "if", "(", "!", "file_exists", "(", "$", "filename", ")", ")", "{", "throw", "new", "FileInputException", "(", "'File \"'", ".", "$", "filename", ".", "'\" doesn\\'t exist'", ",", "File...
Sets a file to be uploaded. @param string $filename Filename. @return self @throws FileInputException When file could not be found on disk.
[ "Sets", "a", "file", "to", "be", "uploaded", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/FileInput.php#L49-L61
39,129
qa-tools/qa-tools
library/QATools/QATools/BEM/Element/Block.php
Block.findAll
public function findAll($selector, $locator) { $items = array(); foreach ( $this->_nodes as $node ) { $items = array_merge($items, $node->findAll($selector, $locator)); } return $items; }
php
public function findAll($selector, $locator) { $items = array(); foreach ( $this->_nodes as $node ) { $items = array_merge($items, $node->findAll($selector, $locator)); } return $items; }
[ "public", "function", "findAll", "(", "$", "selector", ",", "$", "locator", ")", "{", "$", "items", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "_nodes", "as", "$", "node", ")", "{", "$", "items", "=", "array_merge", "(", "$", ...
Finds all elements with specified selector. @param string $selector Selector engine name. @param string|array $locator Selector locator. @return NodeElement[]
[ "Finds", "all", "elements", "with", "specified", "selector", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/BEM/Element/Block.php#L128-L137
39,130
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/AbstractTypifiedElement.php
AbstractTypifiedElement.assertWrappedElement
protected function assertWrappedElement() { if ( !$this->acceptanceCriteria ) { return; } foreach ( $this->acceptanceCriteria as $criterion ) { if ( !$this->isTagNameMatching($criterion) ) { continue; } if ( $this->isAttributeMatching($criterion) ) { return; } } $message = 'Wrapped element "%s" does not match "%s" criteria'; throw new TypifiedElementException( sprintf($message, $this->getWrappedElement(), get_class($this)), TypifiedElementException::TYPE_INCORRECT_WRAPPED_ELEMENT ); }
php
protected function assertWrappedElement() { if ( !$this->acceptanceCriteria ) { return; } foreach ( $this->acceptanceCriteria as $criterion ) { if ( !$this->isTagNameMatching($criterion) ) { continue; } if ( $this->isAttributeMatching($criterion) ) { return; } } $message = 'Wrapped element "%s" does not match "%s" criteria'; throw new TypifiedElementException( sprintf($message, $this->getWrappedElement(), get_class($this)), TypifiedElementException::TYPE_INCORRECT_WRAPPED_ELEMENT ); }
[ "protected", "function", "assertWrappedElement", "(", ")", "{", "if", "(", "!", "$", "this", "->", "acceptanceCriteria", ")", "{", "return", ";", "}", "foreach", "(", "$", "this", "->", "acceptanceCriteria", "as", "$", "criterion", ")", "{", "if", "(", "...
Checks that wrapped element meets the acceptance criteria. @return void @throws TypifiedElementException When no criteria matches.
[ "Checks", "that", "wrapped", "element", "meets", "the", "acceptance", "criteria", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/AbstractTypifiedElement.php#L97-L119
39,131
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/AbstractTypifiedElement.php
AbstractTypifiedElement.isAttributeMatching
protected function isAttributeMatching(array $criterion) { if ( !isset($criterion[self::CRITERION_ATTRS]) ) { return true; } foreach ( $criterion[self::CRITERION_ATTRS] as $attribute => $definition ) { if ( $this->isValueMatchingCriterionDefinition($this->getAttribute($attribute), $definition) ) { return true; } } return false; }
php
protected function isAttributeMatching(array $criterion) { if ( !isset($criterion[self::CRITERION_ATTRS]) ) { return true; } foreach ( $criterion[self::CRITERION_ATTRS] as $attribute => $definition ) { if ( $this->isValueMatchingCriterionDefinition($this->getAttribute($attribute), $definition) ) { return true; } } return false; }
[ "protected", "function", "isAttributeMatching", "(", "array", "$", "criterion", ")", "{", "if", "(", "!", "isset", "(", "$", "criterion", "[", "self", "::", "CRITERION_ATTRS", "]", ")", ")", "{", "return", "true", ";", "}", "foreach", "(", "$", "criterio...
Checks if the attributes of the criterion are matching. @param array $criterion The criterion. @return boolean
[ "Checks", "if", "the", "attributes", "of", "the", "criterion", "are", "matching", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/AbstractTypifiedElement.php#L144-L157
39,132
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageFactory.php
PageFactory._createContainer
private function _createContainer(Config $config = null) { $container = new Container(); if ( isset($config) ) { $container['config'] = $config; } return $container; }
php
private function _createContainer(Config $config = null) { $container = new Container(); if ( isset($config) ) { $container['config'] = $config; } return $container; }
[ "private", "function", "_createContainer", "(", "Config", "$", "config", "=", "null", ")", "{", "$", "container", "=", "new", "Container", "(", ")", ";", "if", "(", "isset", "(", "$", "config", ")", ")", "{", "$", "container", "[", "'config'", "]", "...
Creates container_or_config object. @param Config|null $config Config. @return Container
[ "Creates", "container_or_config", "object", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageFactory.php#L138-L147
39,133
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageFactory.php
PageFactory._setAnnotationManager
private function _setAnnotationManager(AnnotationManager $manager) { foreach ( $this->annotationRegistry as $annotation_name => $annotation_class ) { $manager->registry[$annotation_name] = $annotation_class; } $this->annotationManager = $manager; return $this; }
php
private function _setAnnotationManager(AnnotationManager $manager) { foreach ( $this->annotationRegistry as $annotation_name => $annotation_class ) { $manager->registry[$annotation_name] = $annotation_class; } $this->annotationManager = $manager; return $this; }
[ "private", "function", "_setAnnotationManager", "(", "AnnotationManager", "$", "manager", ")", "{", "foreach", "(", "$", "this", "->", "annotationRegistry", "as", "$", "annotation_name", "=>", "$", "annotation_class", ")", "{", "$", "manager", "->", "registry", ...
Sets annotation manager. @param AnnotationManager $manager Annotation manager. @return self
[ "Sets", "annotation", "manager", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageFactory.php#L156-L165
39,134
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageFactory.php
PageFactory._setSession
private function _setSession(Session $session) { $selectors_handler = $session->getSelectorsHandler(); if ( !$selectors_handler->isSelectorRegistered('se') ) { $selectors_handler->registerSelector('se', new SeleniumSelector()); } $this->_session = $session; return $this; }
php
private function _setSession(Session $session) { $selectors_handler = $session->getSelectorsHandler(); if ( !$selectors_handler->isSelectorRegistered('se') ) { $selectors_handler->registerSelector('se', new SeleniumSelector()); } $this->_session = $session; return $this; }
[ "private", "function", "_setSession", "(", "Session", "$", "session", ")", "{", "$", "selectors_handler", "=", "$", "session", "->", "getSelectorsHandler", "(", ")", ";", "if", "(", "!", "$", "selectors_handler", "->", "isSelectorRegistered", "(", "'se'", ")",...
Sets session. @param Session $session Session. @return self
[ "Sets", "session", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageFactory.php#L188-L199
39,135
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageFactory.php
PageFactory.initPage
public function initPage(Page $page) { /* @var $annotations PageUrlAnnotation[] */ $annotations = $this->annotationManager->getClassAnnotations($page, '@page-url'); if ( !$annotations || !($annotations[0] instanceof PageUrlAnnotation) ) { return $this; } $page->setUrlBuilder( $this->urlFactory->getBuilder( $this->urlNormalizer->normalize($annotations[0]) ) ); return $this; }
php
public function initPage(Page $page) { /* @var $annotations PageUrlAnnotation[] */ $annotations = $this->annotationManager->getClassAnnotations($page, '@page-url'); if ( !$annotations || !($annotations[0] instanceof PageUrlAnnotation) ) { return $this; } $page->setUrlBuilder( $this->urlFactory->getBuilder( $this->urlNormalizer->normalize($annotations[0]) ) ); return $this; }
[ "public", "function", "initPage", "(", "Page", "$", "page", ")", "{", "/* @var $annotations PageUrlAnnotation[] */", "$", "annotations", "=", "$", "this", "->", "annotationManager", "->", "getClassAnnotations", "(", "$", "page", ",", "'@page-url'", ")", ";", "if",...
Initializes the page. @param Page $page Page to initialize. @return self
[ "Initializes", "the", "page", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageFactory.php#L218-L234
39,136
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageFactory.php
PageFactory.opened
public function opened(Page $page) { return $this->pageUrlMatcherRegistry->match($this->_session->getCurrentUrl(), $page); }
php
public function opened(Page $page) { return $this->pageUrlMatcherRegistry->match($this->_session->getCurrentUrl(), $page); }
[ "public", "function", "opened", "(", "Page", "$", "page", ")", "{", "return", "$", "this", "->", "pageUrlMatcherRegistry", "->", "match", "(", "$", "this", "->", "_session", "->", "getCurrentUrl", "(", ")", ",", "$", "page", ")", ";", "}" ]
Checks if the given page is currently opened in browser. @param Page $page Page to check. @return boolean
[ "Checks", "if", "the", "given", "page", "is", "currently", "opened", "in", "browser", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageFactory.php#L243-L246
39,137
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageFactory.php
PageFactory.proxyFields
protected function proxyFields(ISearchContext $search_context, IPropertyDecorator $property_decorator) { foreach ( $this->getProperties($search_context) as $property ) { $proxy = $property_decorator->decorate($property); if ( $proxy !== null ) { $property->setAccessible(true); $property->setValue($search_context, $proxy); } } return $this; }
php
protected function proxyFields(ISearchContext $search_context, IPropertyDecorator $property_decorator) { foreach ( $this->getProperties($search_context) as $property ) { $proxy = $property_decorator->decorate($property); if ( $proxy !== null ) { $property->setAccessible(true); $property->setValue($search_context, $proxy); } } return $this; }
[ "protected", "function", "proxyFields", "(", "ISearchContext", "$", "search_context", ",", "IPropertyDecorator", "$", "property_decorator", ")", "{", "foreach", "(", "$", "this", "->", "getProperties", "(", "$", "search_context", ")", "as", "$", "property", ")", ...
Initializes fields within given search context. @param ISearchContext $search_context Search context. @param IPropertyDecorator $property_decorator Property decorator. @return self
[ "Initializes", "fields", "within", "given", "search", "context", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageFactory.php#L281-L293
39,138
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageFactory.php
PageFactory.getProperties
protected function getProperties(ISearchContext $search_context) { $ret = array(); $reflection = new \ReflectionClass($search_context); foreach ( $reflection->getProperties() as $property ) { $ret[] = new Property($property, $this->annotationManager); } return $ret; }
php
protected function getProperties(ISearchContext $search_context) { $ret = array(); $reflection = new \ReflectionClass($search_context); foreach ( $reflection->getProperties() as $property ) { $ret[] = new Property($property, $this->annotationManager); } return $ret; }
[ "protected", "function", "getProperties", "(", "ISearchContext", "$", "search_context", ")", "{", "$", "ret", "=", "array", "(", ")", ";", "$", "reflection", "=", "new", "\\", "ReflectionClass", "(", "$", "search_context", ")", ";", "foreach", "(", "$", "r...
Returns class properties, that can potentially become proxies. @param ISearchContext $search_context Search context. @return Property[]
[ "Returns", "class", "properties", "that", "can", "potentially", "become", "proxies", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageFactory.php#L302-L312
39,139
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Form.php
Form.fill
public function fill(array $form_data) { foreach ( $form_data as $field_name => $field_value ) { $form_element = $this->typify($this->getNodeElements($field_name)); $this->setValue($form_element, $field_value); } return $this; }
php
public function fill(array $form_data) { foreach ( $form_data as $field_name => $field_value ) { $form_element = $this->typify($this->getNodeElements($field_name)); $this->setValue($form_element, $field_value); } return $this; }
[ "public", "function", "fill", "(", "array", "$", "form_data", ")", "{", "foreach", "(", "$", "form_data", "as", "$", "field_name", "=>", "$", "field_value", ")", "{", "$", "form_element", "=", "$", "this", "->", "typify", "(", "$", "this", "->", "getNo...
Fills the form with given data. @param array $form_data Associative array with keys matching field names. @return self
[ "Fills", "the", "form", "with", "given", "data", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Form.php#L41-L50
39,140
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Form.php
Form.getNodeElements
public function getNodeElements($field_name) { $node_elements = $this->findAll( 'named', array('field', $this->getXpathEscaper()->escapeLiteral($field_name)) ); if ( empty($node_elements) ) { throw new FormException( sprintf('Form field "%s" not found', $field_name), FormException::TYPE_NOT_FOUND ); } return $node_elements; }
php
public function getNodeElements($field_name) { $node_elements = $this->findAll( 'named', array('field', $this->getXpathEscaper()->escapeLiteral($field_name)) ); if ( empty($node_elements) ) { throw new FormException( sprintf('Form field "%s" not found', $field_name), FormException::TYPE_NOT_FOUND ); } return $node_elements; }
[ "public", "function", "getNodeElements", "(", "$", "field_name", ")", "{", "$", "node_elements", "=", "$", "this", "->", "findAll", "(", "'named'", ",", "array", "(", "'field'", ",", "$", "this", "->", "getXpathEscaper", "(", ")", "->", "escapeLiteral", "(...
Finds NodeElements by a given field name. @param string $field_name Field name to search for. @return NodeElement[] @throws FormException When element for a field name not found.
[ "Finds", "NodeElements", "by", "a", "given", "field", "name", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Form.php#L60-L75
39,141
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Form.php
Form.typify
public function typify(array $node_elements) { $node_element = $node_elements[0]; $tag_name = $node_element->getTagName(); if ( $tag_name == 'input' ) { $input_type = $node_element->getAttribute('type'); if ( $input_type == self::CHECKBOX_INPUT ) { return Checkbox::fromNodeElement($node_element, $this->getPageFactory()); } elseif ( $input_type == self::RADIO_INPUT ) { return RadioGroup::fromNodeElements($node_elements, null, $this->getPageFactory()); } elseif ( $input_type == self::FILE_INPUT ) { return FileInput::fromNodeElement($node_element, $this->getPageFactory()); } else { /*if ( is_null($input_type) || ($input_type == self::TEXT_INPUT) || ($input_type == self::PASSWORD_INPUT) ) {*/ return TextInput::fromNodeElement($node_element, $this->getPageFactory()); } } elseif ( $tag_name == 'select' ) { return Select::fromNodeElement($node_element, $this->getPageFactory()); } elseif ( $tag_name == 'textarea' ) { return TextInput::fromNodeElement($node_element, $this->getPageFactory()); } $web_element = WebElement::fromNodeElement($node_element, $this->getPageFactory()); throw new FormException( 'Unable create typified element for ' . (string)$web_element, FormException::TYPE_UNKNOWN_FIELD ); }
php
public function typify(array $node_elements) { $node_element = $node_elements[0]; $tag_name = $node_element->getTagName(); if ( $tag_name == 'input' ) { $input_type = $node_element->getAttribute('type'); if ( $input_type == self::CHECKBOX_INPUT ) { return Checkbox::fromNodeElement($node_element, $this->getPageFactory()); } elseif ( $input_type == self::RADIO_INPUT ) { return RadioGroup::fromNodeElements($node_elements, null, $this->getPageFactory()); } elseif ( $input_type == self::FILE_INPUT ) { return FileInput::fromNodeElement($node_element, $this->getPageFactory()); } else { /*if ( is_null($input_type) || ($input_type == self::TEXT_INPUT) || ($input_type == self::PASSWORD_INPUT) ) {*/ return TextInput::fromNodeElement($node_element, $this->getPageFactory()); } } elseif ( $tag_name == 'select' ) { return Select::fromNodeElement($node_element, $this->getPageFactory()); } elseif ( $tag_name == 'textarea' ) { return TextInput::fromNodeElement($node_element, $this->getPageFactory()); } $web_element = WebElement::fromNodeElement($node_element, $this->getPageFactory()); throw new FormException( 'Unable create typified element for ' . (string)$web_element, FormException::TYPE_UNKNOWN_FIELD ); }
[ "public", "function", "typify", "(", "array", "$", "node_elements", ")", "{", "$", "node_element", "=", "$", "node_elements", "[", "0", "]", ";", "$", "tag_name", "=", "$", "node_element", "->", "getTagName", "(", ")", ";", "if", "(", "$", "tag_name", ...
Create AbstractTypifiedElement from a given NodeElements. @param array|NodeElement[] $node_elements Node Elements. @return ITypifiedElement @throws FormException When unable to create typified element.
[ "Create", "AbstractTypifiedElement", "from", "a", "given", "NodeElements", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Form.php#L85-L122
39,142
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Form.php
Form.setValue
public function setValue(ITypifiedElement $typified_element, $value) { if ( $typified_element instanceof ISimpleSetter ) { $typified_element->setValue($value); return $this; } throw new FormException( 'Element ' . (string)$typified_element . ' doesn\'t support value changing', FormException::TYPE_READONLY_FIELD ); }
php
public function setValue(ITypifiedElement $typified_element, $value) { if ( $typified_element instanceof ISimpleSetter ) { $typified_element->setValue($value); return $this; } throw new FormException( 'Element ' . (string)$typified_element . ' doesn\'t support value changing', FormException::TYPE_READONLY_FIELD ); }
[ "public", "function", "setValue", "(", "ITypifiedElement", "$", "typified_element", ",", "$", "value", ")", "{", "if", "(", "$", "typified_element", "instanceof", "ISimpleSetter", ")", "{", "$", "typified_element", "->", "setValue", "(", "$", "value", ")", ";"...
Sets value to the form element. @param ITypifiedElement $typified_element Element, to set a value for. @param mixed $value Element value to set. @return self @throws FormException When element doesn't support value changing.
[ "Sets", "value", "to", "the", "form", "element", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Form.php#L133-L145
39,143
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/RadioGroup.php
RadioGroup.getSelectedButton
public function getSelectedButton() { /** @var $button RadioButton */ foreach ( $this as $button ) { if ( $button->isSelected() ) { return $button; } } throw new RadioGroupException('No selected button', RadioGroupException::TYPE_NOT_SELECTED); }
php
public function getSelectedButton() { /** @var $button RadioButton */ foreach ( $this as $button ) { if ( $button->isSelected() ) { return $button; } } throw new RadioGroupException('No selected button', RadioGroupException::TYPE_NOT_SELECTED); }
[ "public", "function", "getSelectedButton", "(", ")", "{", "/** @var $button RadioButton */", "foreach", "(", "$", "this", "as", "$", "button", ")", "{", "if", "(", "$", "button", "->", "isSelected", "(", ")", ")", "{", "return", "$", "button", ";", "}", ...
Returns selected radio button. @return RadioButton Element, that represents selected radio button or {@code null} if no radio buttons are selected. @throws RadioGroupException When no radio button is selected.
[ "Returns", "selected", "radio", "button", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/RadioGroup.php#L71-L81
39,144
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/RadioGroup.php
RadioGroup.selectButtonByLabelText
public function selectButtonByLabelText($text) { /** @var $button RadioButton */ foreach ( $this as $button ) { if ( strpos($button->getLabelText(), $text) !== false ) { $button->select(); return $this; } } throw new RadioGroupException( 'Cannot locate radio button with label text containing: ' . $text, RadioGroupException::TYPE_NOT_FOUND ); }
php
public function selectButtonByLabelText($text) { /** @var $button RadioButton */ foreach ( $this as $button ) { if ( strpos($button->getLabelText(), $text) !== false ) { $button->select(); return $this; } } throw new RadioGroupException( 'Cannot locate radio button with label text containing: ' . $text, RadioGroupException::TYPE_NOT_FOUND ); }
[ "public", "function", "selectButtonByLabelText", "(", "$", "text", ")", "{", "/** @var $button RadioButton */", "foreach", "(", "$", "this", "as", "$", "button", ")", "{", "if", "(", "strpos", "(", "$", "button", "->", "getLabelText", "(", ")", ",", "$", "...
Selects radio button, that contains given text. @param string $text Text. @return self @throws RadioGroupException When radio button with given label text wasn't found.
[ "Selects", "radio", "button", "that", "contains", "given", "text", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/RadioGroup.php#L91-L106
39,145
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/RadioGroup.php
RadioGroup.selectButtonByValue
public function selectButtonByValue($value) { /** @var $button RadioButton */ foreach ( $this as $button ) { if ( (string)$button->getValue() === (string)$value ) { $button->select(); return $this; } } throw new RadioGroupException( 'Cannot locate radio button with value: ' . $value, RadioGroupException::TYPE_NOT_FOUND ); }
php
public function selectButtonByValue($value) { /** @var $button RadioButton */ foreach ( $this as $button ) { if ( (string)$button->getValue() === (string)$value ) { $button->select(); return $this; } } throw new RadioGroupException( 'Cannot locate radio button with value: ' . $value, RadioGroupException::TYPE_NOT_FOUND ); }
[ "public", "function", "selectButtonByValue", "(", "$", "value", ")", "{", "/** @var $button RadioButton */", "foreach", "(", "$", "this", "as", "$", "button", ")", "{", "if", "(", "(", "string", ")", "$", "button", "->", "getValue", "(", ")", "===", "(", ...
Selects radio button that have a value matching the specified argument. @param string $value The value to match against. @return self @throws RadioGroupException When radio button with given value wasn't found.
[ "Selects", "radio", "button", "that", "have", "a", "value", "matching", "the", "specified", "argument", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/RadioGroup.php#L116-L131
39,146
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/RadioGroup.php
RadioGroup.selectButtonByIndex
public function selectButtonByIndex($index) { if ( isset($this[$index]) ) { /** @var RadioButton $button */ $button = $this[$index]; $button->select(); return $this; } throw new RadioGroupException( 'Cannot locate radio button with index: ' . $index, RadioGroupException::TYPE_NOT_FOUND ); }
php
public function selectButtonByIndex($index) { if ( isset($this[$index]) ) { /** @var RadioButton $button */ $button = $this[$index]; $button->select(); return $this; } throw new RadioGroupException( 'Cannot locate radio button with index: ' . $index, RadioGroupException::TYPE_NOT_FOUND ); }
[ "public", "function", "selectButtonByIndex", "(", "$", "index", ")", "{", "if", "(", "isset", "(", "$", "this", "[", "$", "index", "]", ")", ")", "{", "/** @var RadioButton $button */", "$", "button", "=", "$", "this", "[", "$", "index", "]", ";", "$",...
Selects radio button by the given index. @param integer $index Index of a radio button to be selected. @return self @throws RadioGroupException When non-existing index was given.
[ "Selects", "radio", "button", "by", "the", "given", "index", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/RadioGroup.php#L141-L155
39,147
qa-tools/qa-tools
library/QATools/QATools/PageObject/Page.php
Page.getAbsoluteUrl
public function getAbsoluteUrl(array $params = array()) { if ( !is_object($this->urlBuilder) ) { throw new PageException( 'The url builder of a page not set, have you used @page-url annotation?', PageException::TYPE_MISSING_URL_BUILDER ); } return $this->urlBuilder->build($params); }
php
public function getAbsoluteUrl(array $params = array()) { if ( !is_object($this->urlBuilder) ) { throw new PageException( 'The url builder of a page not set, have you used @page-url annotation?', PageException::TYPE_MISSING_URL_BUILDER ); } return $this->urlBuilder->build($params); }
[ "public", "function", "getAbsoluteUrl", "(", "array", "$", "params", "=", "array", "(", ")", ")", "{", "if", "(", "!", "is_object", "(", "$", "this", "->", "urlBuilder", ")", ")", "{", "throw", "new", "PageException", "(", "'The url builder of a page not set...
Returns full url to the page with a possibility to alter it real time. @param array $params Page parameters. @return string @throws PageException When url builder is missing.
[ "Returns", "full", "url", "to", "the", "page", "with", "a", "possibility", "to", "alter", "it", "real", "time", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Page.php#L62-L72
39,148
qa-tools/qa-tools
library/QATools/QATools/PageObject/Page.php
Page.open
public function open(array $params = array()) { $url = $this->getAbsoluteUrl($params); if ( !$url ) { throw new PageException('Page url not specified', PageException::TYPE_EMPTY_URL); } $this->pageFactory->getSession()->visit($url); return $this; }
php
public function open(array $params = array()) { $url = $this->getAbsoluteUrl($params); if ( !$url ) { throw new PageException('Page url not specified', PageException::TYPE_EMPTY_URL); } $this->pageFactory->getSession()->visit($url); return $this; }
[ "public", "function", "open", "(", "array", "$", "params", "=", "array", "(", ")", ")", "{", "$", "url", "=", "$", "this", "->", "getAbsoluteUrl", "(", "$", "params", ")", ";", "if", "(", "!", "$", "url", ")", "{", "throw", "new", "PageException", ...
Opens this page in browser. @param array $params Page parameters. @return self @throws PageException When page url not specified.
[ "Opens", "this", "page", "in", "browser", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Page.php#L82-L93
39,149
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageUrlMatcher/PageUrlMatcherRegistry.php
PageUrlMatcherRegistry.add
public function add(IPageUrlMatcher $page_url_matcher) { $priority = (string)$page_url_matcher->getPriority(); if ( isset($this->matchers[$priority]) ) { throw new PageUrlMatcherException( 'The page url matcher with "' . $priority . '" priority is already registered.', PageUrlMatcherException::TYPE_DUPLICATE_PRIORITY ); } $this->matchers[$priority] = $page_url_matcher; $this->annotationManager ->registry[$page_url_matcher->getAnnotationName()] = $page_url_matcher->getAnnotationClass(); krsort($this->matchers, SORT_NUMERIC); return $this; }
php
public function add(IPageUrlMatcher $page_url_matcher) { $priority = (string)$page_url_matcher->getPriority(); if ( isset($this->matchers[$priority]) ) { throw new PageUrlMatcherException( 'The page url matcher with "' . $priority . '" priority is already registered.', PageUrlMatcherException::TYPE_DUPLICATE_PRIORITY ); } $this->matchers[$priority] = $page_url_matcher; $this->annotationManager ->registry[$page_url_matcher->getAnnotationName()] = $page_url_matcher->getAnnotationClass(); krsort($this->matchers, SORT_NUMERIC); return $this; }
[ "public", "function", "add", "(", "IPageUrlMatcher", "$", "page_url_matcher", ")", "{", "$", "priority", "=", "(", "string", ")", "$", "page_url_matcher", "->", "getPriority", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "matchers", "[", "$...
Adds a page url matcher instance. @param IPageUrlMatcher $page_url_matcher Page url matcher. @return self @throws PageUrlMatcherException When page url matcher with same priority is already registered.
[ "Adds", "a", "page", "url", "matcher", "instance", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageUrlMatcher/PageUrlMatcherRegistry.php#L59-L77
39,150
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageUrlMatcher/PageUrlMatcherRegistry.php
PageUrlMatcherRegistry.match
public function match($url, Page $page) { foreach ( $this->matchers as $page_url_matcher ) { $annotation_name = '@' . $page_url_matcher->getAnnotationName(); $annotations = $this->annotationManager->getClassAnnotations($page, $annotation_name); if ( !$annotations ) { continue; } $this->ensureAnnotationsAreValid($annotations, $annotation_name); if ( $page_url_matcher->matches($url, $annotations) ) { return true; } } return false; }
php
public function match($url, Page $page) { foreach ( $this->matchers as $page_url_matcher ) { $annotation_name = '@' . $page_url_matcher->getAnnotationName(); $annotations = $this->annotationManager->getClassAnnotations($page, $annotation_name); if ( !$annotations ) { continue; } $this->ensureAnnotationsAreValid($annotations, $annotation_name); if ( $page_url_matcher->matches($url, $annotations) ) { return true; } } return false; }
[ "public", "function", "match", "(", "$", "url", ",", "Page", "$", "page", ")", "{", "foreach", "(", "$", "this", "->", "matchers", "as", "$", "page_url_matcher", ")", "{", "$", "annotation_name", "=", "'@'", ".", "$", "page_url_matcher", "->", "getAnnota...
Matches the url against the given page. @param string $url The URL. @param Page $page Page to match. @return boolean
[ "Matches", "the", "url", "against", "the", "given", "page", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageUrlMatcher/PageUrlMatcherRegistry.php#L87-L105
39,151
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageUrlMatcher/PageUrlMatcherRegistry.php
PageUrlMatcherRegistry.ensureAnnotationsAreValid
protected function ensureAnnotationsAreValid(array $annotations, $annotation_name) { foreach ( $annotations as $annotation ) { if ( !$annotation->isValid() ) { throw new PageUrlMatcherException( 'The "' . $annotation_name . '" annotation is not valid.', PageUrlMatcherException::TYPE_INVALID_ANNOTATION ); } } }
php
protected function ensureAnnotationsAreValid(array $annotations, $annotation_name) { foreach ( $annotations as $annotation ) { if ( !$annotation->isValid() ) { throw new PageUrlMatcherException( 'The "' . $annotation_name . '" annotation is not valid.', PageUrlMatcherException::TYPE_INVALID_ANNOTATION ); } } }
[ "protected", "function", "ensureAnnotationsAreValid", "(", "array", "$", "annotations", ",", "$", "annotation_name", ")", "{", "foreach", "(", "$", "annotations", "as", "$", "annotation", ")", "{", "if", "(", "!", "$", "annotation", "->", "isValid", "(", ")"...
Checks that all annotations are valid. @param IMatchUrlAnnotation[] $annotations Annotations. @param string $annotation_name Annotation name. @return void @throws PageUrlMatcherException When annotations are not valid.
[ "Checks", "that", "all", "annotations", "are", "valid", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageUrlMatcher/PageUrlMatcherRegistry.php#L116-L126
39,152
ikkez/f3-opauth
lib/opauth/Strategy/Twitter/TwitterStrategy.php
TwitterStrategy.oauth_callback
public function oauth_callback() { if (!session_id()) { session_start(); } $session = $_SESSION['_opauth_twitter']; unset($_SESSION['_opauth_twitter']); if (!empty($_REQUEST['oauth_token']) && $_REQUEST['oauth_token'] == $session['oauth_token']) { $this->tmhOAuth->config['user_token'] = $session['oauth_token']; $this->tmhOAuth->config['user_secret'] = $session['oauth_token_secret']; $params = array( 'oauth_verifier' => $_REQUEST['oauth_verifier'] ); $results = $this->_request('POST', $this->strategy['access_token_url'], $params); if ($results !== false && !empty($results['oauth_token']) && !empty($results['oauth_token_secret'])) { $credentials = $this->_verify_credentials($results['oauth_token'], $results['oauth_token_secret']); if (!empty($credentials['id'])) { $this->auth = array( 'uid' => $credentials['id'], 'info' => array( 'name' => $credentials['name'], 'nickname' => $credentials['screen_name'], 'urls' => array( 'twitter' => str_replace('{screen_name}', $credentials['screen_name'], $this->strategy['twitter_profile_url']) ) ), 'credentials' => array( 'token' => $results['oauth_token'], 'secret' => $results['oauth_token_secret'] ), 'raw' => $credentials ); $this->mapProfile($credentials, 'location', 'info.location'); $this->mapProfile($credentials, 'description', 'info.description'); $this->mapProfile($credentials, 'profile_image_url_https', 'info.image'); $this->mapProfile($credentials, 'url', 'info.urls.website'); $this->mapProfile($credentials, 'email', 'info.email'); $this->callback(); } } } else { $error = array( 'code' => 'access_denied', 'message' => 'User denied access.', 'raw' => $_GET ); $this->errorCallback($error); } }
php
public function oauth_callback() { if (!session_id()) { session_start(); } $session = $_SESSION['_opauth_twitter']; unset($_SESSION['_opauth_twitter']); if (!empty($_REQUEST['oauth_token']) && $_REQUEST['oauth_token'] == $session['oauth_token']) { $this->tmhOAuth->config['user_token'] = $session['oauth_token']; $this->tmhOAuth->config['user_secret'] = $session['oauth_token_secret']; $params = array( 'oauth_verifier' => $_REQUEST['oauth_verifier'] ); $results = $this->_request('POST', $this->strategy['access_token_url'], $params); if ($results !== false && !empty($results['oauth_token']) && !empty($results['oauth_token_secret'])) { $credentials = $this->_verify_credentials($results['oauth_token'], $results['oauth_token_secret']); if (!empty($credentials['id'])) { $this->auth = array( 'uid' => $credentials['id'], 'info' => array( 'name' => $credentials['name'], 'nickname' => $credentials['screen_name'], 'urls' => array( 'twitter' => str_replace('{screen_name}', $credentials['screen_name'], $this->strategy['twitter_profile_url']) ) ), 'credentials' => array( 'token' => $results['oauth_token'], 'secret' => $results['oauth_token_secret'] ), 'raw' => $credentials ); $this->mapProfile($credentials, 'location', 'info.location'); $this->mapProfile($credentials, 'description', 'info.description'); $this->mapProfile($credentials, 'profile_image_url_https', 'info.image'); $this->mapProfile($credentials, 'url', 'info.urls.website'); $this->mapProfile($credentials, 'email', 'info.email'); $this->callback(); } } } else { $error = array( 'code' => 'access_denied', 'message' => 'User denied access.', 'raw' => $_GET ); $this->errorCallback($error); } }
[ "public", "function", "oauth_callback", "(", ")", "{", "if", "(", "!", "session_id", "(", ")", ")", "{", "session_start", "(", ")", ";", "}", "$", "session", "=", "$", "_SESSION", "[", "'_opauth_twitter'", "]", ";", "unset", "(", "$", "_SESSION", "[", ...
Receives oauth_verifier, requests for access_token and redirect to callback
[ "Receives", "oauth_verifier", "requests", "for", "access_token", "and", "redirect", "to", "callback" ]
2f76ad82507202353de804a6885db8e58ccc6106
https://github.com/ikkez/f3-opauth/blob/2f76ad82507202353de804a6885db8e58ccc6106/lib/opauth/Strategy/Twitter/TwitterStrategy.php#L91-L149
39,153
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageLocator/DefaultPageLocator.php
DefaultPageLocator.resolvePage
public function resolvePage($name) { if ( empty($name) ) { throw new PageFactoryException('No page name given', PageFactoryException::TYPE_PAGE_NAME_MISSING); } $possible_pages = $this->buildPossiblePages($name); return $this->getExistingPageClass($possible_pages); }
php
public function resolvePage($name) { if ( empty($name) ) { throw new PageFactoryException('No page name given', PageFactoryException::TYPE_PAGE_NAME_MISSING); } $possible_pages = $this->buildPossiblePages($name); return $this->getExistingPageClass($possible_pages); }
[ "public", "function", "resolvePage", "(", "$", "name", ")", "{", "if", "(", "empty", "(", "$", "name", ")", ")", "{", "throw", "new", "PageFactoryException", "(", "'No page name given'", ",", "PageFactoryException", "::", "TYPE_PAGE_NAME_MISSING", ")", ";", "}...
Returns the fully qualified class name of a page by its name. @param string $name The name of the page. @return string @throws PageFactoryException When no name is given.
[ "Returns", "the", "fully", "qualified", "class", "name", "of", "a", "page", "by", "its", "name", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageLocator/DefaultPageLocator.php#L78-L87
39,154
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageLocator/DefaultPageLocator.php
DefaultPageLocator.buildPossiblePages
protected function buildPossiblePages($name) { $possible_classes = array(); $class_name = $this->buildClassNameFromName($name); foreach ( $this->namespacePrefixes as $prefix ) { $possible_classes[] = $prefix . $class_name; } return $possible_classes; }
php
protected function buildPossiblePages($name) { $possible_classes = array(); $class_name = $this->buildClassNameFromName($name); foreach ( $this->namespacePrefixes as $prefix ) { $possible_classes[] = $prefix . $class_name; } return $possible_classes; }
[ "protected", "function", "buildPossiblePages", "(", "$", "name", ")", "{", "$", "possible_classes", "=", "array", "(", ")", ";", "$", "class_name", "=", "$", "this", "->", "buildClassNameFromName", "(", "$", "name", ")", ";", "foreach", "(", "$", "this", ...
Builds all possible page classes from passed name and current prefixes. @param string $name Page name. @return array
[ "Builds", "all", "possible", "page", "classes", "from", "passed", "name", "and", "current", "prefixes", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageLocator/DefaultPageLocator.php#L96-L106
39,155
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageLocator/DefaultPageLocator.php
DefaultPageLocator.buildClassNameFromName
protected function buildClassNameFromName($name) { $class_name_parts = explode(' ', $name); return count($class_name_parts) == 1 ? $name : implode('', array_map('ucfirst', $class_name_parts)); }
php
protected function buildClassNameFromName($name) { $class_name_parts = explode(' ', $name); return count($class_name_parts) == 1 ? $name : implode('', array_map('ucfirst', $class_name_parts)); }
[ "protected", "function", "buildClassNameFromName", "(", "$", "name", ")", "{", "$", "class_name_parts", "=", "explode", "(", "' '", ",", "$", "name", ")", ";", "return", "count", "(", "$", "class_name_parts", ")", "==", "1", "?", "$", "name", ":", "implo...
Builds the class name from a given name by uppercasing the first letter of each word and removing the spaces. @param string $name The class name. @return string
[ "Builds", "the", "class", "name", "from", "a", "given", "name", "by", "uppercasing", "the", "first", "letter", "of", "each", "word", "and", "removing", "the", "spaces", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageLocator/DefaultPageLocator.php#L115-L120
39,156
qa-tools/qa-tools
library/QATools/QATools/PageObject/PageLocator/DefaultPageLocator.php
DefaultPageLocator.getExistingPageClass
protected function getExistingPageClass(array $possible_pages) { foreach ( $possible_pages as $page_class ) { if ( class_exists($page_class) ) { return $page_class; } } $message = sprintf( 'None of the possible classes were found: %s', implode($possible_pages, ', ') ); throw new PageFactoryException($message, PageFactoryException::TYPE_PAGE_CLASS_NOT_FOUND); }
php
protected function getExistingPageClass(array $possible_pages) { foreach ( $possible_pages as $page_class ) { if ( class_exists($page_class) ) { return $page_class; } } $message = sprintf( 'None of the possible classes were found: %s', implode($possible_pages, ', ') ); throw new PageFactoryException($message, PageFactoryException::TYPE_PAGE_CLASS_NOT_FOUND); }
[ "protected", "function", "getExistingPageClass", "(", "array", "$", "possible_pages", ")", "{", "foreach", "(", "$", "possible_pages", "as", "$", "page_class", ")", "{", "if", "(", "class_exists", "(", "$", "page_class", ")", ")", "{", "return", "$", "page_c...
Returns first existing class passed in array. @param array $possible_pages Possible page classes. @return string @throws PageFactoryException When page class is not found.
[ "Returns", "first", "existing", "class", "passed", "in", "array", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PageLocator/DefaultPageLocator.php#L130-L144
39,157
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Select.php
Select.getOptionsByValue
public function getOptionsByValue($value) { $xpath = 'descendant-or-self::option[@value = ' . $this->getXpathEscaper()->escapeLiteral($value) . ']'; return $this->wrapOptions($this->getWrappedElement()->findAll('xpath', $xpath)); }
php
public function getOptionsByValue($value) { $xpath = 'descendant-or-self::option[@value = ' . $this->getXpathEscaper()->escapeLiteral($value) . ']'; return $this->wrapOptions($this->getWrappedElement()->findAll('xpath', $xpath)); }
[ "public", "function", "getOptionsByValue", "(", "$", "value", ")", "{", "$", "xpath", "=", "'descendant-or-self::option[@value = '", ".", "$", "this", "->", "getXpathEscaper", "(", ")", "->", "escapeLiteral", "(", "$", "value", ")", ".", "']'", ";", "return", ...
Returns all options having given value. @param mixed $value Value of option to selected. @return SelectOption[]
[ "Returns", "all", "options", "having", "given", "value", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Select.php#L60-L65
39,158
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Select.php
Select.getOptionsByText
public function getOptionsByText($text, $exact_match = true) { $escaper = $this->getXpathEscaper(); if ( $exact_match ) { $xpath = 'descendant-or-self::option[normalize-space(.) = ' . $escaper->escapeLiteral($text) . ']'; } else { $xpath = 'descendant-or-self::option[contains(., ' . $escaper->escapeLiteral($text) . ')]'; } return $this->wrapOptions($this->getWrappedElement()->findAll('xpath', $xpath)); }
php
public function getOptionsByText($text, $exact_match = true) { $escaper = $this->getXpathEscaper(); if ( $exact_match ) { $xpath = 'descendant-or-self::option[normalize-space(.) = ' . $escaper->escapeLiteral($text) . ']'; } else { $xpath = 'descendant-or-self::option[contains(., ' . $escaper->escapeLiteral($text) . ')]'; } return $this->wrapOptions($this->getWrappedElement()->findAll('xpath', $xpath)); }
[ "public", "function", "getOptionsByText", "(", "$", "text", ",", "$", "exact_match", "=", "true", ")", "{", "$", "escaper", "=", "$", "this", "->", "getXpathEscaper", "(", ")", ";", "if", "(", "$", "exact_match", ")", "{", "$", "xpath", "=", "'descenda...
Returns all options that display text matching the argument. @param string $text Text of the option to be selected. @param boolean $exact_match Search for exact text. @return SelectOption[]
[ "Returns", "all", "options", "that", "display", "text", "matching", "the", "argument", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Select.php#L75-L87
39,159
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Select.php
Select.getSelectedOptions
public function getSelectedOptions() { $ret = array(); foreach ( $this->getOptions() as $option ) { if ( $option->isSelected() ) { $ret[] = $option; } } return $ret; }
php
public function getSelectedOptions() { $ret = array(); foreach ( $this->getOptions() as $option ) { if ( $option->isSelected() ) { $ret[] = $option; } } return $ret; }
[ "public", "function", "getSelectedOptions", "(", ")", "{", "$", "ret", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getOptions", "(", ")", "as", "$", "option", ")", "{", "if", "(", "$", "option", "->", "isSelected", "(", ")", ")...
Returns all selected options belonging to this select tag. @return SelectOption[]
[ "Returns", "all", "selected", "options", "belonging", "to", "this", "select", "tag", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Select.php#L94-L105
39,160
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Select.php
Select.selectByText
public function selectByText($text, $exact_match = true) { $options = $this->getOptionsByText($text, $exact_match); if ( !$options ) { throw new SelectException('Cannot locate option with text: ' . $text, SelectException::TYPE_NOT_FOUND); } return $this->selectOptions($options, !$this->isMultiple()); }
php
public function selectByText($text, $exact_match = true) { $options = $this->getOptionsByText($text, $exact_match); if ( !$options ) { throw new SelectException('Cannot locate option with text: ' . $text, SelectException::TYPE_NOT_FOUND); } return $this->selectOptions($options, !$this->isMultiple()); }
[ "public", "function", "selectByText", "(", "$", "text", ",", "$", "exact_match", "=", "true", ")", "{", "$", "options", "=", "$", "this", "->", "getOptionsByText", "(", "$", "text", ",", "$", "exact_match", ")", ";", "if", "(", "!", "$", "options", "...
Select all options that display text matching the argument. @param string $text The visible text to match against. @param boolean $exact_match Search for exact text. @return self @throws SelectException No options were found by given text.
[ "Select", "all", "options", "that", "display", "text", "matching", "the", "argument", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Select.php#L133-L142
39,161
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Select.php
Select.deselectByText
public function deselectByText($text, $exact_match = true) { foreach ( $this->getOptionsByText($text, $exact_match) as $option ) { $option->deselect(); } return $this; }
php
public function deselectByText($text, $exact_match = true) { foreach ( $this->getOptionsByText($text, $exact_match) as $option ) { $option->deselect(); } return $this; }
[ "public", "function", "deselectByText", "(", "$", "text", ",", "$", "exact_match", "=", "true", ")", "{", "foreach", "(", "$", "this", "->", "getOptionsByText", "(", "$", "text", ",", "$", "exact_match", ")", "as", "$", "option", ")", "{", "$", "option...
Deselect all options that display text matching the argument. @param string $text The visible text to match against. @param boolean $exact_match Search for exact text. @return self
[ "Deselect", "all", "options", "that", "display", "text", "matching", "the", "argument", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Select.php#L152-L159
39,162
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Select.php
Select.selectByValue
public function selectByValue($value) { $options = $this->getOptionsByValue($value); if ( !$options ) { throw new SelectException('Cannot locate option with value: ' . $value, SelectException::TYPE_NOT_FOUND); } return $this->selectOptions($options, !$this->isMultiple()); }
php
public function selectByValue($value) { $options = $this->getOptionsByValue($value); if ( !$options ) { throw new SelectException('Cannot locate option with value: ' . $value, SelectException::TYPE_NOT_FOUND); } return $this->selectOptions($options, !$this->isMultiple()); }
[ "public", "function", "selectByValue", "(", "$", "value", ")", "{", "$", "options", "=", "$", "this", "->", "getOptionsByValue", "(", "$", "value", ")", ";", "if", "(", "!", "$", "options", ")", "{", "throw", "new", "SelectException", "(", "'Cannot locat...
Select all options that have a value matching the argument. @param mixed $value The value to match against. @return self @throws SelectException When option with given value can't be found.
[ "Select", "all", "options", "that", "have", "a", "value", "matching", "the", "argument", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Select.php#L169-L178
39,163
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Select.php
Select.deselectByValue
public function deselectByValue($value) { foreach ( $this->getOptionsByValue($value) as $option ) { $option->deselect(); } return $this; }
php
public function deselectByValue($value) { foreach ( $this->getOptionsByValue($value) as $option ) { $option->deselect(); } return $this; }
[ "public", "function", "deselectByValue", "(", "$", "value", ")", "{", "foreach", "(", "$", "this", "->", "getOptionsByValue", "(", "$", "value", ")", "as", "$", "option", ")", "{", "$", "option", "->", "deselect", "(", ")", ";", "}", "return", "$", "...
Deselect all options that have a value matching the argument. @param mixed $value Value of an option be be deselected. @return self
[ "Deselect", "all", "options", "that", "have", "a", "value", "matching", "the", "argument", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Select.php#L187-L194
39,164
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Select.php
Select.setSelected
public function setSelected(array $values) { $this->assertMultiSelect(); $candidates = array(); /* @var $candidates SelectOption[] */ foreach ( $this->getOptions() as $option ) { if ( in_array($option->getValue(), $values) ) { $candidates[] = $option; } } return $this->selectOptions($candidates); }
php
public function setSelected(array $values) { $this->assertMultiSelect(); $candidates = array(); /* @var $candidates SelectOption[] */ foreach ( $this->getOptions() as $option ) { if ( in_array($option->getValue(), $values) ) { $candidates[] = $option; } } return $this->selectOptions($candidates); }
[ "public", "function", "setSelected", "(", "array", "$", "values", ")", "{", "$", "this", "->", "assertMultiSelect", "(", ")", ";", "$", "candidates", "=", "array", "(", ")", ";", "/* @var $candidates SelectOption[] */", "foreach", "(", "$", "this", "->", "ge...
Replaces current selection with given one. @param array $values Values of options to select. @return self
[ "Replaces", "current", "selection", "with", "given", "one", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Select.php#L215-L229
39,165
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Select.php
Select.deselectAll
public function deselectAll() { $this->assertMultiSelect(); foreach ( $this->getSelectedOptions() as $option ) { $option->deselect(); } return $this; }
php
public function deselectAll() { $this->assertMultiSelect(); foreach ( $this->getSelectedOptions() as $option ) { $option->deselect(); } return $this; }
[ "public", "function", "deselectAll", "(", ")", "{", "$", "this", "->", "assertMultiSelect", "(", ")", ";", "foreach", "(", "$", "this", "->", "getSelectedOptions", "(", ")", "as", "$", "option", ")", "{", "$", "option", "->", "deselect", "(", ")", ";",...
Deselects all options. @return self
[ "Deselects", "all", "options", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Select.php#L236-L245
39,166
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Select.php
Select.setValue
public function setValue($value) { if ( is_array($value) ) { return $this->setSelected($value); } return $this->selectByValue((string)$value); }
php
public function setValue($value) { if ( is_array($value) ) { return $this->setSelected($value); } return $this->selectByValue((string)$value); }
[ "public", "function", "setValue", "(", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "return", "$", "this", "->", "setSelected", "(", "$", "value", ")", ";", "}", "return", "$", "this", "->", "selectByValue", "(", ...
Sets value to the element. @param mixed $value New value. @return self
[ "Sets", "value", "to", "the", "element", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Select.php#L254-L261
39,167
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Select.php
Select.selectOptions
protected function selectOptions(array $options, $first_only = false) { foreach ( $options as $index => $option ) { $option->select($index > 0); if ( $first_only ) { return $this; } } return $this; }
php
protected function selectOptions(array $options, $first_only = false) { foreach ( $options as $index => $option ) { $option->select($index > 0); if ( $first_only ) { return $this; } } return $this; }
[ "protected", "function", "selectOptions", "(", "array", "$", "options", ",", "$", "first_only", "=", "false", ")", "{", "foreach", "(", "$", "options", "as", "$", "index", "=>", "$", "option", ")", "{", "$", "option", "->", "select", "(", "$", "index",...
Select given options. @param array|SelectOption[] $options Options to be selected. @param boolean $first_only Select only first option. @return self
[ "Select", "given", "options", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Select.php#L271-L282
39,168
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Select.php
Select.wrapOptions
protected function wrapOptions(array $nodes) { $ret = array(); foreach ( $nodes as $node_element ) { /** @var SelectOption $option */ $option = SelectOption::fromNodeElement($node_element, $this->getPageFactory()); $ret[] = $option->setSelect($this); } return $ret; }
php
protected function wrapOptions(array $nodes) { $ret = array(); foreach ( $nodes as $node_element ) { /** @var SelectOption $option */ $option = SelectOption::fromNodeElement($node_element, $this->getPageFactory()); $ret[] = $option->setSelect($this); } return $ret; }
[ "protected", "function", "wrapOptions", "(", "array", "$", "nodes", ")", "{", "$", "ret", "=", "array", "(", ")", ";", "foreach", "(", "$", "nodes", "as", "$", "node_element", ")", "{", "/** @var SelectOption $option */", "$", "option", "=", "SelectOption", ...
Wraps each of NodeElement in array with a SelectOption class. @param array|NodeElement[] $nodes Nodes. @return SelectOption[]
[ "Wraps", "each", "of", "NodeElement", "in", "array", "with", "a", "SelectOption", "class", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Select.php#L291-L302
39,169
ikkez/f3-opauth
lib/opauth/Strategy/Google/GoogleStrategy.php
GoogleStrategy.userinfo
private function userinfo($access_token){ $userinfo = $this->serverGet('https://www.googleapis.com/oauth2/v1/userinfo', array('access_token' => $access_token), null, $headers); if (!empty($userinfo)){ return $this->recursiveGetObjectVars(json_decode($userinfo)); } else{ $error = array( 'code' => 'userinfo_error', 'message' => 'Failed when attempting to query for user information', 'raw' => array( 'response' => $userinfo, 'headers' => $headers ) ); $this->errorCallback($error); } }
php
private function userinfo($access_token){ $userinfo = $this->serverGet('https://www.googleapis.com/oauth2/v1/userinfo', array('access_token' => $access_token), null, $headers); if (!empty($userinfo)){ return $this->recursiveGetObjectVars(json_decode($userinfo)); } else{ $error = array( 'code' => 'userinfo_error', 'message' => 'Failed when attempting to query for user information', 'raw' => array( 'response' => $userinfo, 'headers' => $headers ) ); $this->errorCallback($error); } }
[ "private", "function", "userinfo", "(", "$", "access_token", ")", "{", "$", "userinfo", "=", "$", "this", "->", "serverGet", "(", "'https://www.googleapis.com/oauth2/v1/userinfo'", ",", "array", "(", "'access_token'", "=>", "$", "access_token", ")", ",", "null", ...
Queries Google API for user info @param string $access_token @return array Parsed JSON results
[ "Queries", "Google", "API", "for", "user", "info" ]
2f76ad82507202353de804a6885db8e58ccc6106
https://github.com/ikkez/f3-opauth/blob/2f76ad82507202353de804a6885db8e58ccc6106/lib/opauth/Strategy/Google/GoogleStrategy.php#L133-L150
39,170
qa-tools/qa-tools
library/QATools/QATools/BEM/Annotation/BEMAnnotation.php
BEMAnnotation.getSelector
public function getSelector(LocatorHelper $locator_helper) { list($modificator_name, $modificator_value) = $this->getModificator(); if ( $this->element ) { return $locator_helper->getElementLocator( $this->element, $this->block, $modificator_name, $modificator_value ); } return $locator_helper->getBlockLocator($this->block, $modificator_name, $modificator_value); }
php
public function getSelector(LocatorHelper $locator_helper) { list($modificator_name, $modificator_value) = $this->getModificator(); if ( $this->element ) { return $locator_helper->getElementLocator( $this->element, $this->block, $modificator_name, $modificator_value ); } return $locator_helper->getBlockLocator($this->block, $modificator_name, $modificator_value); }
[ "public", "function", "getSelector", "(", "LocatorHelper", "$", "locator_helper", ")", "{", "list", "(", "$", "modificator_name", ",", "$", "modificator_value", ")", "=", "$", "this", "->", "getModificator", "(", ")", ";", "if", "(", "$", "this", "->", "el...
Returns selector, that combines block, element and modificator. @param LocatorHelper $locator_helper Locator helper. @return array
[ "Returns", "selector", "that", "combines", "block", "element", "and", "modificator", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/BEM/Annotation/BEMAnnotation.php#L53-L67
39,171
qa-tools/qa-tools
library/QATools/QATools/BEM/Annotation/BEMAnnotation.php
BEMAnnotation.getModificator
protected function getModificator() { if ( $this->modificator ) { list($modificator_name, $modificator_value) = each($this->modificator); } else { $modificator_name = $modificator_value = null; } return array($modificator_name, $modificator_value); }
php
protected function getModificator() { if ( $this->modificator ) { list($modificator_name, $modificator_value) = each($this->modificator); } else { $modificator_name = $modificator_value = null; } return array($modificator_name, $modificator_value); }
[ "protected", "function", "getModificator", "(", ")", "{", "if", "(", "$", "this", "->", "modificator", ")", "{", "list", "(", "$", "modificator_name", ",", "$", "modificator_value", ")", "=", "each", "(", "$", "this", "->", "modificator", ")", ";", "}", ...
Returns modificator. @return array
[ "Returns", "modificator", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/BEM/Annotation/BEMAnnotation.php#L74-L84
39,172
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/Checkbox.php
Checkbox.toggle
public function toggle($check_or_uncheck = null) { if ( !isset($check_or_uncheck) ) { $check_or_uncheck = !$this->isChecked(); } return $check_or_uncheck ? $this->check() : $this->uncheck(); }
php
public function toggle($check_or_uncheck = null) { if ( !isset($check_or_uncheck) ) { $check_or_uncheck = !$this->isChecked(); } return $check_or_uncheck ? $this->check() : $this->uncheck(); }
[ "public", "function", "toggle", "(", "$", "check_or_uncheck", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "check_or_uncheck", ")", ")", "{", "$", "check_or_uncheck", "=", "!", "$", "this", "->", "isChecked", "(", ")", ";", "}", "return", ...
Alters checkbox checked state. @param boolean|null $check_or_uncheck Tells, how checkbox state should be altered. @return self
[ "Alters", "checkbox", "checked", "state", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/Checkbox.php#L60-L67
39,173
qa-tools/qa-tools
library/QATools/QATools/PageObject/Config/Config.php
Config.setOption
public function setOption($name, $value) { $this->assertOptionName($name); $this->options[$name] = $value; return $this; }
php
public function setOption($name, $value) { $this->assertOptionName($name); $this->options[$name] = $value; return $this; }
[ "public", "function", "setOption", "(", "$", "name", ",", "$", "value", ")", "{", "$", "this", "->", "assertOptionName", "(", "$", "name", ")", ";", "$", "this", "->", "options", "[", "$", "name", "]", "=", "$", "value", ";", "return", "$", "this",...
Change configuration option value. @param string $name Config option name. @param mixed $value Config option value. @return self
[ "Change", "configuration", "option", "value", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Config/Config.php#L59-L66
39,174
qa-tools/qa-tools
library/QATools/QATools/PageObject/Config/Config.php
Config.assertOptionName
protected function assertOptionName($name) { if ( !isset($this->options[$name]) ) { throw new ConfigException( 'Option "' . $name . '" doesn\'t exist in configuration', ConfigException::TYPE_NOT_FOUND ); } }
php
protected function assertOptionName($name) { if ( !isset($this->options[$name]) ) { throw new ConfigException( 'Option "' . $name . '" doesn\'t exist in configuration', ConfigException::TYPE_NOT_FOUND ); } }
[ "protected", "function", "assertOptionName", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "options", "[", "$", "name", "]", ")", ")", "{", "throw", "new", "ConfigException", "(", "'Option \"'", ".", "$", "name", ".", "...
Checks, that option exists in config. @param string $name Option name. @return void @throws ConfigException Thrown when option with a given name doesn't exist.
[ "Checks", "that", "option", "exists", "in", "config", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Config/Config.php#L90-L98
39,175
ikkez/f3-opauth
lib/opauth/Strategy/Facebook/FacebookStrategy.php
FacebookStrategy.int_callback
public function int_callback(){ if (empty($_GET['code'])) { $error = array( 'provider' => 'Facebook', 'code' => $_GET['error_code'], 'message' => isset($_GET['error_message']) ? $_GET['error_message'] : '', 'raw' => $_GET ); $this->errorCallback($error); return; } $url = 'https://graph.facebook.com/oauth/access_token'; $params = array( 'client_id' =>$this->strategy['app_id'], 'client_secret' => $this->strategy['app_secret'], 'redirect_uri'=> $this->strategy['redirect_uri'], 'code' => trim($_GET['code']) ); $response = $this->serverGet($url, $params, null, $headers); $results = json_decode($response); if (empty($results) || empty($results->access_token)) { $error = array( 'provider' => 'Facebook', 'code' => 'access_token_error', 'message' => 'Failed when attempting to obtain access token', 'raw' => $headers ); $this->errorCallback($error); return; } $me = $this->me($results->access_token); $this->auth = array( 'provider' => 'Facebook', 'uid' => $me->id, 'info' => array( 'name' => $me->name, 'image' => "https://graph.facebook.com/{$this->api_version}/{$me->id}/picture?type=large" ), 'credentials' => array( 'token' => $results->access_token, 'expires' => date('c', time() + $results->expires_in) ), 'raw' => $me ); if (!empty($me->email)) $this->auth['info']['email'] = $me->email; if (!empty($me->name)) $this->auth['info']['nickname'] = $me->name; if (!empty($me->first_name)) $this->auth['info']['first_name'] = $me->first_name; if (!empty($me->last_name)) $this->auth['info']['last_name'] = $me->last_name; if (!empty($me->link)) $this->auth['info']['urls']['facebook'] = $me->link; /** * Missing optional info values * - description * - phone: not accessible via Facebook Graph API */ $this->callback(); }
php
public function int_callback(){ if (empty($_GET['code'])) { $error = array( 'provider' => 'Facebook', 'code' => $_GET['error_code'], 'message' => isset($_GET['error_message']) ? $_GET['error_message'] : '', 'raw' => $_GET ); $this->errorCallback($error); return; } $url = 'https://graph.facebook.com/oauth/access_token'; $params = array( 'client_id' =>$this->strategy['app_id'], 'client_secret' => $this->strategy['app_secret'], 'redirect_uri'=> $this->strategy['redirect_uri'], 'code' => trim($_GET['code']) ); $response = $this->serverGet($url, $params, null, $headers); $results = json_decode($response); if (empty($results) || empty($results->access_token)) { $error = array( 'provider' => 'Facebook', 'code' => 'access_token_error', 'message' => 'Failed when attempting to obtain access token', 'raw' => $headers ); $this->errorCallback($error); return; } $me = $this->me($results->access_token); $this->auth = array( 'provider' => 'Facebook', 'uid' => $me->id, 'info' => array( 'name' => $me->name, 'image' => "https://graph.facebook.com/{$this->api_version}/{$me->id}/picture?type=large" ), 'credentials' => array( 'token' => $results->access_token, 'expires' => date('c', time() + $results->expires_in) ), 'raw' => $me ); if (!empty($me->email)) $this->auth['info']['email'] = $me->email; if (!empty($me->name)) $this->auth['info']['nickname'] = $me->name; if (!empty($me->first_name)) $this->auth['info']['first_name'] = $me->first_name; if (!empty($me->last_name)) $this->auth['info']['last_name'] = $me->last_name; if (!empty($me->link)) $this->auth['info']['urls']['facebook'] = $me->link; /** * Missing optional info values * - description * - phone: not accessible via Facebook Graph API */ $this->callback(); }
[ "public", "function", "int_callback", "(", ")", "{", "if", "(", "empty", "(", "$", "_GET", "[", "'code'", "]", ")", ")", "{", "$", "error", "=", "array", "(", "'provider'", "=>", "'Facebook'", ",", "'code'", "=>", "$", "_GET", "[", "'error_code'", "]...
Internal callback, after Facebook's OAuth
[ "Internal", "callback", "after", "Facebook", "s", "OAuth" ]
2f76ad82507202353de804a6885db8e58ccc6106
https://github.com/ikkez/f3-opauth/blob/2f76ad82507202353de804a6885db8e58ccc6106/lib/opauth/Strategy/Facebook/FacebookStrategy.php#L54-L116
39,176
ikkez/f3-opauth
lib/opauth/Strategy/Facebook/FacebookStrategy.php
FacebookStrategy.me
private function me($access_token){ $fields = 'id,name,email';//default value if ( isset($this->strategy['fields']) ) { $fields = $this->strategy['fields']; } $me = $this->serverGet("https://graph.facebook.com/{$this->api_version}/me", array( 'appsecret_proof' => hash_hmac('sha256', $access_token, $this->strategy['app_secret']), 'access_token' => $access_token, 'fields' => $fields ), null, $headers ); if (empty($me)){ $error = array( 'provider' => 'Facebook', 'code' => 'me_error', 'message' => 'Failed when attempting to query for user information', 'raw' => array( 'response' => $me, 'headers' => $headers ) ); $this->errorCallback($error); return; } return json_decode($me); }
php
private function me($access_token){ $fields = 'id,name,email';//default value if ( isset($this->strategy['fields']) ) { $fields = $this->strategy['fields']; } $me = $this->serverGet("https://graph.facebook.com/{$this->api_version}/me", array( 'appsecret_proof' => hash_hmac('sha256', $access_token, $this->strategy['app_secret']), 'access_token' => $access_token, 'fields' => $fields ), null, $headers ); if (empty($me)){ $error = array( 'provider' => 'Facebook', 'code' => 'me_error', 'message' => 'Failed when attempting to query for user information', 'raw' => array( 'response' => $me, 'headers' => $headers ) ); $this->errorCallback($error); return; } return json_decode($me); }
[ "private", "function", "me", "(", "$", "access_token", ")", "{", "$", "fields", "=", "'id,name,email'", ";", "//default value", "if", "(", "isset", "(", "$", "this", "->", "strategy", "[", "'fields'", "]", ")", ")", "{", "$", "fields", "=", "$", "this"...
Queries Facebook Graph API for user info @param string $access_token @return array Parsed JSON results
[ "Queries", "Facebook", "Graph", "API", "for", "user", "info" ]
2f76ad82507202353de804a6885db8e58ccc6106
https://github.com/ikkez/f3-opauth/blob/2f76ad82507202353de804a6885db8e58ccc6106/lib/opauth/Strategy/Facebook/FacebookStrategy.php#L124-L154
39,177
ikkez/f3-opauth
lib/opauth/OpauthBridge.php
OpauthBridge.callback
function callback(\Base $f3, $params) { $Opauth = new \Opauth($this->config,false); switch ($Opauth->env['callback_transport']) { case 'session': $response = $f3->get('SESSION.opauth'); $f3->clear('SESSION.opauth'); break; case 'post': $response = unserialize(base64_decode($f3->get('POST.opauth'))); break; case 'get': $response = unserialize(base64_decode($f3->get('GET.opauth'))); break; default: $f3->error(400,'Unsupported callback_transport'); break; } if (isset($response['error'])) { $f3->call($this->abortFunc,array($response)); return; } $data = $response['auth']; // validate if (empty($data) || empty($response['timestamp']) || empty($response['signature']) || empty($data['provider']) || empty($data['uid'])) $f3->error(400,'Invalid auth response: Missing key auth response components'); elseif (!$Opauth->validate(sha1(print_r($data, true)), $response['timestamp'], $response['signature'], $reason)) $f3->error(400,'Invalid auth response: '.$reason); else // It's all good $f3->call($this->successFunc,array($data)); }
php
function callback(\Base $f3, $params) { $Opauth = new \Opauth($this->config,false); switch ($Opauth->env['callback_transport']) { case 'session': $response = $f3->get('SESSION.opauth'); $f3->clear('SESSION.opauth'); break; case 'post': $response = unserialize(base64_decode($f3->get('POST.opauth'))); break; case 'get': $response = unserialize(base64_decode($f3->get('GET.opauth'))); break; default: $f3->error(400,'Unsupported callback_transport'); break; } if (isset($response['error'])) { $f3->call($this->abortFunc,array($response)); return; } $data = $response['auth']; // validate if (empty($data) || empty($response['timestamp']) || empty($response['signature']) || empty($data['provider']) || empty($data['uid'])) $f3->error(400,'Invalid auth response: Missing key auth response components'); elseif (!$Opauth->validate(sha1(print_r($data, true)), $response['timestamp'], $response['signature'], $reason)) $f3->error(400,'Invalid auth response: '.$reason); else // It's all good $f3->call($this->successFunc,array($data)); }
[ "function", "callback", "(", "\\", "Base", "$", "f3", ",", "$", "params", ")", "{", "$", "Opauth", "=", "new", "\\", "Opauth", "(", "$", "this", "->", "config", ",", "false", ")", ";", "switch", "(", "$", "Opauth", "->", "env", "[", "'callback_tran...
auth service callback @param Base $f3 @param $params
[ "auth", "service", "callback" ]
2f76ad82507202353de804a6885db8e58ccc6106
https://github.com/ikkez/f3-opauth/blob/2f76ad82507202353de804a6885db8e58ccc6106/lib/opauth/OpauthBridge.php#L52-L84
39,178
qa-tools/qa-tools
library/QATools/QATools/PageObject/PropertyDecorator/DefaultPropertyDecorator.php
DefaultPropertyDecorator.decorate
public function decorate(Property $property) { if ( !$this->canDecorate($property) ) { return null; } $locator = $this->locatorFactory->createLocator($property); return $locator !== null ? $this->doDecorate($property, $locator) : null; }
php
public function decorate(Property $property) { if ( !$this->canDecorate($property) ) { return null; } $locator = $this->locatorFactory->createLocator($property); return $locator !== null ? $this->doDecorate($property, $locator) : null; }
[ "public", "function", "decorate", "(", "Property", "$", "property", ")", "{", "if", "(", "!", "$", "this", "->", "canDecorate", "(", "$", "property", ")", ")", "{", "return", "null", ";", "}", "$", "locator", "=", "$", "this", "->", "locatorFactory", ...
This method is called by PageFactory on all properties to decide how to decorate the property. @param Property $property The property that may be decorated. @return IProxy
[ "This", "method", "is", "called", "by", "PageFactory", "on", "all", "properties", "to", "decide", "how", "to", "decorate", "the", "property", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PropertyDecorator/DefaultPropertyDecorator.php#L75-L84
39,179
qa-tools/qa-tools
library/QATools/QATools/PageObject/PropertyDecorator/DefaultPropertyDecorator.php
DefaultPropertyDecorator.canDecorate
protected function canDecorate(Property $property) { $data_type = $property->getDataType(); if ( !$data_type || $property->isSimpleDataType() || interface_exists($data_type) ) { return false; } if ( !class_exists($data_type) ) { $message = '"%s" element not recognised. "%s" class not found'; throw new PageFactoryException( sprintf($message, $property, $data_type), PageFactoryException::TYPE_UNKNOWN_CLASS ); } return true; }
php
protected function canDecorate(Property $property) { $data_type = $property->getDataType(); if ( !$data_type || $property->isSimpleDataType() || interface_exists($data_type) ) { return false; } if ( !class_exists($data_type) ) { $message = '"%s" element not recognised. "%s" class not found'; throw new PageFactoryException( sprintf($message, $property, $data_type), PageFactoryException::TYPE_UNKNOWN_CLASS ); } return true; }
[ "protected", "function", "canDecorate", "(", "Property", "$", "property", ")", "{", "$", "data_type", "=", "$", "property", "->", "getDataType", "(", ")", ";", "if", "(", "!", "$", "data_type", "||", "$", "property", "->", "isSimpleDataType", "(", ")", "...
Checks if a property can be decorated. @param Property $property The property that may be decorated. @return boolean @throws PageFactoryException When class of non-existing element discovered in property's @var annotation.
[ "Checks", "if", "a", "property", "can", "be", "decorated", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PropertyDecorator/DefaultPropertyDecorator.php#L94-L111
39,180
qa-tools/qa-tools
library/QATools/QATools/PageObject/PropertyDecorator/DefaultPropertyDecorator.php
DefaultPropertyDecorator.getProxyClass
protected function getProxyClass(Property $property) { $data_type = $property->getDataType(); if ( $data_type ) { foreach ( $this->elementToProxyMapping as $element_class => $proxy_class ) { if ( $this->classMatches($data_type, $element_class) ) { return $proxy_class; } } } return ''; }
php
protected function getProxyClass(Property $property) { $data_type = $property->getDataType(); if ( $data_type ) { foreach ( $this->elementToProxyMapping as $element_class => $proxy_class ) { if ( $this->classMatches($data_type, $element_class) ) { return $proxy_class; } } } return ''; }
[ "protected", "function", "getProxyClass", "(", "Property", "$", "property", ")", "{", "$", "data_type", "=", "$", "property", "->", "getDataType", "(", ")", ";", "if", "(", "$", "data_type", ")", "{", "foreach", "(", "$", "this", "->", "elementToProxyMappi...
Returns proxy class, that can be used alongside with element class of a property. @param Property $property Property. @return string
[ "Returns", "proxy", "class", "that", "can", "be", "used", "alongside", "with", "element", "class", "of", "a", "property", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PropertyDecorator/DefaultPropertyDecorator.php#L143-L156
39,181
qa-tools/qa-tools
library/QATools/QATools/PageObject/PropertyDecorator/DefaultPropertyDecorator.php
DefaultPropertyDecorator.classMatches
protected function classMatches($class_name, $descendant_of) { $class_name = ltrim($class_name, '\\'); $descendant_of = ltrim($descendant_of, '\\'); $match_with = array_merge(class_implements($class_name), class_parents($class_name)); return $class_name == $descendant_of || in_array($descendant_of, $match_with); }
php
protected function classMatches($class_name, $descendant_of) { $class_name = ltrim($class_name, '\\'); $descendant_of = ltrim($descendant_of, '\\'); $match_with = array_merge(class_implements($class_name), class_parents($class_name)); return $class_name == $descendant_of || in_array($descendant_of, $match_with); }
[ "protected", "function", "classMatches", "(", "$", "class_name", ",", "$", "descendant_of", ")", "{", "$", "class_name", "=", "ltrim", "(", "$", "class_name", ",", "'\\\\'", ")", ";", "$", "descendant_of", "=", "ltrim", "(", "$", "descendant_of", ",", "'\\...
Ensures that 2 given classes has a relation. @param string $class_name Class name to test. @param string $descendant_of Required descendant class. @return boolean
[ "Ensures", "that", "2", "given", "classes", "has", "a", "relation", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/PropertyDecorator/DefaultPropertyDecorator.php#L166-L173
39,182
ikkez/f3-opauth
lib/opauth/Strategy/Twitter/Vendor/tmhOAuth/tmhOAuth.php
tmhOAuth.create_nonce
private function create_nonce($length=12, $include_time=true) { if ($this->config['force_nonce'] == false) { $sequence = array_merge(range(0,9), range('A','Z'), range('a','z')); $length = $length > count($sequence) ? count($sequence) : $length; shuffle($sequence); $prefix = $include_time ? microtime() : ''; $this->config['nonce'] = md5(substr($prefix . implode('', $sequence), 0, $length)); } }
php
private function create_nonce($length=12, $include_time=true) { if ($this->config['force_nonce'] == false) { $sequence = array_merge(range(0,9), range('A','Z'), range('a','z')); $length = $length > count($sequence) ? count($sequence) : $length; shuffle($sequence); $prefix = $include_time ? microtime() : ''; $this->config['nonce'] = md5(substr($prefix . implode('', $sequence), 0, $length)); } }
[ "private", "function", "create_nonce", "(", "$", "length", "=", "12", ",", "$", "include_time", "=", "true", ")", "{", "if", "(", "$", "this", "->", "config", "[", "'force_nonce'", "]", "==", "false", ")", "{", "$", "sequence", "=", "array_merge", "(",...
Generates a random OAuth nonce. If 'force_nonce' is true a nonce is not generated and the value in the configuration will be retained. @param string $length how many characters the nonce should be before MD5 hashing. default 12 @param string $include_time whether to include time at the beginning of the nonce. default true @return void
[ "Generates", "a", "random", "OAuth", "nonce", ".", "If", "force_nonce", "is", "true", "a", "nonce", "is", "not", "generated", "and", "the", "value", "in", "the", "configuration", "will", "be", "retained", "." ]
2f76ad82507202353de804a6885db8e58ccc6106
https://github.com/ikkez/f3-opauth/blob/2f76ad82507202353de804a6885db8e58ccc6106/lib/opauth/Strategy/Twitter/Vendor/tmhOAuth/tmhOAuth.php#L114-L123
39,183
ikkez/f3-opauth
lib/opauth/Strategy/Twitter/Vendor/tmhOAuth/tmhOAuth.php
tmhOAuth.get_defaults
private function get_defaults() { $defaults = array( 'oauth_version' => $this->config['oauth_version'], 'oauth_nonce' => $this->config['nonce'], 'oauth_timestamp' => $this->config['timestamp'], 'oauth_consumer_key' => $this->config['consumer_key'], 'oauth_signature_method' => $this->config['oauth_signature_method'], ); // include the user token if it exists if ( $this->config['user_token'] ) $defaults['oauth_token'] = $this->config['user_token']; // safely encode foreach ($defaults as $k => $v) { $_defaults[$this->safe_encode($k)] = $this->safe_encode($v); } return $_defaults; }
php
private function get_defaults() { $defaults = array( 'oauth_version' => $this->config['oauth_version'], 'oauth_nonce' => $this->config['nonce'], 'oauth_timestamp' => $this->config['timestamp'], 'oauth_consumer_key' => $this->config['consumer_key'], 'oauth_signature_method' => $this->config['oauth_signature_method'], ); // include the user token if it exists if ( $this->config['user_token'] ) $defaults['oauth_token'] = $this->config['user_token']; // safely encode foreach ($defaults as $k => $v) { $_defaults[$this->safe_encode($k)] = $this->safe_encode($v); } return $_defaults; }
[ "private", "function", "get_defaults", "(", ")", "{", "$", "defaults", "=", "array", "(", "'oauth_version'", "=>", "$", "this", "->", "config", "[", "'oauth_version'", "]", ",", "'oauth_nonce'", "=>", "$", "this", "->", "config", "[", "'nonce'", "]", ",", ...
Returns an array of the standard OAuth parameters. @return array all required OAuth parameters, safely encoded
[ "Returns", "an", "array", "of", "the", "standard", "OAuth", "parameters", "." ]
2f76ad82507202353de804a6885db8e58ccc6106
https://github.com/ikkez/f3-opauth/blob/2f76ad82507202353de804a6885db8e58ccc6106/lib/opauth/Strategy/Twitter/Vendor/tmhOAuth/tmhOAuth.php#L178-L197
39,184
qa-tools/qa-tools
library/QATools/QATools/PageObject/Annotation/MatchUrlComponentAnnotation.php
MatchUrlComponentAnnotation.isValid
public function isValid() { return isset($this->path) || isset($this->params) || isset($this->anchor) || isset($this->secure) || isset($this->host) || isset($this->port) || isset($this->user) || isset($this->pass); }
php
public function isValid() { return isset($this->path) || isset($this->params) || isset($this->anchor) || isset($this->secure) || isset($this->host) || isset($this->port) || isset($this->user) || isset($this->pass); }
[ "public", "function", "isValid", "(", ")", "{", "return", "isset", "(", "$", "this", "->", "path", ")", "||", "isset", "(", "$", "this", "->", "params", ")", "||", "isset", "(", "$", "this", "->", "anchor", ")", "||", "isset", "(", "$", "this", "...
Validates required data. @return boolean
[ "Validates", "required", "data", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Annotation/MatchUrlComponentAnnotation.php#L99-L109
39,185
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/SelectOption.php
SelectOption.select
public function select($multiple = false) { if ( !$this->isSelected() ) { if ( $this->select === null ) { throw new SelectException( 'No SELECT element association defined', SelectException::TYPE_UNBOUND_OPTION ); } $this->select->getWrappedElement()->selectOption($this->getValue(), $multiple); } return $this; }
php
public function select($multiple = false) { if ( !$this->isSelected() ) { if ( $this->select === null ) { throw new SelectException( 'No SELECT element association defined', SelectException::TYPE_UNBOUND_OPTION ); } $this->select->getWrappedElement()->selectOption($this->getValue(), $multiple); } return $this; }
[ "public", "function", "select", "(", "$", "multiple", "=", "false", ")", "{", "if", "(", "!", "$", "this", "->", "isSelected", "(", ")", ")", "{", "if", "(", "$", "this", "->", "select", "===", "null", ")", "{", "throw", "new", "SelectException", "...
Selects option if it is not already selected. @param boolean $multiple Append this option to current selection. @return self @throws SelectException When no SELECT element association defined.
[ "Selects", "option", "if", "it", "is", "not", "already", "selected", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/SelectOption.php#L60-L74
39,186
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/SelectOption.php
SelectOption.deselect
public function deselect() { if ( $this->isSelected() ) { if ( !$this->isSeleniumDriver() ) { throw new SelectException( 'Deselecting individual options is only supported in Selenium drivers', SelectException::TYPE_NOT_SUPPORTED ); } $this->getWrappedElement()->click(); } return $this; }
php
public function deselect() { if ( $this->isSelected() ) { if ( !$this->isSeleniumDriver() ) { throw new SelectException( 'Deselecting individual options is only supported in Selenium drivers', SelectException::TYPE_NOT_SUPPORTED ); } $this->getWrappedElement()->click(); } return $this; }
[ "public", "function", "deselect", "(", ")", "{", "if", "(", "$", "this", "->", "isSelected", "(", ")", ")", "{", "if", "(", "!", "$", "this", "->", "isSeleniumDriver", "(", ")", ")", "{", "throw", "new", "SelectException", "(", "'Deselecting individual o...
Deselects option if it is not already deselected. @return self @throws SelectException When non-Selenium driver is used.
[ "Deselects", "option", "if", "it", "is", "not", "already", "deselected", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/SelectOption.php#L82-L96
39,187
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/Element/SelectOption.php
SelectOption.toggle
public function toggle($select_or_deselect = null) { if ( !isset($select_or_deselect) ) { $select_or_deselect = !$this->isSelected(); } return $select_or_deselect ? $this->select() : $this->deselect(); }
php
public function toggle($select_or_deselect = null) { if ( !isset($select_or_deselect) ) { $select_or_deselect = !$this->isSelected(); } return $select_or_deselect ? $this->select() : $this->deselect(); }
[ "public", "function", "toggle", "(", "$", "select_or_deselect", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "select_or_deselect", ")", ")", "{", "$", "select_or_deselect", "=", "!", "$", "this", "->", "isSelected", "(", ")", ";", "}", "re...
Alters option selected state. @param boolean|null $select_or_deselect Tells, how option state should be altered. @return self
[ "Alters", "option", "selected", "state", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/Element/SelectOption.php#L105-L112
39,188
qa-tools/qa-tools
library/QATools/QATools/HtmlElements/PropertyDecorator/TypifiedPropertyDecorator.php
TypifiedPropertyDecorator.getElementName
protected function getElementName(Property $property) { /* @var $annotations ElementNameAnnotation[] */ $annotations = $property->getAnnotationsFromPropertyOrClass('@element-name'); if ( $annotations && ($annotations[0] instanceof ElementNameAnnotation) ) { return $annotations[0]->name; } return (string)$property; }
php
protected function getElementName(Property $property) { /* @var $annotations ElementNameAnnotation[] */ $annotations = $property->getAnnotationsFromPropertyOrClass('@element-name'); if ( $annotations && ($annotations[0] instanceof ElementNameAnnotation) ) { return $annotations[0]->name; } return (string)$property; }
[ "protected", "function", "getElementName", "(", "Property", "$", "property", ")", "{", "/* @var $annotations ElementNameAnnotation[] */", "$", "annotations", "=", "$", "property", "->", "getAnnotationsFromPropertyOrClass", "(", "'@element-name'", ")", ";", "if", "(", "$...
Returns name of the element. @param Property $property Property, to inspect. @return string
[ "Returns", "name", "of", "the", "element", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/HtmlElements/PropertyDecorator/TypifiedPropertyDecorator.php#L91-L101
39,189
qa-tools/qa-tools
library/QATools/QATools/PageObject/Proxy/AbstractProxy.php
AbstractProxy.locateElements
protected function locateElements() { $elements = $this->locator->findAll(); if ( empty($elements) ) { throw new ElementNotFoundException('No elements found by selector: ' . (string)$this->locator); } return $elements; }
php
protected function locateElements() { $elements = $this->locator->findAll(); if ( empty($elements) ) { throw new ElementNotFoundException('No elements found by selector: ' . (string)$this->locator); } return $elements; }
[ "protected", "function", "locateElements", "(", ")", "{", "$", "elements", "=", "$", "this", "->", "locator", "->", "findAll", "(", ")", ";", "if", "(", "empty", "(", "$", "elements", ")", ")", "{", "throw", "new", "ElementNotFoundException", "(", "'No e...
Locates elements using the locator. @return NodeElement[] @throws ElementNotFoundException When element wasn't found on the page.
[ "Locates", "elements", "using", "the", "locator", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Proxy/AbstractProxy.php#L222-L231
39,190
qa-tools/qa-tools
library/QATools/QATools/PageObject/Url/Builder.php
Builder.build
public function build(array $params = array()) { $final_url = $this->getProtocol() . '://' . $this->getHost() . $this->getPortForBuild() . $this->getPath(); $final_params = array_merge($this->getParams(), $params); list($final_url, $final_params) = $this->unmaskUrl($final_url, $final_params); if ( !empty($final_params) ) { $final_url .= '?' . http_build_query($final_params); } if ( $this->getAnchor() != '' ) { $final_url .= '#' . $this->getAnchor(); } return $final_url; }
php
public function build(array $params = array()) { $final_url = $this->getProtocol() . '://' . $this->getHost() . $this->getPortForBuild() . $this->getPath(); $final_params = array_merge($this->getParams(), $params); list($final_url, $final_params) = $this->unmaskUrl($final_url, $final_params); if ( !empty($final_params) ) { $final_url .= '?' . http_build_query($final_params); } if ( $this->getAnchor() != '' ) { $final_url .= '#' . $this->getAnchor(); } return $final_url; }
[ "public", "function", "build", "(", "array", "$", "params", "=", "array", "(", ")", ")", "{", "$", "final_url", "=", "$", "this", "->", "getProtocol", "(", ")", ".", "'://'", ".", "$", "this", "->", "getHost", "(", ")", ".", "$", "this", "->", "g...
Builds the final url and merges saved params with given via parameter. @param array $params The additional GET params. @return string
[ "Builds", "the", "final", "url", "and", "merges", "saved", "params", "with", "given", "via", "parameter", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Url/Builder.php#L99-L115
39,191
qa-tools/qa-tools
library/QATools/QATools/PageObject/Url/Builder.php
Builder.getPortForBuild
protected function getPortForBuild() { if ( !$this->getPort() ) { return ''; } $default_ports = array('http' => 80, 'https' => 443); if ( $this->getPort() === $default_ports[$this->getProtocol()] ) { return ''; } return ':' . $this->getPort(); }
php
protected function getPortForBuild() { if ( !$this->getPort() ) { return ''; } $default_ports = array('http' => 80, 'https' => 443); if ( $this->getPort() === $default_ports[$this->getProtocol()] ) { return ''; } return ':' . $this->getPort(); }
[ "protected", "function", "getPortForBuild", "(", ")", "{", "if", "(", "!", "$", "this", "->", "getPort", "(", ")", ")", "{", "return", "''", ";", "}", "$", "default_ports", "=", "array", "(", "'http'", "=>", "80", ",", "'https'", "=>", "443", ")", ...
Get the final port for build. @return string
[ "Get", "the", "final", "port", "for", "build", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Url/Builder.php#L122-L135
39,192
qa-tools/qa-tools
library/QATools/QATools/PageObject/Url/Builder.php
Builder.unmaskUrl
protected function unmaskUrl($url, array $params) { if ( !preg_match_all('/\{([^{}]+)\}/', $url, $matches) ) { return array($url, $params); } $url_masks = array_unique($matches[0]); $parameter_names = array_unique($matches[1]); $mask_replacements = array(); $missing_parameters = array(); foreach ( $parameter_names as $parameter_name ) { if ( !array_key_exists($parameter_name, $params) ) { $missing_parameters[] = $parameter_name; continue; } $mask_replacements[] = rawurlencode($params[$parameter_name]); unset($params[$parameter_name]); } if ( $missing_parameters ) { throw new MissingParametersException($missing_parameters); } return array(str_replace($url_masks, $mask_replacements, $url), $params); }
php
protected function unmaskUrl($url, array $params) { if ( !preg_match_all('/\{([^{}]+)\}/', $url, $matches) ) { return array($url, $params); } $url_masks = array_unique($matches[0]); $parameter_names = array_unique($matches[1]); $mask_replacements = array(); $missing_parameters = array(); foreach ( $parameter_names as $parameter_name ) { if ( !array_key_exists($parameter_name, $params) ) { $missing_parameters[] = $parameter_name; continue; } $mask_replacements[] = rawurlencode($params[$parameter_name]); unset($params[$parameter_name]); } if ( $missing_parameters ) { throw new MissingParametersException($missing_parameters); } return array(str_replace($url_masks, $mask_replacements, $url), $params); }
[ "protected", "function", "unmaskUrl", "(", "$", "url", ",", "array", "$", "params", ")", "{", "if", "(", "!", "preg_match_all", "(", "'/\\{([^{}]+)\\}/'", ",", "$", "url", ",", "$", "matches", ")", ")", "{", "return", "array", "(", "$", "url", ",", "...
Unmasks a URL and replaces masks with a parameter value. @param string $url URL to be unmasked. @param array $params Params holding values for masks. @return array Returns an array of 0 => unmasked url and 1 => parameters. @throws MissingParametersException Thrown if a mask was found in $url which does not exist in $params.
[ "Unmasks", "a", "URL", "and", "replaces", "masks", "with", "a", "parameter", "value", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Url/Builder.php#L206-L232
39,193
qa-tools/qa-tools
library/QATools/QATools/BEM/PropertyDecorator/BEMPropertyDecorator.php
BEMPropertyDecorator._assertAnnotationUsage
private function _assertAnnotationUsage(array $annotations, IElementLocator $locator) { if ( !$annotations || !($annotations[0] instanceof BEMAnnotation) ) { throw new AnnotationException( 'BEM block/element must be specified as annotation', AnnotationException::TYPE_REQUIRED ); } /** @var BEMAnnotation $annotation */ $annotation = $annotations[0]; if ( ($annotation->element && $annotation->block) || (!$annotation->element && !$annotation->block) ) { throw new AnnotationException( "Either 'block' or 'element' key with non-empty value must be specified in the annotation", AnnotationException::TYPE_INCORRECT_USAGE ); } elseif ( $annotation->element && !($locator->getSearchContext() instanceof IBlock) ) { throw new AnnotationException( 'BEM element can only be used in Block sub-class (or any class, implementing IBlock interface) property', AnnotationException::TYPE_INCORRECT_USAGE ); } elseif ( $annotation->block && !($locator->getSearchContext() instanceof BEMPage) ) { throw new AnnotationException( 'BEM block can only be used in BEMPage sub-class property', AnnotationException::TYPE_INCORRECT_USAGE ); } }
php
private function _assertAnnotationUsage(array $annotations, IElementLocator $locator) { if ( !$annotations || !($annotations[0] instanceof BEMAnnotation) ) { throw new AnnotationException( 'BEM block/element must be specified as annotation', AnnotationException::TYPE_REQUIRED ); } /** @var BEMAnnotation $annotation */ $annotation = $annotations[0]; if ( ($annotation->element && $annotation->block) || (!$annotation->element && !$annotation->block) ) { throw new AnnotationException( "Either 'block' or 'element' key with non-empty value must be specified in the annotation", AnnotationException::TYPE_INCORRECT_USAGE ); } elseif ( $annotation->element && !($locator->getSearchContext() instanceof IBlock) ) { throw new AnnotationException( 'BEM element can only be used in Block sub-class (or any class, implementing IBlock interface) property', AnnotationException::TYPE_INCORRECT_USAGE ); } elseif ( $annotation->block && !($locator->getSearchContext() instanceof BEMPage) ) { throw new AnnotationException( 'BEM block can only be used in BEMPage sub-class property', AnnotationException::TYPE_INCORRECT_USAGE ); } }
[ "private", "function", "_assertAnnotationUsage", "(", "array", "$", "annotations", ",", "IElementLocator", "$", "locator", ")", "{", "if", "(", "!", "$", "annotations", "||", "!", "(", "$", "annotations", "[", "0", "]", "instanceof", "BEMAnnotation", ")", ")...
Verifies, that annotations are being correctly used. @param array $annotations Annotations. @param IElementLocator $locator Locator. @return void @throws AnnotationException When annotation is being used incorrectly.
[ "Verifies", "that", "annotations", "are", "being", "correctly", "used", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/BEM/PropertyDecorator/BEMPropertyDecorator.php#L134-L164
39,194
ikkez/f3-opauth
lib/opauth/Strategy/Github/GithubStrategy.php
GitHubStrategy.user
private function user($access_token) { $user = $this->serverGet('https://api.github.com/user', array('access_token' => $access_token), null, $headers); if (!empty($user)) { return $this->recursiveGetObjectVars(json_decode($user)); } else { $error = array( 'code' => 'userinfo_error', 'message' => 'Failed when attempting to query GitHub v3 API for user information', 'raw' => array( 'response' => $user, 'headers' => $headers ) ); $this->errorCallback($error); } }
php
private function user($access_token) { $user = $this->serverGet('https://api.github.com/user', array('access_token' => $access_token), null, $headers); if (!empty($user)) { return $this->recursiveGetObjectVars(json_decode($user)); } else { $error = array( 'code' => 'userinfo_error', 'message' => 'Failed when attempting to query GitHub v3 API for user information', 'raw' => array( 'response' => $user, 'headers' => $headers ) ); $this->errorCallback($error); } }
[ "private", "function", "user", "(", "$", "access_token", ")", "{", "$", "user", "=", "$", "this", "->", "serverGet", "(", "'https://api.github.com/user'", ",", "array", "(", "'access_token'", "=>", "$", "access_token", ")", ",", "null", ",", "$", "headers", ...
Queries GitHub v3 API for user info @param string $access_token @return array Parsed JSON results
[ "Queries", "GitHub", "v3", "API", "for", "user", "info" ]
2f76ad82507202353de804a6885db8e58ccc6106
https://github.com/ikkez/f3-opauth/blob/2f76ad82507202353de804a6885db8e58ccc6106/lib/opauth/Strategy/Github/GithubStrategy.php#L127-L145
39,195
qa-tools/qa-tools
library/QATools/QATools/PageObject/Url/Parser.php
Parser.getParams
public function getParams() { $ret = array(); $query = $this->getComponent('query'); if ( $query ) { parse_str($query, $ret); } return $ret; }
php
public function getParams() { $ret = array(); $query = $this->getComponent('query'); if ( $query ) { parse_str($query, $ret); } return $ret; }
[ "public", "function", "getParams", "(", ")", "{", "$", "ret", "=", "array", "(", ")", ";", "$", "query", "=", "$", "this", "->", "getComponent", "(", "'query'", ")", ";", "if", "(", "$", "query", ")", "{", "parse_str", "(", "$", "query", ",", "$"...
Gets parsed query. @return array
[ "Gets", "parsed", "query", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Url/Parser.php#L77-L87
39,196
qa-tools/qa-tools
library/QATools/QATools/PageObject/Url/Parser.php
Parser.merge
public function merge(Parser $parser) { $left_path = $this->getComponent('path'); $right_path = $parser->getComponent('path'); $left_params = $this->getParams(); $right_params = $parser->getParams(); $this->components = array_merge($this->components, $parser->components); if ( $left_path && $right_path ) { $this->components['path'] = rtrim($left_path, '/') . '/' . ltrim($right_path, '/'); } if ( $left_params && $right_params ) { $this->components['query'] = http_build_query( array_replace_recursive($left_params, $right_params) ); } return $this; }
php
public function merge(Parser $parser) { $left_path = $this->getComponent('path'); $right_path = $parser->getComponent('path'); $left_params = $this->getParams(); $right_params = $parser->getParams(); $this->components = array_merge($this->components, $parser->components); if ( $left_path && $right_path ) { $this->components['path'] = rtrim($left_path, '/') . '/' . ltrim($right_path, '/'); } if ( $left_params && $right_params ) { $this->components['query'] = http_build_query( array_replace_recursive($left_params, $right_params) ); } return $this; }
[ "public", "function", "merge", "(", "Parser", "$", "parser", ")", "{", "$", "left_path", "=", "$", "this", "->", "getComponent", "(", "'path'", ")", ";", "$", "right_path", "=", "$", "parser", "->", "getComponent", "(", "'path'", ")", ";", "$", "left_p...
Merge both url parsers. @param Parser $parser The url parser to merge. @return self
[ "Merge", "both", "url", "parsers", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Url/Parser.php#L110-L131
39,197
qa-tools/qa-tools
library/QATools/QATools/PageObject/Url/Normalizer.php
Normalizer.normalize
public function normalize(PageUrlAnnotation $annotation) { $parser = new Parser($this->baseUrl); $parser->merge(new Parser($annotation->url)); $parser->setParams(array_merge($parser->getParams(), $annotation->params)); $ret = $parser->getComponents(); if ( $annotation->secure !== null && !empty($ret['scheme']) ) { $ret['scheme'] = $annotation->secure ? 'https' : 'http'; } return $ret; }
php
public function normalize(PageUrlAnnotation $annotation) { $parser = new Parser($this->baseUrl); $parser->merge(new Parser($annotation->url)); $parser->setParams(array_merge($parser->getParams(), $annotation->params)); $ret = $parser->getComponents(); if ( $annotation->secure !== null && !empty($ret['scheme']) ) { $ret['scheme'] = $annotation->secure ? 'https' : 'http'; } return $ret; }
[ "public", "function", "normalize", "(", "PageUrlAnnotation", "$", "annotation", ")", "{", "$", "parser", "=", "new", "Parser", "(", "$", "this", "->", "baseUrl", ")", ";", "$", "parser", "->", "merge", "(", "new", "Parser", "(", "$", "annotation", "->", ...
Returns normalized url. @param PageUrlAnnotation $annotation The page url annotation. @return array
[ "Returns", "normalized", "url", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Url/Normalizer.php#L48-L62
39,198
qa-tools/qa-tools
library/QATools/QATools/PageObject/Annotation/FindByAnnotation.php
FindByAnnotation.getSelector
public function getSelector() { $direct_settings = array( 'className', 'css', 'id', 'linkText', 'name', 'partialLinkText', 'tagName', 'xpath', 'label', ); foreach ( $direct_settings as $direct_setting ) { if ( $this->$direct_setting ) { return array($direct_setting => $this->$direct_setting); } } if ( $this->how && $this->using ) { if ( !in_array($this->how, $direct_settings) ) { throw new AnnotationException( "FindBy annotation expects 'how' to be one of \\QATools\\QATools\\PageObject\\How class constants", AnnotationException::TYPE_INCORRECT_USAGE ); } return array($this->how => $this->using); } throw new AnnotationException( sprintf( "FindBy annotation requires one of '%s' or both 'how' and 'using' parameters specified", implode("', '", $direct_settings) ), AnnotationException::TYPE_INCORRECT_USAGE ); }
php
public function getSelector() { $direct_settings = array( 'className', 'css', 'id', 'linkText', 'name', 'partialLinkText', 'tagName', 'xpath', 'label', ); foreach ( $direct_settings as $direct_setting ) { if ( $this->$direct_setting ) { return array($direct_setting => $this->$direct_setting); } } if ( $this->how && $this->using ) { if ( !in_array($this->how, $direct_settings) ) { throw new AnnotationException( "FindBy annotation expects 'how' to be one of \\QATools\\QATools\\PageObject\\How class constants", AnnotationException::TYPE_INCORRECT_USAGE ); } return array($this->how => $this->using); } throw new AnnotationException( sprintf( "FindBy annotation requires one of '%s' or both 'how' and 'using' parameters specified", implode("', '", $direct_settings) ), AnnotationException::TYPE_INCORRECT_USAGE ); }
[ "public", "function", "getSelector", "(", ")", "{", "$", "direct_settings", "=", "array", "(", "'className'", ",", "'css'", ",", "'id'", ",", "'linkText'", ",", "'name'", ",", "'partialLinkText'", ",", "'tagName'", ",", "'xpath'", ",", "'label'", ",", ")", ...
Returns a selector, created based on annotation parameters. @return array @throws AnnotationException When selector from annotation is incorrectly specified.
[ "Returns", "a", "selector", "created", "based", "on", "annotation", "parameters", "." ]
deebf0113190dd85129e20afa0c42b8afe9cb8d6
https://github.com/qa-tools/qa-tools/blob/deebf0113190dd85129e20afa0c42b8afe9cb8d6/library/QATools/QATools/PageObject/Annotation/FindByAnnotation.php#L113-L143
39,199
bcremer/LineReader
src/LineReader.php
LineReader.readBackwards
private static function readBackwards($fh, int $pos): \Generator { $buffer = null; $bufferSize = 4096; if ($pos === 0) { return; } while (true) { if (isset($buffer[1])) { // faster than count($buffer) > 1 yield array_pop($buffer); continue; } if ($pos === 0) { yield array_pop($buffer); break; } if ($bufferSize > $pos) { $bufferSize = $pos; $pos = 0; } else { $pos -= $bufferSize; } fseek($fh, $pos); $chunk = fread($fh, $bufferSize); if ($buffer === null) { // remove single trailing newline, rtrim cannot be used here if (substr($chunk, -1) === "\n") { $chunk = substr($chunk, 0, -1); } $buffer = explode("\n", $chunk); } else { $buffer = explode("\n", $chunk . $buffer[0]); } } }
php
private static function readBackwards($fh, int $pos): \Generator { $buffer = null; $bufferSize = 4096; if ($pos === 0) { return; } while (true) { if (isset($buffer[1])) { // faster than count($buffer) > 1 yield array_pop($buffer); continue; } if ($pos === 0) { yield array_pop($buffer); break; } if ($bufferSize > $pos) { $bufferSize = $pos; $pos = 0; } else { $pos -= $bufferSize; } fseek($fh, $pos); $chunk = fread($fh, $bufferSize); if ($buffer === null) { // remove single trailing newline, rtrim cannot be used here if (substr($chunk, -1) === "\n") { $chunk = substr($chunk, 0, -1); } $buffer = explode("\n", $chunk); } else { $buffer = explode("\n", $chunk . $buffer[0]); } } }
[ "private", "static", "function", "readBackwards", "(", "$", "fh", ",", "int", "$", "pos", ")", ":", "\\", "Generator", "{", "$", "buffer", "=", "null", ";", "$", "bufferSize", "=", "4096", ";", "if", "(", "$", "pos", "===", "0", ")", "{", "return",...
Read a file from the end using a buffer. This is way more efficient than using the naive method of reading the file backwards byte by byte looking for a newline character. @see http://stackoverflow.com/a/10494801/147634 @param resource $fh @param int $pos @return \Generator
[ "Read", "a", "file", "from", "the", "end", "using", "a", "buffer", "." ]
26dcae426a682413f6bb32b97e83d7539894dad4
https://github.com/bcremer/LineReader/blob/26dcae426a682413f6bb32b97e83d7539894dad4/src/LineReader.php#L67-L105