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
partition
stringclasses
1 value
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
paulbunyannet/bandolier
src/Bandolier/Type/Encoded.php
Encoded.isJson
public static function isJson($string) { if (!is_string($string) || (is_string($string) && substr($string, 0, 1) !== '{' && substr($string, 0, 1) !== '[') ) { return false; } @json_decode($string); return (json_last_error() == JSON_ERROR_NONE); }
php
public static function isJson($string) { if (!is_string($string) || (is_string($string) && substr($string, 0, 1) !== '{' && substr($string, 0, 1) !== '[') ) { return false; } @json_decode($string); return (json_last_error() == JSON_ERROR_NONE); }
[ "public", "static", "function", "isJson", "(", "$", "string", ")", "{", "if", "(", "!", "is_string", "(", "$", "string", ")", "||", "(", "is_string", "(", "$", "string", ")", "&&", "substr", "(", "$", "string", ",", "0", ",", "1", ")", "!==", "'{...
Check if string is json @param $string @return bool
[ "Check", "if", "string", "is", "json" ]
a98cb30bf63a18a7e3fc81418bf561ac36e9cd84
https://github.com/paulbunyannet/bandolier/blob/a98cb30bf63a18a7e3fc81418bf561ac36e9cd84/src/Bandolier/Type/Encoded.php#L98-L108
train
phpgithook/hello-world
src/Hooks/Committer.php
Committer.preCommit
public function preCommit( InputInterface $input, OutputInterface $output, ParameterBagInterface $configuration ): bool { // Here we can fx run phpunit on in the code // Or we can just post something to httpbin // As this module requires guzzle via composer, we can ofcourse utialize it $client = new Client( [ 'base_uri' => 'http://httpbin.org', 'timeout' => 2.0, ] ); $request = new Request('GET', '/'); $promise = $client->sendAsync($request)->then( function (Response $response) use ($output) { $output->writeln('I completed! '.$response->getBody()); return true; } ); return $promise->wait(); }
php
public function preCommit( InputInterface $input, OutputInterface $output, ParameterBagInterface $configuration ): bool { // Here we can fx run phpunit on in the code // Or we can just post something to httpbin // As this module requires guzzle via composer, we can ofcourse utialize it $client = new Client( [ 'base_uri' => 'http://httpbin.org', 'timeout' => 2.0, ] ); $request = new Request('GET', '/'); $promise = $client->sendAsync($request)->then( function (Response $response) use ($output) { $output->writeln('I completed! '.$response->getBody()); return true; } ); return $promise->wait(); }
[ "public", "function", "preCommit", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ",", "ParameterBagInterface", "$", "configuration", ")", ":", "bool", "{", "// Here we can fx run phpunit on in the code", "// Or we can just post something to httpb...
This hook is called before obtaining the proposed commit message. Returning false will abort the commit. It is used to check the commit itself (rather than the message). @param InputInterface $input @param OutputInterface $output @param ParameterBagInterface $configuration @return bool
[ "This", "hook", "is", "called", "before", "obtaining", "the", "proposed", "commit", "message", "." ]
c01e5d57b24f5b4823c4007127d8fdf401f2f7da
https://github.com/phpgithook/hello-world/blob/c01e5d57b24f5b4823c4007127d8fdf401f2f7da/src/Hooks/Committer.php#L30-L55
train
cmsgears/module-core
common/components/Factory.php
Factory.registerMapperAliases
public function registerMapperAliases() { $factory = Yii::$app->factory->getContainer(); $factory->set( 'modelAddressService', 'cmsgears\core\common\services\mappers\ModelAddressService' ); $factory->set( 'modelLocationService', 'cmsgears\core\common\services\mappers\ModelLocationService' ); $factory->set( 'modelCategoryService', 'cmsgears\core\common\services\mappers\ModelCategoryService' ); $factory->set( 'modelFileService', 'cmsgears\core\common\services\mappers\ModelFileService' ); $factory->set( 'modelFormService', 'cmsgears\core\common\services\mappers\ModelFormService' ); $factory->set( 'modelGalleryService', 'cmsgears\core\common\services\mappers\ModelGalleryService' ); $factory->set( 'modelObjectService', 'cmsgears\core\common\services\mappers\ModelObjectService' ); $factory->set( 'modelOptionService', 'cmsgears\core\common\services\mappers\ModelOptionService' ); $factory->set( 'modelTagService', 'cmsgears\core\common\services\mappers\ModelTagService' ); $factory->set( 'siteMemberService', 'cmsgears\core\common\services\mappers\SiteMemberService' ); }
php
public function registerMapperAliases() { $factory = Yii::$app->factory->getContainer(); $factory->set( 'modelAddressService', 'cmsgears\core\common\services\mappers\ModelAddressService' ); $factory->set( 'modelLocationService', 'cmsgears\core\common\services\mappers\ModelLocationService' ); $factory->set( 'modelCategoryService', 'cmsgears\core\common\services\mappers\ModelCategoryService' ); $factory->set( 'modelFileService', 'cmsgears\core\common\services\mappers\ModelFileService' ); $factory->set( 'modelFormService', 'cmsgears\core\common\services\mappers\ModelFormService' ); $factory->set( 'modelGalleryService', 'cmsgears\core\common\services\mappers\ModelGalleryService' ); $factory->set( 'modelObjectService', 'cmsgears\core\common\services\mappers\ModelObjectService' ); $factory->set( 'modelOptionService', 'cmsgears\core\common\services\mappers\ModelOptionService' ); $factory->set( 'modelTagService', 'cmsgears\core\common\services\mappers\ModelTagService' ); $factory->set( 'siteMemberService', 'cmsgears\core\common\services\mappers\SiteMemberService' ); }
[ "public", "function", "registerMapperAliases", "(", ")", "{", "$", "factory", "=", "Yii", "::", "$", "app", "->", "factory", "->", "getContainer", "(", ")", ";", "$", "factory", "->", "set", "(", "'modelAddressService'", ",", "'cmsgears\\core\\common\\services\\...
Registers mapper aliases.
[ "Registers", "mapper", "aliases", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/components/Factory.php#L175-L189
train
GrupaZero/admin
src/Gzero/Admin/ModuleRegistry.php
ModuleRegistry.register
public function register($name, $path) { if (!Str::contains($path, '.js')) { throw new \Exception('Path should lead to javascript file'); } $this->modules->push(compact('name', 'path')); }
php
public function register($name, $path) { if (!Str::contains($path, '.js')) { throw new \Exception('Path should lead to javascript file'); } $this->modules->push(compact('name', 'path')); }
[ "public", "function", "register", "(", "$", "name", ",", "$", "path", ")", "{", "if", "(", "!", "Str", "::", "contains", "(", "$", "path", ",", "'.js'", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'Path should lead to javascript file'", ")", ...
Returning new admin modules @param string $name AngularJS module name @param string $path Path to AngularJS module file @throws \Exception
[ "Returning", "new", "admin", "modules" ]
3463d2f9fec1bd11778d10d6763c6d8c46e23915
https://github.com/GrupaZero/admin/blob/3463d2f9fec1bd11778d10d6763c6d8c46e23915/src/Gzero/Admin/ModuleRegistry.php#L38-L44
train
locomotivemtl/charcoal-property
src/Charcoal/Property/SpriteProperty.php
SpriteProperty.setData
public function setData(array $data) { parent::setData($data); $this->setChoices($this->buildChoicesFromSprite()); return $this; }
php
public function setData(array $data) { parent::setData($data); $this->setChoices($this->buildChoicesFromSprite()); return $this; }
[ "public", "function", "setData", "(", "array", "$", "data", ")", "{", "parent", "::", "setData", "(", "$", "data", ")", ";", "$", "this", "->", "setChoices", "(", "$", "this", "->", "buildChoicesFromSprite", "(", ")", ")", ";", "return", "$", "this", ...
Sets data on this entity. @uses self::offsetSet() @param array $data Key-value array of data to append. @return self
[ "Sets", "data", "on", "this", "entity", "." ]
5ff339a0edb78a909537a9d2bb7f9b783255316b
https://github.com/locomotivemtl/charcoal-property/blob/5ff339a0edb78a909537a9d2bb7f9b783255316b/src/Charcoal/Property/SpriteProperty.php#L53-L60
train
locomotivemtl/charcoal-cache
src/Charcoal/Cache/Facade/CachePoolFacade.php
CachePoolFacade.get
public function get($key, callable $resolve = null, $ttl = null) { $pool = $this->cachePool(); $item = $pool->getItem($key); $data = $item->get(); if ($item->isHit()) { return $data; } if (is_callable($resolve)) { $data = $resolve($data, $item); $this->save($item, $data, $ttl); return $data; } return null; }
php
public function get($key, callable $resolve = null, $ttl = null) { $pool = $this->cachePool(); $item = $pool->getItem($key); $data = $item->get(); if ($item->isHit()) { return $data; } if (is_callable($resolve)) { $data = $resolve($data, $item); $this->save($item, $data, $ttl); return $data; } return null; }
[ "public", "function", "get", "(", "$", "key", ",", "callable", "$", "resolve", "=", "null", ",", "$", "ttl", "=", "null", ")", "{", "$", "pool", "=", "$", "this", "->", "cachePool", "(", ")", ";", "$", "item", "=", "$", "pool", "->", "getItem", ...
Retrieve the value associated with the specified key from the pool. This method will call $lambada if the cache item representing $key resulted in a cache miss. @param string $key The key for which to return the associated value. @param callable|null $resolve The function to execute if the cached value does not exist or is considered expired. The function must return a value which will be stored in the cache before being returned by the method. ``` $resolve ( mixed $data, CacheItemInterface $item ) : mixed ``` The $resolve takes on two parameters: 1. The expired value or NULL if no value was stored. 2. The cache item of the specified key. @param mixed $ttl An integer, interval, date, or NULL to use the facade's default value. @return mixed The value corresponding to this cache item's $key, or NULL if not found.
[ "Retrieve", "the", "value", "associated", "with", "the", "specified", "key", "from", "the", "pool", "." ]
38d04f6f21c6a826c28e08a5ac48b02c37e8da85
https://github.com/locomotivemtl/charcoal-cache/blob/38d04f6f21c6a826c28e08a5ac48b02c37e8da85/src/Charcoal/Cache/Facade/CachePoolFacade.php#L65-L82
train
locomotivemtl/charcoal-cache
src/Charcoal/Cache/Facade/CachePoolFacade.php
CachePoolFacade.save
protected function save(CacheItemInterface $item, $value, $ttl = null) { if ($ttl === null) { $ttl = $this->defaultTtl(); } if (is_numeric($ttl) || ($ttl instanceof \DateInterval)) { $item->expiresAfter($ttl); } elseif ($ttl instanceof \DateTimeInterface) { $item->expiresAt($ttl); } $item->set($value); return $this->cachePool()->save($item); }
php
protected function save(CacheItemInterface $item, $value, $ttl = null) { if ($ttl === null) { $ttl = $this->defaultTtl(); } if (is_numeric($ttl) || ($ttl instanceof \DateInterval)) { $item->expiresAfter($ttl); } elseif ($ttl instanceof \DateTimeInterface) { $item->expiresAt($ttl); } $item->set($value); return $this->cachePool()->save($item); }
[ "protected", "function", "save", "(", "CacheItemInterface", "$", "item", ",", "$", "value", ",", "$", "ttl", "=", "null", ")", "{", "if", "(", "$", "ttl", "===", "null", ")", "{", "$", "ttl", "=", "$", "this", "->", "defaultTtl", "(", ")", ";", "...
Set a value on a cache item to be saved immediately. @param CacheItemInterface $item The cache item to save. @param mixed $value The serializable value to be stored. @param mixed $ttl An integer, interval, date, or NULL to use the facade's default value. @return boolean TRUE if the item was successfully persisted. FALSE if there was an error.
[ "Set", "a", "value", "on", "a", "cache", "item", "to", "be", "saved", "immediately", "." ]
38d04f6f21c6a826c28e08a5ac48b02c37e8da85
https://github.com/locomotivemtl/charcoal-cache/blob/38d04f6f21c6a826c28e08a5ac48b02c37e8da85/src/Charcoal/Cache/Facade/CachePoolFacade.php#L118-L133
train
locomotivemtl/charcoal-cache
src/Charcoal/Cache/Facade/CachePoolFacade.php
CachePoolFacade.delete
public function delete(...$keys) { $pool = $this->cachePool(); $results = true; foreach ($keys as $key) { $results = $pool->deleteItem($key) && $results; } return $results; }
php
public function delete(...$keys) { $pool = $this->cachePool(); $results = true; foreach ($keys as $key) { $results = $pool->deleteItem($key) && $results; } return $results; }
[ "public", "function", "delete", "(", "...", "$", "keys", ")", "{", "$", "pool", "=", "$", "this", "->", "cachePool", "(", ")", ";", "$", "results", "=", "true", ";", "foreach", "(", "$", "keys", "as", "$", "key", ")", "{", "$", "results", "=", ...
Removes one or more items from the pool. @param string[] ...$keys One or many keys to delete. @return bool TRUE if the item was successfully removed. FALSE if there was an error.
[ "Removes", "one", "or", "more", "items", "from", "the", "pool", "." ]
38d04f6f21c6a826c28e08a5ac48b02c37e8da85
https://github.com/locomotivemtl/charcoal-cache/blob/38d04f6f21c6a826c28e08a5ac48b02c37e8da85/src/Charcoal/Cache/Facade/CachePoolFacade.php#L141-L151
train
mcaskill/charcoal-support
src/App/Routing/RouteRedirectionManager.php
RouteRedirectionManager.setupRoutes
public function setupRoutes() { foreach ($this->paths as $oldPath => &$newPath) { $this->addRedirection($oldPath, $newPath); } }
php
public function setupRoutes() { foreach ($this->paths as $oldPath => &$newPath) { $this->addRedirection($oldPath, $newPath); } }
[ "public", "function", "setupRoutes", "(", ")", "{", "foreach", "(", "$", "this", "->", "paths", "as", "$", "oldPath", "=>", "&", "$", "newPath", ")", "{", "$", "this", "->", "addRedirection", "(", "$", "oldPath", ",", "$", "newPath", ")", ";", "}", ...
Setup Route Redirections @return void
[ "Setup", "Route", "Redirections" ]
2138a34463ca6865bf3a60635aa11381a9ae73c5
https://github.com/mcaskill/charcoal-support/blob/2138a34463ca6865bf3a60635aa11381a9ae73c5/src/App/Routing/RouteRedirectionManager.php#L93-L98
train
mcaskill/charcoal-support
src/App/Routing/RouteRedirectionManager.php
RouteRedirectionManager.addRedirection
public function addRedirection($oldPath, $newPath) { if (!is_string($oldPath) && !($oldPath instanceof UriInterface)) { throw new InvalidArgumentException( 'The deprecated path must be a string; received %s', (is_object($oldPath) ? get_class($oldPath) : gettype($oldPath)) ); } $newPath = $this->parseRoute($newPath); $this->paths[$oldPath] = $newPath; $this->app()->map( $newPath['methods'], $oldPath, function ( RequestInterface $request, ResponseInterface $response, array $args = [] ) use ( $newPath ) { if ($newPath['route'] === 404) { return $response->withStatus(404); } $locale = isset($args['lang']) ? $args['lang'] : null; if ($newPath['data_key'] === null) { if (is_array($newPath['route'])) { $route = $this->translator()->translate($newPath['route'], [], null, $locale); if ($route !== null) { $newPath['route'] = $route; } else { $newPath['route'] = reset($newPath['route']); } } return $response->withRedirect($newPath['route'], $newPath['status']); } if (!isset($newPath['ident'])) { return $response->withStatus(404); } if (!empty($newPath[$newPath['data_key']])) { $args = array_merge($newPath[$newPath['data_key']], $args); } $router = $this->get('router'); if (isset($newPath[$newPath['data_key']]['route_endpoint'])) { $endpoint = $this->translator()->translate( $newPath[$newPath['data_key']]['route_endpoint'], [], null, $locale ); $args['route_endpoint'] = $endpoint; } $uri = $router->pathFor($newPath['ident'], $args); return $response->withRedirect($uri, $newPath['status']); } ); }
php
public function addRedirection($oldPath, $newPath) { if (!is_string($oldPath) && !($oldPath instanceof UriInterface)) { throw new InvalidArgumentException( 'The deprecated path must be a string; received %s', (is_object($oldPath) ? get_class($oldPath) : gettype($oldPath)) ); } $newPath = $this->parseRoute($newPath); $this->paths[$oldPath] = $newPath; $this->app()->map( $newPath['methods'], $oldPath, function ( RequestInterface $request, ResponseInterface $response, array $args = [] ) use ( $newPath ) { if ($newPath['route'] === 404) { return $response->withStatus(404); } $locale = isset($args['lang']) ? $args['lang'] : null; if ($newPath['data_key'] === null) { if (is_array($newPath['route'])) { $route = $this->translator()->translate($newPath['route'], [], null, $locale); if ($route !== null) { $newPath['route'] = $route; } else { $newPath['route'] = reset($newPath['route']); } } return $response->withRedirect($newPath['route'], $newPath['status']); } if (!isset($newPath['ident'])) { return $response->withStatus(404); } if (!empty($newPath[$newPath['data_key']])) { $args = array_merge($newPath[$newPath['data_key']], $args); } $router = $this->get('router'); if (isset($newPath[$newPath['data_key']]['route_endpoint'])) { $endpoint = $this->translator()->translate( $newPath[$newPath['data_key']]['route_endpoint'], [], null, $locale ); $args['route_endpoint'] = $endpoint; } $uri = $router->pathFor($newPath['ident'], $args); return $response->withRedirect($uri, $newPath['status']); } ); }
[ "public", "function", "addRedirection", "(", "$", "oldPath", ",", "$", "newPath", ")", "{", "if", "(", "!", "is_string", "(", "$", "oldPath", ")", "&&", "!", "(", "$", "oldPath", "instanceof", "UriInterface", ")", ")", "{", "throw", "new", "InvalidArgume...
Add a redirection. Accepted formats for $paths: **Format #1 — Basic Usage** The "new-path" can be a URI or a named {@see \Slim\Route}. ``` [ 'old-path' => 'new-path' ] ``` **Format #2 — Redirect to front page** ``` [ 'old-path' => [] ] ``` **Format #2 — Custom HTTP status code** ``` [ 'old-path' => [ 'route' => 'new-path', 'status' => 301 ] ] ``` **Format #3 — Verbose redirection** The target URI or route can be multilingual. ``` [ 'old-path' => [ 'route' => [ 'en' => '/fr/new-path' 'es' => '/es/nueva-ruta' 'fr' => '/fr/nouveau-chemin' ], 'route_type' => 'templates', 'status' => 301 ] ] ``` @todo Add support for explicit {@see \Slim\Route}. @param string $oldPath The path to watch for and redirect to $newPath. @param mixed $newPath The destination for $oldPath. @throws InvalidArgumentException If the path is not a string. @return void
[ "Add", "a", "redirection", "." ]
2138a34463ca6865bf3a60635aa11381a9ae73c5
https://github.com/mcaskill/charcoal-support/blob/2138a34463ca6865bf3a60635aa11381a9ae73c5/src/App/Routing/RouteRedirectionManager.php#L156-L222
train
cmsgears/module-core
common/models/base/ActiveRecord.php
ActiveRecord.copyForUpdateTo
public function copyForUpdateTo( $model, $attributes = [] ) { foreach ( $attributes as $attribute ) { $model->setAttribute( $attribute, $this->getAttribute( $attribute ) ); } }
php
public function copyForUpdateTo( $model, $attributes = [] ) { foreach ( $attributes as $attribute ) { $model->setAttribute( $attribute, $this->getAttribute( $attribute ) ); } }
[ "public", "function", "copyForUpdateTo", "(", "$", "model", ",", "$", "attributes", "=", "[", "]", ")", "{", "foreach", "(", "$", "attributes", "as", "$", "attribute", ")", "{", "$", "model", "->", "setAttribute", "(", "$", "attribute", ",", "$", "this...
Copy attributes to update a model for selected columns to target model. @param ActiveRecord $model Target Model to which attributes will be copied.
[ "Copy", "attributes", "to", "update", "a", "model", "for", "selected", "columns", "to", "target", "model", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/base/ActiveRecord.php#L124-L130
train
cmsgears/module-core
common/models/base/ActiveRecord.php
ActiveRecord.copyForUpdateFrom
public function copyForUpdateFrom( $model, $attributes = [] ) { foreach ( $attributes as $attribute ) { if( $this->hasAttribute( $attribute ) ) { $this->setAttribute( $attribute, $model->$attribute ); } else { $this->$attribute = $model->$attribute; } } }
php
public function copyForUpdateFrom( $model, $attributes = [] ) { foreach ( $attributes as $attribute ) { if( $this->hasAttribute( $attribute ) ) { $this->setAttribute( $attribute, $model->$attribute ); } else { $this->$attribute = $model->$attribute; } } }
[ "public", "function", "copyForUpdateFrom", "(", "$", "model", ",", "$", "attributes", "=", "[", "]", ")", "{", "foreach", "(", "$", "attributes", "as", "$", "attribute", ")", "{", "if", "(", "$", "this", "->", "hasAttribute", "(", "$", "attribute", ")"...
Copy attributes to update a model for selected columns from target model. @param ActiveRecord $model Source Model from which attributes will be copied.
[ "Copy", "attributes", "to", "update", "a", "model", "for", "selected", "columns", "from", "target", "model", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/base/ActiveRecord.php#L137-L150
train
cmsgears/module-core
common/models/base/ActiveRecord.php
ActiveRecord.getMediumText
public function getMediumText( $text ) { if( strlen( $text ) > Yii::$app->core->mediumText ) { $text = substr( $text, 0, Yii::$app->core->mediumText ); } return HtmlPurifier::process( $text ); }
php
public function getMediumText( $text ) { if( strlen( $text ) > Yii::$app->core->mediumText ) { $text = substr( $text, 0, Yii::$app->core->mediumText ); } return HtmlPurifier::process( $text ); }
[ "public", "function", "getMediumText", "(", "$", "text", ")", "{", "if", "(", "strlen", "(", "$", "text", ")", ">", "Yii", "::", "$", "app", "->", "core", "->", "mediumText", ")", "{", "$", "text", "=", "substr", "(", "$", "text", ",", "0", ",", ...
Returns cut down string having pre-defined medium length. [[\cmsgears\core\common\config\CoreGlobal\CoreGlobal::TEXT_MEDIUM]] will be used by default in case application property does not override it. @param string $text to be cut down. @return string the cut down text.
[ "Returns", "cut", "down", "string", "having", "pre", "-", "defined", "medium", "length", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/base/ActiveRecord.php#L161-L169
train
cmsgears/module-core
common/models/base/ActiveRecord.php
ActiveRecord.queryWithAll
public static function queryWithAll( $config = [] ) { // Query Config -------- $query = static::find(); $relations = isset( $config[ 'relations' ] ) ? $config[ 'relations' ] : []; $conditions = isset( $config[ 'conditions' ] ) ? $config[ 'conditions' ] : null; $filters = isset( $config[ 'filters' ] ) ? $config[ 'filters' ] : null; $groups = isset( $config[ 'groups' ] ) ? $config[ 'groups' ] : null; // Relations ----------- $eager = false; $join = 'LEFT JOIN'; foreach ( $relations as $relation ) { if( is_array( $relation ) && isset( $relation[ 'relation' ] ) ) { $eager = isset( $relation[ 'eager' ] ) ? $relation[ 'eager' ] : false; $join = isset( $relation[ 'join' ] ) ? $relation[ 'join' ] : 'LEFT JOIN'; $query->joinWith( $relation[ 'relation' ], $eager, $join ); } else { $query->joinWith( $relation ); } } // Conditions ---------- if( isset( $conditions ) ) { foreach ( $conditions as $ckey => $condition ) { if( is_numeric( $ckey ) ) { $query->andWhere( $condition ); unset( $conditions[ $ckey ] ); } } $query->andWhere( $conditions ); } // Filters ------------- if( isset( $filters ) ) { foreach ( $filters as $filter ) { $query = $query->andFilterWhere( $filter ); } } // Grouping ------------- if( isset( $groups ) ) { foreach ( $groups as $group ) { $query = $query->groupBy( $group ); } } $ignoreSite = isset( $config[ 'ignoreSite' ] ) ? $config[ 'ignoreSite' ] : false; if( static::isMultiSite() && !$ignoreSite ) { $siteId = isset( $config[ 'siteId' ] ) ? $config[ 'siteId' ] : Yii::$app->core->siteId; $modelTable = static::tableName(); $query = $query->andWhere( "$modelTable.siteId=:siteId", [ ':siteId' => $siteId ] ); } return $query; }
php
public static function queryWithAll( $config = [] ) { // Query Config -------- $query = static::find(); $relations = isset( $config[ 'relations' ] ) ? $config[ 'relations' ] : []; $conditions = isset( $config[ 'conditions' ] ) ? $config[ 'conditions' ] : null; $filters = isset( $config[ 'filters' ] ) ? $config[ 'filters' ] : null; $groups = isset( $config[ 'groups' ] ) ? $config[ 'groups' ] : null; // Relations ----------- $eager = false; $join = 'LEFT JOIN'; foreach ( $relations as $relation ) { if( is_array( $relation ) && isset( $relation[ 'relation' ] ) ) { $eager = isset( $relation[ 'eager' ] ) ? $relation[ 'eager' ] : false; $join = isset( $relation[ 'join' ] ) ? $relation[ 'join' ] : 'LEFT JOIN'; $query->joinWith( $relation[ 'relation' ], $eager, $join ); } else { $query->joinWith( $relation ); } } // Conditions ---------- if( isset( $conditions ) ) { foreach ( $conditions as $ckey => $condition ) { if( is_numeric( $ckey ) ) { $query->andWhere( $condition ); unset( $conditions[ $ckey ] ); } } $query->andWhere( $conditions ); } // Filters ------------- if( isset( $filters ) ) { foreach ( $filters as $filter ) { $query = $query->andFilterWhere( $filter ); } } // Grouping ------------- if( isset( $groups ) ) { foreach ( $groups as $group ) { $query = $query->groupBy( $group ); } } $ignoreSite = isset( $config[ 'ignoreSite' ] ) ? $config[ 'ignoreSite' ] : false; if( static::isMultiSite() && !$ignoreSite ) { $siteId = isset( $config[ 'siteId' ] ) ? $config[ 'siteId' ] : Yii::$app->core->siteId; $modelTable = static::tableName(); $query = $query->andWhere( "$modelTable.siteId=:siteId", [ ':siteId' => $siteId ] ); } return $query; }
[ "public", "static", "function", "queryWithAll", "(", "$", "config", "=", "[", "]", ")", "{", "// Query Config --------", "$", "query", "=", "static", "::", "find", "(", ")", ";", "$", "relations", "=", "isset", "(", "$", "config", "[", "'relations'", "]"...
Generates and return query with model relations. * Relations - The relations are method name without get prefix of methods returning query generated by one-to-one(hasOne) or one-to-many(hasMany) called within the method. * Conditions - Conditions to be applied to further filter the results of query generated after applying all the relations. * Filters - Filters applied on top of conditions to further filter the results. * Groups - Group By Column applied on the query generate after applying all the relations, conditions and filters. The final query generated by this method will be returned to generate results. @param array $config query configurations. @return \yii\db\ActiveQuery to query with related models.
[ "Generates", "and", "return", "query", "with", "model", "relations", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/base/ActiveRecord.php#L229-L309
train
ec-europa/oe-robo
src/Tasks.php
Tasks.projectInstallConfig
public function projectInstallConfig() { $this->getInstallTask() ->arg('config_installer_sync_configure_form.sync_directory=' . $this->config('settings.config_directories.sync')) ->siteInstall('config_installer') ->run(); $this->projectSetupSettings(); }
php
public function projectInstallConfig() { $this->getInstallTask() ->arg('config_installer_sync_configure_form.sync_directory=' . $this->config('settings.config_directories.sync')) ->siteInstall('config_installer') ->run(); $this->projectSetupSettings(); }
[ "public", "function", "projectInstallConfig", "(", ")", "{", "$", "this", "->", "getInstallTask", "(", ")", "->", "arg", "(", "'config_installer_sync_configure_form.sync_directory='", ".", "$", "this", "->", "config", "(", "'settings.config_directories.sync'", ")", ")...
Install site from given configuration. @command project:install-config @aliases pic
[ "Install", "site", "from", "given", "configuration", "." ]
ad60ad28fcd4d5afdfee0c7cbeeb245f8bc0ea02
https://github.com/ec-europa/oe-robo/blob/ad60ad28fcd4d5afdfee0c7cbeeb245f8bc0ea02/src/Tasks.php#L51-L57
train
ec-europa/oe-robo
src/Tasks.php
Tasks.projectSetupSettings
public function projectSetupSettings() { $settings_file = $this->root() . '/build/sites/default/settings.php'; $processor = new SettingsProcessor(Robo::config()); $content = $processor->process($settings_file); $this->collectionBuilder()->addTaskList([ $this->taskFilesystemStack()->chmod('build/sites', 0775, 0000, TRUE), $this->taskWriteToFile($settings_file)->text($content), ])->run(); }
php
public function projectSetupSettings() { $settings_file = $this->root() . '/build/sites/default/settings.php'; $processor = new SettingsProcessor(Robo::config()); $content = $processor->process($settings_file); $this->collectionBuilder()->addTaskList([ $this->taskFilesystemStack()->chmod('build/sites', 0775, 0000, TRUE), $this->taskWriteToFile($settings_file)->text($content), ])->run(); }
[ "public", "function", "projectSetupSettings", "(", ")", "{", "$", "settings_file", "=", "$", "this", "->", "root", "(", ")", ".", "'/build/sites/default/settings.php'", ";", "$", "processor", "=", "new", "SettingsProcessor", "(", "Robo", "::", "config", "(", "...
Setup Drupal settings. @command project:setup-settings @aliases pss
[ "Setup", "Drupal", "settings", "." ]
ad60ad28fcd4d5afdfee0c7cbeeb245f8bc0ea02
https://github.com/ec-europa/oe-robo/blob/ad60ad28fcd4d5afdfee0c7cbeeb245f8bc0ea02/src/Tasks.php#L65-L73
train
ec-europa/oe-robo
src/Tasks.php
Tasks.getInstallTask
protected function getInstallTask() { return $this->taskDrushStack($this->config('bin.drush')) ->arg("--root={$this->root()}/build") ->siteName($this->config('site.name')) ->siteMail($this->config('site.mail')) ->locale($this->config('site.locale')) ->accountMail($this->config('account.mail')) ->accountName($this->config('account.name')) ->accountPass($this->config('account.password')) ->dbPrefix($this->config('database.prefix')) ->dbUrl(sprintf("mysql://%s:%s@%s:%s/%s", $this->config('database.user'), $this->config('database.password'), $this->config('database.host'), $this->config('database.port'), $this->config('database.name'))); }
php
protected function getInstallTask() { return $this->taskDrushStack($this->config('bin.drush')) ->arg("--root={$this->root()}/build") ->siteName($this->config('site.name')) ->siteMail($this->config('site.mail')) ->locale($this->config('site.locale')) ->accountMail($this->config('account.mail')) ->accountName($this->config('account.name')) ->accountPass($this->config('account.password')) ->dbPrefix($this->config('database.prefix')) ->dbUrl(sprintf("mysql://%s:%s@%s:%s/%s", $this->config('database.user'), $this->config('database.password'), $this->config('database.host'), $this->config('database.port'), $this->config('database.name'))); }
[ "protected", "function", "getInstallTask", "(", ")", "{", "return", "$", "this", "->", "taskDrushStack", "(", "$", "this", "->", "config", "(", "'bin.drush'", ")", ")", "->", "arg", "(", "\"--root={$this->root()}/build\"", ")", "->", "siteName", "(", "$", "t...
Get installation task. @return \Boedah\Robo\Task\Drush\DrushStack Drush installation task.
[ "Get", "installation", "task", "." ]
ad60ad28fcd4d5afdfee0c7cbeeb245f8bc0ea02
https://github.com/ec-europa/oe-robo/blob/ad60ad28fcd4d5afdfee0c7cbeeb245f8bc0ea02/src/Tasks.php#L81-L97
train
mcaskill/charcoal-support
src/Property/ManufacturablePropertyInputTrait.php
ManufacturablePropertyInputTrait.propertyInputFactory
public function propertyInputFactory() { if (!isset($this->propertyInputFactory)) { throw new RuntimeException(sprintf( 'Property Control Factory is not defined for [%s]', get_class($this) )); } return $this->propertyInputFactory; }
php
public function propertyInputFactory() { if (!isset($this->propertyInputFactory)) { throw new RuntimeException(sprintf( 'Property Control Factory is not defined for [%s]', get_class($this) )); } return $this->propertyInputFactory; }
[ "public", "function", "propertyInputFactory", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "propertyInputFactory", ")", ")", "{", "throw", "new", "RuntimeException", "(", "sprintf", "(", "'Property Control Factory is not defined for [%s]'", ",", ...
Retrieve the property control factory. @throws RuntimeException If the property control factory is missing. @return FactoryInterface
[ "Retrieve", "the", "property", "control", "factory", "." ]
2138a34463ca6865bf3a60635aa11381a9ae73c5
https://github.com/mcaskill/charcoal-support/blob/2138a34463ca6865bf3a60635aa11381a9ae73c5/src/Property/ManufacturablePropertyInputTrait.php#L39-L49
train
phPoirot/Std
src/tValidator.php
tValidator.assertValidate
final function assertValidate() { $exceptions = $this->doAssertValidate(); if (!is_array($exceptions)) throw new \RuntimeException(sprintf( 'Unknown Validation Assertion Value Of Type Array (%s).' , flatten($exceptions) )); if ( empty($exceptions) ) return; // Chain Exception: // TODO what if assertValidator or exceptions list has \Exception instance instead of exUnexpected $_f__chainExceptions = function (exUnexpectedValue $ex, &$list) use (&$_f__chainExceptions) { if ( empty($list) ) return $ex; /** @var exUnexpectedValue $exception */ $exception = array_pop($list); $r = new exUnexpectedValue( $exception->getMessage() , $exception->getParameterName() , $exception->getError() , $_f__chainExceptions($ex, $list) ); return $r; }; $ex = $_f__chainExceptions(new exUnexpectedValue('Validation Error', null), $exceptions); throw $ex; }
php
final function assertValidate() { $exceptions = $this->doAssertValidate(); if (!is_array($exceptions)) throw new \RuntimeException(sprintf( 'Unknown Validation Assertion Value Of Type Array (%s).' , flatten($exceptions) )); if ( empty($exceptions) ) return; // Chain Exception: // TODO what if assertValidator or exceptions list has \Exception instance instead of exUnexpected $_f__chainExceptions = function (exUnexpectedValue $ex, &$list) use (&$_f__chainExceptions) { if ( empty($list) ) return $ex; /** @var exUnexpectedValue $exception */ $exception = array_pop($list); $r = new exUnexpectedValue( $exception->getMessage() , $exception->getParameterName() , $exception->getError() , $_f__chainExceptions($ex, $list) ); return $r; }; $ex = $_f__chainExceptions(new exUnexpectedValue('Validation Error', null), $exceptions); throw $ex; }
[ "final", "function", "assertValidate", "(", ")", "{", "$", "exceptions", "=", "$", "this", "->", "doAssertValidate", "(", ")", ";", "if", "(", "!", "is_array", "(", "$", "exceptions", ")", ")", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(...
Assert Validate Entity @throws exUnexpectedValue
[ "Assert", "Validate", "Entity" ]
67883b1b1dd2cea80fec3d98a199c403b8a23b4d
https://github.com/phPoirot/Std/blob/67883b1b1dd2cea80fec3d98a199c403b8a23b4d/src/tValidator.php#L22-L59
train
datalaere/php-auth-framework
src/Auth.php
Auth.login
public function login($usernameOrEmail = null, $password = null, $remember = false) { if (!$this->isLoggedIn()) { $user = $this->search($usernameOrEmail); if ($user) { if (Password::verify($password, $this->data()->Password)) { // password is correct start a user session $this->startSession(); if ($remember) { $hash = Token::create(46); $hashCheck = $this->db->select( array('User_ID'), $this->sessions, null, array(array('User_ID', '=', $this->data()->ID)), array('LIMIT' => 1) ); if (!$hashCheck->count()) { $this->db->insert($this->sessions, array( 'User_ID' => $this->data()->ID, 'Token' => $hash )); } Cookie::set($this->cookieName, $hash, $this->cookieExpiry); } return true; } } } return false; }
php
public function login($usernameOrEmail = null, $password = null, $remember = false) { if (!$this->isLoggedIn()) { $user = $this->search($usernameOrEmail); if ($user) { if (Password::verify($password, $this->data()->Password)) { // password is correct start a user session $this->startSession(); if ($remember) { $hash = Token::create(46); $hashCheck = $this->db->select( array('User_ID'), $this->sessions, null, array(array('User_ID', '=', $this->data()->ID)), array('LIMIT' => 1) ); if (!$hashCheck->count()) { $this->db->insert($this->sessions, array( 'User_ID' => $this->data()->ID, 'Token' => $hash )); } Cookie::set($this->cookieName, $hash, $this->cookieExpiry); } return true; } } } return false; }
[ "public", "function", "login", "(", "$", "usernameOrEmail", "=", "null", ",", "$", "password", "=", "null", ",", "$", "remember", "=", "false", ")", "{", "if", "(", "!", "$", "this", "->", "isLoggedIn", "(", ")", ")", "{", "$", "user", "=", "$", ...
Log users in
[ "Log", "users", "in" ]
742420ffff35988556a951228172bf9418a03e28
https://github.com/datalaere/php-auth-framework/blob/742420ffff35988556a951228172bf9418a03e28/src/Auth.php#L122-L157
train
phpgithook/hello-world
src/Hooks/PrePush.php
PrePush.prePush
public function prePush(string $destinationName, string $destinationLocation, InputInterface $input, OutputInterface $output, ParameterBagInterface $configuration): bool { if ('Fail' === $destinationName) { return false; } // We can write to the console, with data we got $output->writeln([ 'Destination is: '.$destinationName, 'Location is: '.$destinationLocation, ]); return true; }
php
public function prePush(string $destinationName, string $destinationLocation, InputInterface $input, OutputInterface $output, ParameterBagInterface $configuration): bool { if ('Fail' === $destinationName) { return false; } // We can write to the console, with data we got $output->writeln([ 'Destination is: '.$destinationName, 'Location is: '.$destinationLocation, ]); return true; }
[ "public", "function", "prePush", "(", "string", "$", "destinationName", ",", "string", "$", "destinationLocation", ",", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ",", "ParameterBagInterface", "$", "configuration", ")", ":", "bool", "{"...
Called prior to a push to a remote. Returning false aborts the push. @param string $destinationName Git remote name @param string $destinationLocation Git remote uri @param InputInterface $input @param OutputInterface $output @param ParameterBagInterface $configuration @return bool
[ "Called", "prior", "to", "a", "push", "to", "a", "remote", "." ]
c01e5d57b24f5b4823c4007127d8fdf401f2f7da
https://github.com/phpgithook/hello-world/blob/c01e5d57b24f5b4823c4007127d8fdf401f2f7da/src/Hooks/PrePush.php#L25-L38
train
cmsgears/module-core
common/models/resources/ModelComment.php
ModelComment.queryByType
public static function queryByType( $parentId, $parentType, $type = ModelComment::TYPE_COMMENT, $config = [] ) { //$type = isset( $config[ 'type' ] ) ? $config[ 'type' ] : self::TYPE_COMMENT; $status = isset( $config[ 'status' ] ) ? $config[ 'status' ] : self::STATUS_APPROVED; return self::queryByParent( $parentId, $parentType, $config )->andWhere( [ 'type' => $type, 'status' => $status ] ); }
php
public static function queryByType( $parentId, $parentType, $type = ModelComment::TYPE_COMMENT, $config = [] ) { //$type = isset( $config[ 'type' ] ) ? $config[ 'type' ] : self::TYPE_COMMENT; $status = isset( $config[ 'status' ] ) ? $config[ 'status' ] : self::STATUS_APPROVED; return self::queryByParent( $parentId, $parentType, $config )->andWhere( [ 'type' => $type, 'status' => $status ] ); }
[ "public", "static", "function", "queryByType", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "type", "=", "ModelComment", "::", "TYPE_COMMENT", ",", "$", "config", "=", "[", "]", ")", "{", "//$type\t= isset( $config[ 'type' ] ) ? $config[ 'type' ] : self::...
Return query to find the comments by type. @param integer $parentId @param string $parentType @param string $type @param array $config @return \yii\db\ActiveQuery to query by type.
[ "Return", "query", "to", "find", "the", "comments", "by", "type", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/resources/ModelComment.php#L316-L322
train
cmsgears/module-core
common/models/resources/ModelComment.php
ModelComment.queryByParentType
public static function queryByParentType( $parentType, $config = [] ) { $type = isset( $config[ 'type' ] ) ? $config[ 'type' ] : self::TYPE_COMMENT; $status = isset( $config[ 'status' ] ) ? $config[ 'status' ] : self::STATUS_APPROVED; return self::find()->where( [ 'parentType' => $parentType, 'type' => $type, 'status' => $status ] ); }
php
public static function queryByParentType( $parentType, $config = [] ) { $type = isset( $config[ 'type' ] ) ? $config[ 'type' ] : self::TYPE_COMMENT; $status = isset( $config[ 'status' ] ) ? $config[ 'status' ] : self::STATUS_APPROVED; return self::find()->where( [ 'parentType' => $parentType, 'type' => $type, 'status' => $status ] ); }
[ "public", "static", "function", "queryByParentType", "(", "$", "parentType", ",", "$", "config", "=", "[", "]", ")", "{", "$", "type", "=", "isset", "(", "$", "config", "[", "'type'", "]", ")", "?", "$", "config", "[", "'type'", "]", ":", "self", "...
Return query to find the comments by parent type. @param string $parentType @param array $config @return \yii\db\ActiveQuery to query by parent type.
[ "Return", "query", "to", "find", "the", "comments", "by", "parent", "type", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/resources/ModelComment.php#L331-L337
train
cmsgears/module-core
common/models/resources/ModelComment.php
ModelComment.queryByBaseId
public static function queryByBaseId( $baseId, $config = [] ) { $type = isset( $config[ 'type' ] ) ? $config[ 'type' ] : self::TYPE_COMMENT; $status = isset( $config[ 'status' ] ) ? $config[ 'status' ] : self::STATUS_APPROVED; return self::find()->where( [ 'baseId' => $baseId, 'type' => $type, 'status' => $status ] ); }
php
public static function queryByBaseId( $baseId, $config = [] ) { $type = isset( $config[ 'type' ] ) ? $config[ 'type' ] : self::TYPE_COMMENT; $status = isset( $config[ 'status' ] ) ? $config[ 'status' ] : self::STATUS_APPROVED; return self::find()->where( [ 'baseId' => $baseId, 'type' => $type, 'status' => $status ] ); }
[ "public", "static", "function", "queryByBaseId", "(", "$", "baseId", ",", "$", "config", "=", "[", "]", ")", "{", "$", "type", "=", "isset", "(", "$", "config", "[", "'type'", "]", ")", "?", "$", "config", "[", "'type'", "]", ":", "self", "::", "...
Return query to find the child comments. @param integer $baseId @param array $config @return \yii\db\ActiveQuery to query child comments.
[ "Return", "query", "to", "find", "the", "child", "comments", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/resources/ModelComment.php#L346-L352
train
cmsgears/module-core
common/models/resources/ModelComment.php
ModelComment.queryL0Approved
public static function queryL0Approved( $parentId, $parentType, $type = ModelComment::TYPE_COMMENT, $config = [] ) { return self::queryByType( $parentId, $parentType, $type, $config )->andWhere( [ 'baseId' => null ] ); }
php
public static function queryL0Approved( $parentId, $parentType, $type = ModelComment::TYPE_COMMENT, $config = [] ) { return self::queryByType( $parentId, $parentType, $type, $config )->andWhere( [ 'baseId' => null ] ); }
[ "public", "static", "function", "queryL0Approved", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "type", "=", "ModelComment", "::", "TYPE_COMMENT", ",", "$", "config", "=", "[", "]", ")", "{", "return", "self", "::", "queryByType", "(", "$", "p...
Return query to find top level approved comments. @param integer $parentId @param string $parentType @param string $type @param array $config @return \yii\db\ActiveQuery to query by email.
[ "Return", "query", "to", "find", "top", "level", "approved", "comments", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/resources/ModelComment.php#L375-L378
train
cmsgears/module-core
common/models/resources/ModelComment.php
ModelComment.findByUser
public static function findByUser( $parentId, $parentType, $userId, $type = ModelComment::TYPE_COMMENT ) { return static::find()->where( 'parentId=:pid AND parentType=:ptype AND createdBy=:uid AND type=:type', [ ':pid' => $parentId, ':ptype' => $parentType, ':uid' => $userId, ':type' => $type ] )->one(); }
php
public static function findByUser( $parentId, $parentType, $userId, $type = ModelComment::TYPE_COMMENT ) { return static::find()->where( 'parentId=:pid AND parentType=:ptype AND createdBy=:uid AND type=:type', [ ':pid' => $parentId, ':ptype' => $parentType, ':uid' => $userId, ':type' => $type ] )->one(); }
[ "public", "static", "function", "findByUser", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "userId", ",", "$", "type", "=", "ModelComment", "::", "TYPE_COMMENT", ")", "{", "return", "static", "::", "find", "(", ")", "->", "where", "(", "'paren...
Find and return the comment for given user id. @param integer $parentId @param string $parentType @param integer $userId @param string $type @return ModelComment
[ "Find", "and", "return", "the", "comment", "for", "given", "user", "id", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/resources/ModelComment.php#L391-L394
train
cmsgears/module-core
common/models/resources/ModelComment.php
ModelComment.isExistByUser
public static function isExistByUser( $parentId, $parentType, $userId, $type = ModelComment::TYPE_COMMENT ) { $comment = static::findByUser( $parentId, $parentType, $userId, $type ); return isset( $comment ); }
php
public static function isExistByUser( $parentId, $parentType, $userId, $type = ModelComment::TYPE_COMMENT ) { $comment = static::findByUser( $parentId, $parentType, $userId, $type ); return isset( $comment ); }
[ "public", "static", "function", "isExistByUser", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "userId", ",", "$", "type", "=", "ModelComment", "::", "TYPE_COMMENT", ")", "{", "$", "comment", "=", "static", "::", "findByUser", "(", "$", "parentId...
Check whether comment already exist for given user id. @param integer $parentId @param string $parentType @param integer $userId @param string $type @return boolean
[ "Check", "whether", "comment", "already", "exist", "for", "given", "user", "id", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/resources/ModelComment.php#L405-L410
train
cmsgears/module-core
common/services/base/MetaService.php
MetaService.create
public function create( $model, $config = [] ) { if( empty( $model->label ) ) { $model->label = $model->name; } if( !isset( $model->valueType ) ) { $model->valueType = Meta::VALUE_TYPE_TEXT; } return parent::create( $model ); }
php
public function create( $model, $config = [] ) { if( empty( $model->label ) ) { $model->label = $model->name; } if( !isset( $model->valueType ) ) { $model->valueType = Meta::VALUE_TYPE_TEXT; } return parent::create( $model ); }
[ "public", "function", "create", "(", "$", "model", ",", "$", "config", "=", "[", "]", ")", "{", "if", "(", "empty", "(", "$", "model", "->", "label", ")", ")", "{", "$", "model", "->", "label", "=", "$", "model", "->", "name", ";", "}", "if", ...
It generates the label if not set and create the meta. @param \cmsgears\core\common\models\base\Meta $model @param array $config @return \cmsgears\core\common\models\base\Meta
[ "It", "generates", "the", "label", "if", "not", "set", "and", "create", "the", "meta", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/base/MetaService.php#L319-L332
train
nails/module-email
email/controllers/Tracker.php
Tracker.track_open
public function track_open() { $oUri = Factory::service('Uri'); $oEmailer = Factory::service('Emailer', 'nails/module-email'); $sRef = $oUri->segment(3); $sGuid = $oUri->segment(4); $sHash = $oUri->segment(5); // -------------------------------------------------------------------------- if (!$sRef || !$oEmailer->validateHash($sRef, $sGuid, $sHash)) { show404(); } // -------------------------------------------------------------------------- // Fetch the email $oEmailer->trackOpen($sRef); // -------------------------------------------------------------------------- /** * Render out a tiny, tiny image * Thanks http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever */ header('Content-Type: image/gif'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); echo base64_decode('R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); // -------------------------------------------------------------------------- /** * Kill script, th, th, that's all folks. Stop the output class from hijacking * our headers and setting an incorrect Content-Type */ exit(0); }
php
public function track_open() { $oUri = Factory::service('Uri'); $oEmailer = Factory::service('Emailer', 'nails/module-email'); $sRef = $oUri->segment(3); $sGuid = $oUri->segment(4); $sHash = $oUri->segment(5); // -------------------------------------------------------------------------- if (!$sRef || !$oEmailer->validateHash($sRef, $sGuid, $sHash)) { show404(); } // -------------------------------------------------------------------------- // Fetch the email $oEmailer->trackOpen($sRef); // -------------------------------------------------------------------------- /** * Render out a tiny, tiny image * Thanks http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever */ header('Content-Type: image/gif'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); echo base64_decode('R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); // -------------------------------------------------------------------------- /** * Kill script, th, th, that's all folks. Stop the output class from hijacking * our headers and setting an incorrect Content-Type */ exit(0); }
[ "public", "function", "track_open", "(", ")", "{", "$", "oUri", "=", "Factory", "::", "service", "(", "'Uri'", ")", ";", "$", "oEmailer", "=", "Factory", "::", "service", "(", "'Emailer'", ",", "'nails/module-email'", ")", ";", "$", "sRef", "=", "$", "...
Track an email open.
[ "Track", "an", "email", "open", "." ]
42183b33a0465ab302f66a7b4f881410275eb6a4
https://github.com/nails/module-email/blob/42183b33a0465ab302f66a7b4f881410275eb6a4/email/controllers/Tracker.php#L21-L65
train
nails/module-email
email/controllers/Tracker.php
Tracker.track_link
public function track_link() { $oUri = Factory::service('Uri'); $oEmailer = Factory::service('Emailer', 'nails/module-email'); $sRef = $oUri->segment(4); $sGuid = $oUri->segment(5); $sHash = $oUri->segment(6); $iLinkId = (int) $oUri->segment(7) ?: null; // -------------------------------------------------------------------------- if (!$sRef || !$oEmailer->validateHash($sRef, $sGuid, $sHash)) { show404(); } // -------------------------------------------------------------------------- $sUrl = $oEmailer->trackLink($sRef, $iLinkId); if ($sUrl === false) { show404(); } redirect($sUrl); }
php
public function track_link() { $oUri = Factory::service('Uri'); $oEmailer = Factory::service('Emailer', 'nails/module-email'); $sRef = $oUri->segment(4); $sGuid = $oUri->segment(5); $sHash = $oUri->segment(6); $iLinkId = (int) $oUri->segment(7) ?: null; // -------------------------------------------------------------------------- if (!$sRef || !$oEmailer->validateHash($sRef, $sGuid, $sHash)) { show404(); } // -------------------------------------------------------------------------- $sUrl = $oEmailer->trackLink($sRef, $iLinkId); if ($sUrl === false) { show404(); } redirect($sUrl); }
[ "public", "function", "track_link", "(", ")", "{", "$", "oUri", "=", "Factory", "::", "service", "(", "'Uri'", ")", ";", "$", "oEmailer", "=", "Factory", "::", "service", "(", "'Emailer'", ",", "'nails/module-email'", ")", ";", "$", "sRef", "=", "$", "...
Track a link click and forward through
[ "Track", "a", "link", "click", "and", "forward", "through" ]
42183b33a0465ab302f66a7b4f881410275eb6a4
https://github.com/nails/module-email/blob/42183b33a0465ab302f66a7b4f881410275eb6a4/email/controllers/Tracker.php#L72-L96
train
paulbunyannet/bandolier
src/Bandolier/Type/Collection.php
Collection.addItem
public function addItem($obj, $key = null) { if ($key == null) { $this->items[] = $obj; } else { if (array_key_exists($key, $this->getItems())) { throw new KeyHasUseException("Key $key already in use."); } else { $this->items[$key] = $obj; } } return $this; }
php
public function addItem($obj, $key = null) { if ($key == null) { $this->items[] = $obj; } else { if (array_key_exists($key, $this->getItems())) { throw new KeyHasUseException("Key $key already in use."); } else { $this->items[$key] = $obj; } } return $this; }
[ "public", "function", "addItem", "(", "$", "obj", ",", "$", "key", "=", "null", ")", "{", "if", "(", "$", "key", "==", "null", ")", "{", "$", "this", "->", "items", "[", "]", "=", "$", "obj", ";", "}", "else", "{", "if", "(", "array_key_exists"...
Add an item to the collection by key @param $obj @param null|string|int $key @return $this @throws KeyHasUseException
[ "Add", "an", "item", "to", "the", "collection", "by", "key" ]
a98cb30bf63a18a7e3fc81418bf561ac36e9cd84
https://github.com/paulbunyannet/bandolier/blob/a98cb30bf63a18a7e3fc81418bf561ac36e9cd84/src/Bandolier/Type/Collection.php#L45-L58
train
paulbunyannet/bandolier
src/Bandolier/Type/Collection.php
Collection.setItem
public function setItem($obj, $key = null) { if (!$key) { throw new KeyInvalidException("A key is required."); } elseif (!is_string($key)) { throw new KeyInvalidException("The key should be a string."); } else { if (!array_key_exists($key, $this->getItems())) { throw new KeyInvalidException("Invalid key $key."); } $this->items[$key] = $obj; } return $this; }
php
public function setItem($obj, $key = null) { if (!$key) { throw new KeyInvalidException("A key is required."); } elseif (!is_string($key)) { throw new KeyInvalidException("The key should be a string."); } else { if (!array_key_exists($key, $this->getItems())) { throw new KeyInvalidException("Invalid key $key."); } $this->items[$key] = $obj; } return $this; }
[ "public", "function", "setItem", "(", "$", "obj", ",", "$", "key", "=", "null", ")", "{", "if", "(", "!", "$", "key", ")", "{", "throw", "new", "KeyInvalidException", "(", "\"A key is required.\"", ")", ";", "}", "elseif", "(", "!", "is_string", "(", ...
Set a collection item by key @param $obj @param mixed $key @return $this @throws KeyInvalidException
[ "Set", "a", "collection", "item", "by", "key" ]
a98cb30bf63a18a7e3fc81418bf561ac36e9cd84
https://github.com/paulbunyannet/bandolier/blob/a98cb30bf63a18a7e3fc81418bf561ac36e9cd84/src/Bandolier/Type/Collection.php#L89-L103
train
paulbunyannet/bandolier
src/Bandolier/Type/Collection.php
Collection.deleteItem
public function deleteItem($key) { if (isset($this->items[$key])) { unset($this->items[$key]); } else { throw new KeyInvalidException("Invalid key $key."); } return $this; }
php
public function deleteItem($key) { if (isset($this->items[$key])) { unset($this->items[$key]); } else { throw new KeyInvalidException("Invalid key $key."); } return $this; }
[ "public", "function", "deleteItem", "(", "$", "key", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "items", "[", "$", "key", "]", ")", ")", "{", "unset", "(", "$", "this", "->", "items", "[", "$", "key", "]", ")", ";", "}", "else", "{...
Delete a collection key @param $key @return $this @throws KeyInvalidException
[ "Delete", "a", "collection", "key" ]
a98cb30bf63a18a7e3fc81418bf561ac36e9cd84
https://github.com/paulbunyannet/bandolier/blob/a98cb30bf63a18a7e3fc81418bf561ac36e9cd84/src/Bandolier/Type/Collection.php#L111-L119
train
paulbunyannet/bandolier
src/Bandolier/Type/Collection.php
Collection.getItem
public function getItem($key) { if (isset($this->items[$key])) { return $this->items[$key]; } else { throw new KeyInvalidException("Invalid key $key."); } }
php
public function getItem($key) { if (isset($this->items[$key])) { return $this->items[$key]; } else { throw new KeyInvalidException("Invalid key $key."); } }
[ "public", "function", "getItem", "(", "$", "key", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "items", "[", "$", "key", "]", ")", ")", "{", "return", "$", "this", "->", "items", "[", "$", "key", "]", ";", "}", "else", "{", "throw", ...
Get a collection item @param $key @return mixed @throws KeyInvalidException
[ "Get", "a", "collection", "item" ]
a98cb30bf63a18a7e3fc81418bf561ac36e9cd84
https://github.com/paulbunyannet/bandolier/blob/a98cb30bf63a18a7e3fc81418bf561ac36e9cd84/src/Bandolier/Type/Collection.php#L127-L134
train
cmsgears/module-core
common/utilities/ContentUtil.php
ContentUtil.initModel
public static function initModel( $view, $config = [] ) { $model = isset( $view->params[ 'model' ] ) ? $view->params[ 'model' ] : self::findModel( $config ); if( isset( $model ) ) { $coreProperties = CoreProperties::getInstance(); $seoData = $model->getDataMeta( CoreGlobal::DATA_SEO ); // Model $view->params[ 'model' ] = $model; $view->params[ 'seo' ] = $seoData; // SEO H1 - Page Summary $view->params[ 'summary' ] = isset( $seoData ) && !empty( $seoData->summary ) ? $seoData->summary : ( isset( $model->summary ) && !empty( $model->summary ) ? $model->summary : $model->description ); // SEO Meta Tags - Description, Keywords, Robot Text $view->params[ 'desc' ] = isset( $seoData ) && !empty( $seoData->description ) ? $seoData->description : $model->description; $view->params[ 'keywords' ] = isset( $seoData ) && !empty( $seoData->keywords ) ? $seoData->keywords : null; $view->params[ 'robot' ] = isset( $seoData ) && !empty( $seoData->robot ) ? $seoData->robot : null; // SEO - Page Title $siteTitle = $coreProperties->getSiteTitle(); $seoName = isset( $seoData ) && !empty( $seoData->name ) ? $seoData->name : $model->name; $view->title = "$seoName | $siteTitle"; } }
php
public static function initModel( $view, $config = [] ) { $model = isset( $view->params[ 'model' ] ) ? $view->params[ 'model' ] : self::findModel( $config ); if( isset( $model ) ) { $coreProperties = CoreProperties::getInstance(); $seoData = $model->getDataMeta( CoreGlobal::DATA_SEO ); // Model $view->params[ 'model' ] = $model; $view->params[ 'seo' ] = $seoData; // SEO H1 - Page Summary $view->params[ 'summary' ] = isset( $seoData ) && !empty( $seoData->summary ) ? $seoData->summary : ( isset( $model->summary ) && !empty( $model->summary ) ? $model->summary : $model->description ); // SEO Meta Tags - Description, Keywords, Robot Text $view->params[ 'desc' ] = isset( $seoData ) && !empty( $seoData->description ) ? $seoData->description : $model->description; $view->params[ 'keywords' ] = isset( $seoData ) && !empty( $seoData->keywords ) ? $seoData->keywords : null; $view->params[ 'robot' ] = isset( $seoData ) && !empty( $seoData->robot ) ? $seoData->robot : null; // SEO - Page Title $siteTitle = $coreProperties->getSiteTitle(); $seoName = isset( $seoData ) && !empty( $seoData->name ) ? $seoData->name : $model->name; $view->title = "$seoName | $siteTitle"; } }
[ "public", "static", "function", "initModel", "(", "$", "view", ",", "$", "config", "=", "[", "]", ")", "{", "$", "model", "=", "isset", "(", "$", "view", "->", "params", "[", "'model'", "]", ")", "?", "$", "view", "->", "params", "[", "'model'", ...
Generates the meta data of Model using SEO Data. @param \yii\web\View $view The current view being rendered by controller. @param array $config @return array having model meta data.
[ "Generates", "the", "meta", "data", "of", "Model", "using", "SEO", "Data", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/utilities/ContentUtil.php#L35-L62
train
cmsgears/module-core
common/models/mappers/ModelFollower.php
ModelFollower.queryByTypeParentTypeModelId
public static function queryByTypeParentTypeModelId( $type, $parentType, $modelId ) { return self::find()->where( 'type=:type AND parentType=:ptype AND modelId=:mid', [ ':type' => $type, ':parentType' => $parentType, ':mid' => $modelId ] ); }
php
public static function queryByTypeParentTypeModelId( $type, $parentType, $modelId ) { return self::find()->where( 'type=:type AND parentType=:ptype AND modelId=:mid', [ ':type' => $type, ':parentType' => $parentType, ':mid' => $modelId ] ); }
[ "public", "static", "function", "queryByTypeParentTypeModelId", "(", "$", "type", ",", "$", "parentType", ",", "$", "modelId", ")", "{", "return", "self", "::", "find", "(", ")", "->", "where", "(", "'type=:type AND parentType=:ptype AND modelId=:mid'", ",", "[", ...
Return query to find the mapping by type and follower id. @param integer $type @param string $parentType @param integer $modelId @return \yii\db\ActiveQuery to query by type and follower id.
[ "Return", "query", "to", "find", "the", "mapping", "by", "type", "and", "follower", "id", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/mappers/ModelFollower.php#L170-L173
train
Innmind/AMQP
src/Model/Basic/Reject.php
Reject.requeue
public static function requeue(int $deliveryTag): self { $self = new self($deliveryTag); $self->requeue = true; return $self; }
php
public static function requeue(int $deliveryTag): self { $self = new self($deliveryTag); $self->requeue = true; return $self; }
[ "public", "static", "function", "requeue", "(", "int", "$", "deliveryTag", ")", ":", "self", "{", "$", "self", "=", "new", "self", "(", "$", "deliveryTag", ")", ";", "$", "self", "->", "requeue", "=", "true", ";", "return", "$", "self", ";", "}" ]
This will requeue unacknowledged messages meaning they may be delivered to a different consumer that the original one
[ "This", "will", "requeue", "unacknowledged", "messages", "meaning", "they", "may", "be", "delivered", "to", "a", "different", "consumer", "that", "the", "original", "one" ]
c22b3a8f56162f7845a13c149cb3118e5fe7cffd
https://github.com/Innmind/AMQP/blob/c22b3a8f56162f7845a13c149cb3118e5fe7cffd/src/Model/Basic/Reject.php#L20-L26
train
cmsgears/module-core
common/models/traits/base/FeaturedTrait.php
FeaturedTrait.queryByFeatured
public static function queryByFeatured( $config = [] ) { $ignoreSite = isset( $config[ 'ignoreSite' ] ) ? $config[ 'ignoreSite' ] : false; $limit = isset( $config[ 'limit' ] ) ? $config[ 'limit' ] : 10; $query = null; if( static::isMultiSite() && !$ignoreSite ) { $siteId = isset( $config[ 'siteId' ] ) ? $config[ 'siteId' ] : Yii::$app->core->siteId; $query = static::find()->where( 'featured=:featured AND siteId=:siteId', [ ':featured' => true, ':siteId' => $siteId ] ); } else { $query = static::find()->where( 'featured=:featured', [ ':featured' => true ] ); } $query->limit( $limit ); return $query; }
php
public static function queryByFeatured( $config = [] ) { $ignoreSite = isset( $config[ 'ignoreSite' ] ) ? $config[ 'ignoreSite' ] : false; $limit = isset( $config[ 'limit' ] ) ? $config[ 'limit' ] : 10; $query = null; if( static::isMultiSite() && !$ignoreSite ) { $siteId = isset( $config[ 'siteId' ] ) ? $config[ 'siteId' ] : Yii::$app->core->siteId; $query = static::find()->where( 'featured=:featured AND siteId=:siteId', [ ':featured' => true, ':siteId' => $siteId ] ); } else { $query = static::find()->where( 'featured=:featured', [ ':featured' => true ] ); } $query->limit( $limit ); return $query; }
[ "public", "static", "function", "queryByFeatured", "(", "$", "config", "=", "[", "]", ")", "{", "$", "ignoreSite", "=", "isset", "(", "$", "config", "[", "'ignoreSite'", "]", ")", "?", "$", "config", "[", "'ignoreSite'", "]", ":", "false", ";", "$", ...
Generate and return the query to filter featured models based on multi-site configuration. @param array $config @return \yii\db\ActiveQuery
[ "Generate", "and", "return", "the", "query", "to", "filter", "featured", "models", "based", "on", "multi", "-", "site", "configuration", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/traits/base/FeaturedTrait.php#L139-L159
train
ec-europa/oe-robo
src/SettingsProcessor.php
SettingsProcessor.process
public function process($settings_file) { $output[] = $this->getContent($settings_file); $output[] = ''; $output[] = self::BLOCK_START; $output[] = ''; foreach ($this->config->get(self::CONFIG_KEY) as $variable => $settings) { foreach ($settings as $name => $value) { $output[] = $this->getStatement($variable, $name, $value); } $output[] = ''; } $output[] = self::BLOCK_END; return implode($output, "\n"); }
php
public function process($settings_file) { $output[] = $this->getContent($settings_file); $output[] = ''; $output[] = self::BLOCK_START; $output[] = ''; foreach ($this->config->get(self::CONFIG_KEY) as $variable => $settings) { foreach ($settings as $name => $value) { $output[] = $this->getStatement($variable, $name, $value); } $output[] = ''; } $output[] = self::BLOCK_END; return implode($output, "\n"); }
[ "public", "function", "process", "(", "$", "settings_file", ")", "{", "$", "output", "[", "]", "=", "$", "this", "->", "getContent", "(", "$", "settings_file", ")", ";", "$", "output", "[", "]", "=", "''", ";", "$", "output", "[", "]", "=", "self",...
Process settings file. @param string $settings_file Full path to settings file to be processed, including its name. @return string Processed setting file.
[ "Process", "settings", "file", "." ]
ad60ad28fcd4d5afdfee0c7cbeeb245f8bc0ea02
https://github.com/ec-europa/oe-robo/blob/ad60ad28fcd4d5afdfee0c7cbeeb245f8bc0ea02/src/SettingsProcessor.php#L52-L67
train
ec-europa/oe-robo
src/SettingsProcessor.php
SettingsProcessor.getContent
private function getContent($settings_file) { $content = file_get_contents($settings_file); $regex = "/^" . preg_quote(self::BLOCK_START, '/') . ".*?" . preg_quote(self::BLOCK_END, '/') . "/sm"; return preg_replace($regex, '', $content); }
php
private function getContent($settings_file) { $content = file_get_contents($settings_file); $regex = "/^" . preg_quote(self::BLOCK_START, '/') . ".*?" . preg_quote(self::BLOCK_END, '/') . "/sm"; return preg_replace($regex, '', $content); }
[ "private", "function", "getContent", "(", "$", "settings_file", ")", "{", "$", "content", "=", "file_get_contents", "(", "$", "settings_file", ")", ";", "$", "regex", "=", "\"/^\"", ".", "preg_quote", "(", "self", "::", "BLOCK_START", ",", "'/'", ")", ".",...
Get settings file content. @param string $settings_file Full path to settings file to be processed, including its name. @return string File content without setting block.
[ "Get", "settings", "file", "content", "." ]
ad60ad28fcd4d5afdfee0c7cbeeb245f8bc0ea02
https://github.com/ec-europa/oe-robo/blob/ad60ad28fcd4d5afdfee0c7cbeeb245f8bc0ea02/src/SettingsProcessor.php#L78-L82
train