repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
silverstripe/silverstripe-cms | code/Controllers/ModelAsController.php | ModelAsController.controller_for | public static function controller_for(SiteTree $sitetree, $action = null)
{
$controller = $sitetree->getControllerName();
if ($action && class_exists($controller . '_' . ucfirst($action))) {
$controller = $controller . '_' . ucfirst($action);
}
return Injector::inst()->... | php | public static function controller_for(SiteTree $sitetree, $action = null)
{
$controller = $sitetree->getControllerName();
if ($action && class_exists($controller . '_' . ucfirst($action))) {
$controller = $controller . '_' . ucfirst($action);
}
return Injector::inst()->... | [
"public",
"static",
"function",
"controller_for",
"(",
"SiteTree",
"$",
"sitetree",
",",
"$",
"action",
"=",
"null",
")",
"{",
"$",
"controller",
"=",
"$",
"sitetree",
"->",
"getControllerName",
"(",
")",
";",
"if",
"(",
"$",
"action",
"&&",
"class_exists"... | Get the appropriate {@link ContentController} for handling a {@link SiteTree} object, link it to the object and
return it.
@param SiteTree $sitetree
@param string $action
@return ContentController | [
"Get",
"the",
"appropriate",
"{",
"@link",
"ContentController",
"}",
"for",
"handling",
"a",
"{",
"@link",
"SiteTree",
"}",
"object",
"link",
"it",
"to",
"the",
"object",
"and",
"return",
"it",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/ModelAsController.php#L40-L49 |
silverstripe/silverstripe-cms | code/Model/SiteTreeLinkTracking.php | SiteTreeLinkTracking.augmentSyncLinkTracking | public function augmentSyncLinkTracking()
{
// If owner is versioned, skip tracking on live
if (Versioned::get_stage() == Versioned::LIVE && $this->owner->hasExtension(Versioned::class)) {
return;
}
// Build a list of HTMLText fields, merging all linked pages together.
... | php | public function augmentSyncLinkTracking()
{
// If owner is versioned, skip tracking on live
if (Versioned::get_stage() == Versioned::LIVE && $this->owner->hasExtension(Versioned::class)) {
return;
}
// Build a list of HTMLText fields, merging all linked pages together.
... | [
"public",
"function",
"augmentSyncLinkTracking",
"(",
")",
"{",
"// If owner is versioned, skip tracking on live",
"if",
"(",
"Versioned",
"::",
"get_stage",
"(",
")",
"==",
"Versioned",
"::",
"LIVE",
"&&",
"$",
"this",
"->",
"owner",
"->",
"hasExtension",
"(",
"V... | Find HTMLText fields on {@link owner} to scrape for links that need tracking | [
"Find",
"HTMLText",
"fields",
"on",
"{"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTreeLinkTracking.php#L108-L135 |
silverstripe/silverstripe-cms | code/Model/SiteTreeLinkTracking.php | SiteTreeLinkTracking.trackLinksInField | public function trackLinksInField($fieldName, &$anyBroken = false)
{
// Pull down current field content
$htmlValue = HTMLValue::create($this->owner->$fieldName);
// Process all links
$linkedPages = [];
$links = $this->parser->process($htmlValue);
foreach ($links as $... | php | public function trackLinksInField($fieldName, &$anyBroken = false)
{
// Pull down current field content
$htmlValue = HTMLValue::create($this->owner->$fieldName);
// Process all links
$linkedPages = [];
$links = $this->parser->process($htmlValue);
foreach ($links as $... | [
"public",
"function",
"trackLinksInField",
"(",
"$",
"fieldName",
",",
"&",
"$",
"anyBroken",
"=",
"false",
")",
"{",
"// Pull down current field content",
"$",
"htmlValue",
"=",
"HTMLValue",
"::",
"create",
"(",
"$",
"this",
"->",
"owner",
"->",
"$",
"fieldNa... | Scrape the content of a field to detect anly links to local SiteTree pages or files
@param string $fieldName The name of the field on {@link @owner} to scrape
@param bool &$anyBroken Will be flagged to true (by reference) if a link is broken.
@return int[] Array of page IDs found (associative array) | [
"Scrape",
"the",
"content",
"of",
"a",
"field",
"to",
"detect",
"anly",
"links",
"to",
"local",
"SiteTree",
"pages",
"or",
"files"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTreeLinkTracking.php#L154-L181 |
silverstripe/silverstripe-cms | code/Model/SiteTreeLinkTracking.php | SiteTreeLinkTracking.toggleElementClass | protected function toggleElementClass(DOMElement $domReference, $class, $toggle)
{
// Get all existing classes.
$classes = array_filter(explode(' ', trim($domReference->getAttribute('class'))));
// Add or remove the broken class from the link, depending on the link status.
if ($togg... | php | protected function toggleElementClass(DOMElement $domReference, $class, $toggle)
{
// Get all existing classes.
$classes = array_filter(explode(' ', trim($domReference->getAttribute('class'))));
// Add or remove the broken class from the link, depending on the link status.
if ($togg... | [
"protected",
"function",
"toggleElementClass",
"(",
"DOMElement",
"$",
"domReference",
",",
"$",
"class",
",",
"$",
"toggle",
")",
"{",
"// Get all existing classes.",
"$",
"classes",
"=",
"array_filter",
"(",
"explode",
"(",
"' '",
",",
"trim",
"(",
"$",
"dom... | Add the given css class to the DOM element.
@param DOMElement $domReference Element to modify.
@param string $class Class name to toggle.
@param bool $toggle On or off. | [
"Add",
"the",
"given",
"css",
"class",
"to",
"the",
"DOM",
"element",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTreeLinkTracking.php#L190-L207 |
silverstripe/silverstripe-cms | code/Controllers/CMSSiteTreeFilter_Search.php | CMSSiteTreeFilter_Search.getFilteredPages | public function getFilteredPages()
{
// Filter default records
$pages = Versioned::get_by_stage(SiteTree::class, Versioned::DRAFT);
$pages = $this->applyDefaultFilters($pages);
return $pages;
} | php | public function getFilteredPages()
{
// Filter default records
$pages = Versioned::get_by_stage(SiteTree::class, Versioned::DRAFT);
$pages = $this->applyDefaultFilters($pages);
return $pages;
} | [
"public",
"function",
"getFilteredPages",
"(",
")",
"{",
"// Filter default records",
"$",
"pages",
"=",
"Versioned",
"::",
"get_by_stage",
"(",
"SiteTree",
"::",
"class",
",",
"Versioned",
"::",
"DRAFT",
")",
";",
"$",
"pages",
"=",
"$",
"this",
"->",
"appl... | Retun an array of maps containing the keys, 'ID' and 'ParentID' for each page to be displayed
in the search.
@return SS_List | [
"Retun",
"an",
"array",
"of",
"maps",
"containing",
"the",
"keys",
"ID",
"and",
"ParentID",
"for",
"each",
"page",
"to",
"be",
"displayed",
"in",
"the",
"search",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSSiteTreeFilter_Search.php#L23-L29 |
silverstripe/silverstripe-cms | code/Controllers/RootURLController.php | RootURLController.get_homepage_link | public static function get_homepage_link()
{
if (!self::$cached_homepage_link) {
$link = Config::inst()->get(__CLASS__, 'default_homepage_link');
singleton(__CLASS__)->extend('updateHomepageLink', $link);
self::$cached_homepage_link = $link;
}
return self:... | php | public static function get_homepage_link()
{
if (!self::$cached_homepage_link) {
$link = Config::inst()->get(__CLASS__, 'default_homepage_link');
singleton(__CLASS__)->extend('updateHomepageLink', $link);
self::$cached_homepage_link = $link;
}
return self:... | [
"public",
"static",
"function",
"get_homepage_link",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"cached_homepage_link",
")",
"{",
"$",
"link",
"=",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"__CLASS__",
",",
"'default_homepage_link'",
")",... | Get the full form (e.g. /home/) relative link to the home page for the current HTTP_HOST value. Note that the
link is trimmed of leading and trailing slashes before returning to ensure consistency.
@return string | [
"Get",
"the",
"full",
"form",
"(",
"e",
".",
"g",
".",
"/",
"home",
"/",
")",
"relative",
"link",
"to",
"the",
"home",
"page",
"for",
"the",
"current",
"HTTP_HOST",
"value",
".",
"Note",
"that",
"the",
"link",
"is",
"trimmed",
"of",
"leading",
"and",... | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/RootURLController.php#L40-L48 |
silverstripe/silverstripe-cms | code/Controllers/RootURLController.php | RootURLController.should_be_on_root | public static function should_be_on_root(SiteTree $page)
{
return (!self::$is_at_root && self::get_homepage_link() == trim($page->RelativeLink(true), '/'));
} | php | public static function should_be_on_root(SiteTree $page)
{
return (!self::$is_at_root && self::get_homepage_link() == trim($page->RelativeLink(true), '/'));
} | [
"public",
"static",
"function",
"should_be_on_root",
"(",
"SiteTree",
"$",
"page",
")",
"{",
"return",
"(",
"!",
"self",
"::",
"$",
"is_at_root",
"&&",
"self",
"::",
"get_homepage_link",
"(",
")",
"==",
"trim",
"(",
"$",
"page",
"->",
"RelativeLink",
"(",
... | Returns TRUE if a request to a certain page should be redirected to the site root (i.e. if the page acts as the
home page).
@param SiteTree $page
@return bool | [
"Returns",
"TRUE",
"if",
"a",
"request",
"to",
"a",
"certain",
"page",
"should",
"be",
"redirected",
"to",
"the",
"site",
"root",
"(",
"i",
".",
"e",
".",
"if",
"the",
"page",
"acts",
"as",
"the",
"home",
"page",
")",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/RootURLController.php#L57-L60 |
silverstripe/silverstripe-cms | code/BatchActions/CMSBatchAction_Restore.php | CMSBatchAction_Restore.applicablePages | public function applicablePages($ids)
{
// Basic permission check based on SiteTree::canEdit
if (!Permission::check(array("ADMIN", "SITETREE_EDIT_ALL"))) {
return array();
}
// Get pages that exist in stage and remove them from the restore-able set
$stageIDs = Ve... | php | public function applicablePages($ids)
{
// Basic permission check based on SiteTree::canEdit
if (!Permission::check(array("ADMIN", "SITETREE_EDIT_ALL"))) {
return array();
}
// Get pages that exist in stage and remove them from the restore-able set
$stageIDs = Ve... | [
"public",
"function",
"applicablePages",
"(",
"$",
"ids",
")",
"{",
"// Basic permission check based on SiteTree::canEdit",
"if",
"(",
"!",
"Permission",
"::",
"check",
"(",
"array",
"(",
"\"ADMIN\"",
",",
"\"SITETREE_EDIT_ALL\"",
")",
")",
")",
"{",
"return",
"ar... | {@see SiteTree::canEdit()}
@param array $ids
@return array | [
"{",
"@see",
"SiteTree",
"::",
"canEdit",
"()",
"}"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/BatchActions/CMSBatchAction_Restore.php#L51-L61 |
silverstripe/silverstripe-cms | code/Model/SiteTreeFolderExtension.php | SiteTreeFolderExtension.getUnusedFilesListFilter | public function getUnusedFilesListFilter()
{
Deprecation::notice('5.0', 'Will be removed in 5.0');
// Add all records in link tracking
$usedFiles = FileLink::get()->column('LinkedID');
// Get all classes that aren't folder
$fileClasses = array_diff_key(
ClassInf... | php | public function getUnusedFilesListFilter()
{
Deprecation::notice('5.0', 'Will be removed in 5.0');
// Add all records in link tracking
$usedFiles = FileLink::get()->column('LinkedID');
// Get all classes that aren't folder
$fileClasses = array_diff_key(
ClassInf... | [
"public",
"function",
"getUnusedFilesListFilter",
"(",
")",
"{",
"Deprecation",
"::",
"notice",
"(",
"'5.0'",
",",
"'Will be removed in 5.0'",
")",
";",
"// Add all records in link tracking",
"$",
"usedFiles",
"=",
"FileLink",
"::",
"get",
"(",
")",
"->",
"column",
... | Looks for files used in system and create where clause which contains all ID's of files.
@deprecated 4.2..5.0
@returns string where clause which will work as filter. | [
"Looks",
"for",
"files",
"used",
"in",
"system",
"and",
"create",
"where",
"clause",
"which",
"contains",
"all",
"ID",
"s",
"of",
"files",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTreeFolderExtension.php#L35-L87 |
silverstripe/silverstripe-cms | code/Controllers/OldPageRedirector.php | OldPageRedirector.onBeforeHTTPError404 | public function onBeforeHTTPError404($request)
{
// We need to get the URL ourselves because $request->allParams() only has a max of 4 params
$params = preg_split('|/+|', $request->getURL());
$cleanURL = trim(Director::makeRelative($request->getURL(false)), '/');
$getvars = $request... | php | public function onBeforeHTTPError404($request)
{
// We need to get the URL ourselves because $request->allParams() only has a max of 4 params
$params = preg_split('|/+|', $request->getURL());
$cleanURL = trim(Director::makeRelative($request->getURL(false)), '/');
$getvars = $request... | [
"public",
"function",
"onBeforeHTTPError404",
"(",
"$",
"request",
")",
"{",
"// We need to get the URL ourselves because $request->allParams() only has a max of 4 params",
"$",
"params",
"=",
"preg_split",
"(",
"'|/+|'",
",",
"$",
"request",
"->",
"getURL",
"(",
")",
")"... | On every URL that generates a 404, we'll capture it here and see if we can
find an old URL that it should be redirecting to.
@param HTTPRequest $request The request object
@throws HTTPResponse_Exception | [
"On",
"every",
"URL",
"that",
"generates",
"a",
"404",
"we",
"ll",
"capture",
"it",
"here",
"and",
"see",
"if",
"we",
"can",
"find",
"an",
"old",
"URL",
"that",
"it",
"should",
"be",
"redirecting",
"to",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/OldPageRedirector.php#L23-L49 |
silverstripe/silverstripe-cms | code/Controllers/OldPageRedirector.php | OldPageRedirector.find_old_page | public static function find_old_page($params, $parent = null, $redirect = false)
{
$parent = is_numeric($parent) ? SiteTree::get()->byID($parent) : $parent;
$params = (array)$params;
$URL = rawurlencode(array_shift($params));
if (empty($URL)) {
return false;
}
... | php | public static function find_old_page($params, $parent = null, $redirect = false)
{
$parent = is_numeric($parent) ? SiteTree::get()->byID($parent) : $parent;
$params = (array)$params;
$URL = rawurlencode(array_shift($params));
if (empty($URL)) {
return false;
}
... | [
"public",
"static",
"function",
"find_old_page",
"(",
"$",
"params",
",",
"$",
"parent",
"=",
"null",
",",
"$",
"redirect",
"=",
"false",
")",
"{",
"$",
"parent",
"=",
"is_numeric",
"(",
"$",
"parent",
")",
"?",
"SiteTree",
"::",
"get",
"(",
")",
"->... | Attempt to find an old/renamed page from some given the URL as an array
@param array $params The array of URL, e.g. /foo/bar as array('foo', 'bar')
@param SiteTree|null $parent The current parent in the recursive flow
@param boolean $redirect Whether we've found an old page worthy of a redirect
@return string|boolean... | [
"Attempt",
"to",
"find",
"an",
"old",
"/",
"renamed",
"page",
"from",
"some",
"given",
"the",
"URL",
"as",
"an",
"array"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/OldPageRedirector.php#L60-L113 |
silverstripe/silverstripe-cms | code/Forms/InternalLinkModalExtension.php | InternalLinkModalExtension.editorInternalLink | public function editorInternalLink()
{
$showLinkText = $this->getOwner()->getRequest()->getVar('requireLinkText');
$factory = InternalLinkFormFactory::singleton();
return $factory->getForm(
$this->getOwner(),
"editorInternalLink",
[ 'RequireLinkText' => is... | php | public function editorInternalLink()
{
$showLinkText = $this->getOwner()->getRequest()->getVar('requireLinkText');
$factory = InternalLinkFormFactory::singleton();
return $factory->getForm(
$this->getOwner(),
"editorInternalLink",
[ 'RequireLinkText' => is... | [
"public",
"function",
"editorInternalLink",
"(",
")",
"{",
"$",
"showLinkText",
"=",
"$",
"this",
"->",
"getOwner",
"(",
")",
"->",
"getRequest",
"(",
")",
"->",
"getVar",
"(",
"'requireLinkText'",
")",
";",
"$",
"factory",
"=",
"InternalLinkFormFactory",
":... | Form for inserting internal link pages
@return Form | [
"Form",
"for",
"inserting",
"internal",
"link",
"pages"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Forms/InternalLinkModalExtension.php#L41-L50 |
silverstripe/silverstripe-cms | code/Model/RedirectorPageController.php | RedirectorPageController.index | public function index(HTTPRequest $request)
{
/** @var RedirectorPage $page */
$page = $this->data();
if (!$this->getResponse()->isFinished() && $link = $page->redirectionLink()) {
$this->redirect($link, 301);
}
return parent::handleAction($request, 'handleIndex')... | php | public function index(HTTPRequest $request)
{
/** @var RedirectorPage $page */
$page = $this->data();
if (!$this->getResponse()->isFinished() && $link = $page->redirectionLink()) {
$this->redirect($link, 301);
}
return parent::handleAction($request, 'handleIndex')... | [
"public",
"function",
"index",
"(",
"HTTPRequest",
"$",
"request",
")",
"{",
"/** @var RedirectorPage $page */",
"$",
"page",
"=",
"$",
"this",
"->",
"data",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"getResponse",
"(",
")",
"->",
"isFinished",
"... | Check we don't already have a redirect code set
@param HTTPRequest $request
@return \SilverStripe\Control\HTTPResponse | [
"Check",
"we",
"don",
"t",
"already",
"have",
"a",
"redirect",
"code",
"set"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/RedirectorPageController.php#L20-L28 |
silverstripe/silverstripe-cms | code/Model/SiteTreeLinkTracking_Parser.php | SiteTreeLinkTracking_Parser.process | public function process(HTMLValue $htmlValue)
{
$results = array();
$links = $htmlValue->getElementsByTagName('a');
if (!$links) {
return $results;
}
/** @var DOMElement $link */
foreach ($links as $link) {
if (!$link->hasAttribute('href')) {... | php | public function process(HTMLValue $htmlValue)
{
$results = array();
$links = $htmlValue->getElementsByTagName('a');
if (!$links) {
return $results;
}
/** @var DOMElement $link */
foreach ($links as $link) {
if (!$link->hasAttribute('href')) {... | [
"public",
"function",
"process",
"(",
"HTMLValue",
"$",
"htmlValue",
")",
"{",
"$",
"results",
"=",
"array",
"(",
")",
";",
"$",
"links",
"=",
"$",
"htmlValue",
"->",
"getElementsByTagName",
"(",
"'a'",
")",
";",
"if",
"(",
"!",
"$",
"links",
")",
"{... | Finds the links that are of interest for the link tracking automation. Checks for brokenness and attaches
extracted metadata so consumers can decide what to do with the DOM element (provided as DOMReference).
@param HTMLValue $htmlValue Object to parse the links from.
@return array Associative array containing found l... | [
"Finds",
"the",
"links",
"that",
"are",
"of",
"interest",
"for",
"the",
"link",
"tracking",
"automation",
".",
"Checks",
"for",
"brokenness",
"and",
"attaches",
"extracted",
"metadata",
"so",
"consumers",
"can",
"decide",
"what",
"to",
"do",
"with",
"the",
"... | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTreeLinkTracking_Parser.php#L27-L103 |
silverstripe/silverstripe-cms | code/Controllers/CMSPageHistoryController.php | CMSPageHistoryController.getEditForm | public function getEditForm($id = null, $fields = null, $versionID = null, $compareID = null)
{
if (!$id) {
$id = $this->currentPageID();
}
if (!$versionID) {
$versionID = $this->getVersionID();
}
$record = $this->getRecord($id, $versionID);
i... | php | public function getEditForm($id = null, $fields = null, $versionID = null, $compareID = null)
{
if (!$id) {
$id = $this->currentPageID();
}
if (!$versionID) {
$versionID = $this->getVersionID();
}
$record = $this->getRecord($id, $versionID);
i... | [
"public",
"function",
"getEditForm",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"versionID",
"=",
"null",
",",
"$",
"compareID",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"$",
"this... | Returns the read only version of the edit form. Detaches all {@link FormAction}
instances attached since only action relates to revert.
Permission checking is done at the {@link CMSMain::getEditForm()} level.
@param int $id ID of the record to show
@param array $fields optional
@param int $versionID
@param int $compa... | [
"Returns",
"the",
"read",
"only",
"version",
"of",
"the",
"edit",
"form",
".",
"Detaches",
"all",
"{",
"@link",
"FormAction",
"}",
"instances",
"attached",
"since",
"only",
"action",
"relates",
"to",
"revert",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSPageHistoryController.php#L175-L278 |
silverstripe/silverstripe-cms | code/Controllers/CMSPageHistoryController.php | CMSPageHistoryController.VersionsForm | public function VersionsForm()
{
$id = $this->currentPageID();
$page = $this->getRecord($id);
$versionsHtml = '';
$action = $this->getRequest()->param('Action');
$versionID = $this->getRequest()->param('VersionID');
$otherVersionID = $this->getRequest()->param('Other... | php | public function VersionsForm()
{
$id = $this->currentPageID();
$page = $this->getRecord($id);
$versionsHtml = '';
$action = $this->getRequest()->param('Action');
$versionID = $this->getRequest()->param('VersionID');
$otherVersionID = $this->getRequest()->param('Other... | [
"public",
"function",
"VersionsForm",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"currentPageID",
"(",
")",
";",
"$",
"page",
"=",
"$",
"this",
"->",
"getRecord",
"(",
"$",
"id",
")",
";",
"$",
"versionsHtml",
"=",
"''",
";",
"$",
"action",
... | Version select form. Main interface between selecting versions to view
and comparing multiple versions.
Because we can reload the page directly to a compare view (history/compare/1/2/3)
this form has to adapt to those parameters as well.
@return Form | [
"Version",
"select",
"form",
".",
"Main",
"interface",
"between",
"selecting",
"versions",
"to",
"view",
"and",
"comparing",
"multiple",
"versions",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSPageHistoryController.php#L290-L361 |
silverstripe/silverstripe-cms | code/Controllers/CMSPageHistoryController.php | CMSPageHistoryController.transformReadonly | public function transformReadonly(FieldList $fields)
{
foreach ($fields->dataFields() as $field) {
if ($field instanceof HiddenField) {
continue;
}
$newField = $field->castedCopy(HTMLReadonlyField::class);
$fields->replaceField($field->getName(... | php | public function transformReadonly(FieldList $fields)
{
foreach ($fields->dataFields() as $field) {
if ($field instanceof HiddenField) {
continue;
}
$newField = $field->castedCopy(HTMLReadonlyField::class);
$fields->replaceField($field->getName(... | [
"public",
"function",
"transformReadonly",
"(",
"FieldList",
"$",
"fields",
")",
"{",
"foreach",
"(",
"$",
"fields",
"->",
"dataFields",
"(",
")",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"instanceof",
"HiddenField",
")",
"{",
"continue",
"... | Replace all data fields with HTML readonly fields to display diff
@param FieldList $fields
@return FieldList | [
"Replace",
"all",
"data",
"fields",
"with",
"HTML",
"readonly",
"fields",
"to",
"display",
"diff"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSPageHistoryController.php#L433-L443 |
silverstripe/silverstripe-cms | code/Model/RedirectorPage.php | RedirectorPage.Link | public function Link($action = null)
{
$link = $this->redirectionLink();
if ($link) {
return $link;
} else {
return $this->regularLink($action);
}
} | php | public function Link($action = null)
{
$link = $this->redirectionLink();
if ($link) {
return $link;
} else {
return $this->regularLink($action);
}
} | [
"public",
"function",
"Link",
"(",
"$",
"action",
"=",
"null",
")",
"{",
"$",
"link",
"=",
"$",
"this",
"->",
"redirectionLink",
"(",
")",
";",
"if",
"(",
"$",
"link",
")",
"{",
"return",
"$",
"link",
";",
"}",
"else",
"{",
"return",
"$",
"this",... | Return the the link that should be used for this redirector page, in navigation, etc.
If the redirectorpage has been appropriately configured, then it will return the redirection
destination, to prevent unnecessary 30x redirections. However, if it's misconfigured, then
it will return a link to itself, which will then ... | [
"Return",
"the",
"the",
"link",
"that",
"should",
"be",
"used",
"for",
"this",
"redirector",
"page",
"in",
"navigation",
"etc",
".",
"If",
"the",
"redirectorpage",
"has",
"been",
"appropriately",
"configured",
"then",
"it",
"will",
"return",
"the",
"redirectio... | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/RedirectorPage.php#L65-L73 |
silverstripe/silverstripe-cms | code/Model/RedirectorPage.php | RedirectorPage.redirectionLink | public function redirectionLink()
{
// Check external redirect
if ($this->RedirectionType == 'External') {
return $this->ExternalURL ?: null;
}
// Check internal redirect
/** @var SiteTree $linkTo */
$linkTo = $this->LinkToID ? SiteTree::get()->byID($this... | php | public function redirectionLink()
{
// Check external redirect
if ($this->RedirectionType == 'External') {
return $this->ExternalURL ?: null;
}
// Check internal redirect
/** @var SiteTree $linkTo */
$linkTo = $this->LinkToID ? SiteTree::get()->byID($this... | [
"public",
"function",
"redirectionLink",
"(",
")",
"{",
"// Check external redirect",
"if",
"(",
"$",
"this",
"->",
"RedirectionType",
"==",
"'External'",
")",
"{",
"return",
"$",
"this",
"->",
"ExternalURL",
"?",
":",
"null",
";",
"}",
"// Check internal redire... | Return the link that we should redirect to.
Only return a value if there is a legal redirection destination. | [
"Return",
"the",
"link",
"that",
"we",
"should",
"redirect",
"to",
".",
"Only",
"return",
"a",
"value",
"if",
"there",
"is",
"a",
"legal",
"redirection",
"destination",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/RedirectorPage.php#L91-L120 |
silverstripe/silverstripe-cms | code/Controllers/SilverStripeNavigatorItem.php | SilverStripeNavigatorItem.isArchived | public function isArchived()
{
/** @var Versioned|DataObject $record */
$record = $this->record;
if (!$record->hasExtension(Versioned::class) || !$record->hasStages()) {
return false;
}
if (!isset($record->_cached_isArchived)) {
$baseClass = $record->... | php | public function isArchived()
{
/** @var Versioned|DataObject $record */
$record = $this->record;
if (!$record->hasExtension(Versioned::class) || !$record->hasStages()) {
return false;
}
if (!isset($record->_cached_isArchived)) {
$baseClass = $record->... | [
"public",
"function",
"isArchived",
"(",
")",
"{",
"/** @var Versioned|DataObject $record */",
"$",
"record",
"=",
"$",
"this",
"->",
"record",
";",
"if",
"(",
"!",
"$",
"record",
"->",
"hasExtension",
"(",
"Versioned",
"::",
"class",
")",
"||",
"!",
"$",
... | Counts as "archived" if the current record is a different version from both live and draft.
@return boolean | [
"Counts",
"as",
"archived",
"if",
"the",
"current",
"record",
"is",
"a",
"different",
"version",
"from",
"both",
"live",
"and",
"draft",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/SilverStripeNavigatorItem.php#L122-L142 |
silverstripe/silverstripe-cms | code/Reports/EmptyPagesReport.php | EmptyPagesReport.sourceRecords | public function sourceRecords($params = null)
{
return SiteTree::get()
->exclude('ClassName', RedirectorPage::class)
->filter('Content', [null, '', '<p></p>', '<p> </p>'])
->sort('Title');
} | php | public function sourceRecords($params = null)
{
return SiteTree::get()
->exclude('ClassName', RedirectorPage::class)
->filter('Content', [null, '', '<p></p>', '<p> </p>'])
->sort('Title');
} | [
"public",
"function",
"sourceRecords",
"(",
"$",
"params",
"=",
"null",
")",
"{",
"return",
"SiteTree",
"::",
"get",
"(",
")",
"->",
"exclude",
"(",
"'ClassName'",
",",
"RedirectorPage",
"::",
"class",
")",
"->",
"filter",
"(",
"'Content'",
",",
"[",
"nu... | Gets the source records
@param array $params
@return DataList | [
"Gets",
"the",
"source",
"records"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Reports/EmptyPagesReport.php#L34-L40 |
silverstripe/silverstripe-cms | code/Controllers/CMSSiteTreeFilter.php | CMSSiteTreeFilter.get_all_filters | public static function get_all_filters()
{
// get all filter instances
$filters = ClassInfo::subclassesFor(CMSSiteTreeFilter::class);
// remove abstract CMSSiteTreeFilter class
array_shift($filters);
// add filters to map
$filterMap = array();
foreach ($filt... | php | public static function get_all_filters()
{
// get all filter instances
$filters = ClassInfo::subclassesFor(CMSSiteTreeFilter::class);
// remove abstract CMSSiteTreeFilter class
array_shift($filters);
// add filters to map
$filterMap = array();
foreach ($filt... | [
"public",
"static",
"function",
"get_all_filters",
"(",
")",
"{",
"// get all filter instances",
"$",
"filters",
"=",
"ClassInfo",
"::",
"subclassesFor",
"(",
"CMSSiteTreeFilter",
"::",
"class",
")",
";",
"// remove abstract CMSSiteTreeFilter class",
"array_shift",
"(",
... | Returns a sorted array of all implementators of CMSSiteTreeFilter, suitable for use in a dropdown.
@return array | [
"Returns",
"a",
"sorted",
"array",
"of",
"all",
"implementators",
"of",
"CMSSiteTreeFilter",
"suitable",
"for",
"use",
"in",
"a",
"dropdown",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSSiteTreeFilter.php#L74-L96 |
silverstripe/silverstripe-cms | code/Controllers/CMSSiteTreeFilter.php | CMSSiteTreeFilter.populateIDs | protected function populateIDs()
{
$parents = array();
$this->_cache_ids = array();
$this->_cache_highlight_ids = array();
if ($pages = $this->pagesIncluded()) {
// And keep a record of parents we don't need to get
// parents of themselves, as well as IDs to ... | php | protected function populateIDs()
{
$parents = array();
$this->_cache_ids = array();
$this->_cache_highlight_ids = array();
if ($pages = $this->pagesIncluded()) {
// And keep a record of parents we don't need to get
// parents of themselves, as well as IDs to ... | [
"protected",
"function",
"populateIDs",
"(",
")",
"{",
"$",
"parents",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"_cache_ids",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"_cache_highlight_ids",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
... | Populate the IDs of the pages returned by pagesIncluded(), also including
the necessary parent helper pages. | [
"Populate",
"the",
"IDs",
"of",
"the",
"pages",
"returned",
"by",
"pagesIncluded",
"()",
"also",
"including",
"the",
"necessary",
"parent",
"helper",
"pages",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSSiteTreeFilter.php#L149-L178 |
silverstripe/silverstripe-cms | code/Controllers/CMSSiteTreeFilter.php | CMSSiteTreeFilter.applyDefaultFilters | protected function applyDefaultFilters($query)
{
$sng = SiteTree::singleton();
foreach ($this->params as $name => $val) {
if (empty($val)) {
continue;
}
switch ($name) {
case 'Term':
$query = $query->filterAny(a... | php | protected function applyDefaultFilters($query)
{
$sng = SiteTree::singleton();
foreach ($this->params as $name => $val) {
if (empty($val)) {
continue;
}
switch ($name) {
case 'Term':
$query = $query->filterAny(a... | [
"protected",
"function",
"applyDefaultFilters",
"(",
"$",
"query",
")",
"{",
"$",
"sng",
"=",
"SiteTree",
"::",
"singleton",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"params",
"as",
"$",
"name",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"empty"... | Applies the default filters to a specified DataList of pages
@param DataList $query Unfiltered query
@return DataList Filtered query | [
"Applies",
"the",
"default",
"filters",
"to",
"a",
"specified",
"DataList",
"of",
"pages"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSSiteTreeFilter.php#L195-L239 |
silverstripe/silverstripe-cms | code/Controllers/CMSSiteTreeFilter.php | CMSSiteTreeFilter.mapIDs | protected function mapIDs($pages)
{
$ids = array();
if ($pages) {
foreach ($pages as $page) {
$ids[] = array('ID' => $page->ID, 'ParentID' => $page->ParentID);
}
}
return $ids;
} | php | protected function mapIDs($pages)
{
$ids = array();
if ($pages) {
foreach ($pages as $page) {
$ids[] = array('ID' => $page->ID, 'ParentID' => $page->ParentID);
}
}
return $ids;
} | [
"protected",
"function",
"mapIDs",
"(",
"$",
"pages",
")",
"{",
"$",
"ids",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"pages",
")",
"{",
"foreach",
"(",
"$",
"pages",
"as",
"$",
"page",
")",
"{",
"$",
"ids",
"[",
"]",
"=",
"array",
"(",
"'... | Maps a list of pages to an array of associative arrays with ID and ParentID keys
@param SS_List $pages
@return array | [
"Maps",
"a",
"list",
"of",
"pages",
"to",
"an",
"array",
"of",
"associative",
"arrays",
"with",
"ID",
"and",
"ParentID",
"keys"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSSiteTreeFilter.php#L247-L256 |
browscap/browscap | src/Browscap/Data/Factory/DivisionFactory.php | DivisionFactory.build | public function build(
array $divisionData,
string $filename,
bool $isCore
) : Division {
if (isset($divisionData['versions']) && is_array($divisionData['versions'])) {
$versions = $divisionData['versions'];
} else {
$versions = ['0.0'];
}
... | php | public function build(
array $divisionData,
string $filename,
bool $isCore
) : Division {
if (isset($divisionData['versions']) && is_array($divisionData['versions'])) {
$versions = $divisionData['versions'];
} else {
$versions = ['0.0'];
}
... | [
"public",
"function",
"build",
"(",
"array",
"$",
"divisionData",
",",
"string",
"$",
"filename",
",",
"bool",
"$",
"isCore",
")",
":",
"Division",
"{",
"if",
"(",
"isset",
"(",
"$",
"divisionData",
"[",
"'versions'",
"]",
")",
"&&",
"is_array",
"(",
"... | validates the $divisionData array and creates Division objects from it
@param array $divisionData
@param string $filename
@param bool $isCore
@return Division | [
"validates",
"the",
"$divisionData",
"array",
"and",
"creates",
"Division",
"objects",
"from",
"it"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Factory/DivisionFactory.php#L39-L59 |
browscap/browscap | src/Browscap/Data/Factory/EngineFactory.php | EngineFactory.build | public function build(array $engineData, array $dataAllEngines, string $engineName) : Engine
{
Assertion::isArray($engineData, 'each entry inside the "engines" structure has to be an array');
if (!array_key_exists('properties', $engineData) && !array_key_exists('inherits', $engineData)) {
... | php | public function build(array $engineData, array $dataAllEngines, string $engineName) : Engine
{
Assertion::isArray($engineData, 'each entry inside the "engines" structure has to be an array');
if (!array_key_exists('properties', $engineData) && !array_key_exists('inherits', $engineData)) {
... | [
"public",
"function",
"build",
"(",
"array",
"$",
"engineData",
",",
"array",
"$",
"dataAllEngines",
",",
"string",
"$",
"engineName",
")",
":",
"Engine",
"{",
"Assertion",
"::",
"isArray",
"(",
"$",
"engineData",
",",
"'each entry inside the \"engines\" structure... | validates the $engineData array and creates Engine objects from it
@param array $engineData The Engine data for the current object
@param array $dataAllEngines The Engine data for all engines
@param string $engineName The name for the current engine
@throws \RuntimeException if the file does ... | [
"validates",
"the",
"$engineData",
"array",
"and",
"creates",
"Engine",
"objects",
"from",
"it"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Factory/EngineFactory.php#L22-L64 |
browscap/browscap | src/Browscap/Data/Factory/DataCollectionFactory.php | DataCollectionFactory.createDataCollection | public function createDataCollection(string $resourceFolder) : DataCollection
{
$this->logger->debug('add platform file');
$this->addPlatformsFile($resourceFolder . '/platforms.json');
$this->logger->debug('add engine file');
$this->addEnginesFile($resourceFolder . '/engines.json');... | php | public function createDataCollection(string $resourceFolder) : DataCollection
{
$this->logger->debug('add platform file');
$this->addPlatformsFile($resourceFolder . '/platforms.json');
$this->logger->debug('add engine file');
$this->addEnginesFile($resourceFolder . '/engines.json');... | [
"public",
"function",
"createDataCollection",
"(",
"string",
"$",
"resourceFolder",
")",
":",
"DataCollection",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"'add platform file'",
")",
";",
"$",
"this",
"->",
"addPlatformsFile",
"(",
"$",
"resourceFolde... | Create and populate a data collection object from a resource folder
@param string $resourceFolder
@throws \Assert\AssertionFailedException
@throws \RuntimeException
@throws \UnexpectedValueException
@return DataCollection | [
"Create",
"and",
"populate",
"a",
"data",
"collection",
"object",
"from",
"a",
"resource",
"folder"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Factory/DataCollectionFactory.php#L68-L119 |
browscap/browscap | src/Browscap/Data/Factory/DataCollectionFactory.php | DataCollectionFactory.addPlatformsFile | public function addPlatformsFile(string $filename) : void
{
$decodedFileContent = $this->loadFile($filename);
$platformFactory = new PlatformFactory();
foreach (array_keys($decodedFileContent) as $platformName) {
$platformName = (string) $platformName;
$platformData... | php | public function addPlatformsFile(string $filename) : void
{
$decodedFileContent = $this->loadFile($filename);
$platformFactory = new PlatformFactory();
foreach (array_keys($decodedFileContent) as $platformName) {
$platformName = (string) $platformName;
$platformData... | [
"public",
"function",
"addPlatformsFile",
"(",
"string",
"$",
"filename",
")",
":",
"void",
"{",
"$",
"decodedFileContent",
"=",
"$",
"this",
"->",
"loadFile",
"(",
"$",
"filename",
")",
";",
"$",
"platformFactory",
"=",
"new",
"PlatformFactory",
"(",
")",
... | Load a platforms.json file and parse it into the platforms data array, validates these data and creates a
collection of Platform objects
@param string $filename Name of the file
@throws \RuntimeException if the file does not exist or has invalid JSON
@throws \UnexpectedValueException
@throws \Assert\As... | [
"Load",
"a",
"platforms",
".",
"json",
"file",
"and",
"parse",
"it",
"into",
"the",
"platforms",
"data",
"array",
"validates",
"these",
"data",
"and",
"creates",
"a",
"collection",
"of",
"Platform",
"objects"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Factory/DataCollectionFactory.php#L131-L143 |
browscap/browscap | src/Browscap/Data/Factory/DataCollectionFactory.php | DataCollectionFactory.addEnginesFile | public function addEnginesFile(string $filename) : void
{
$decodedFileContent = $this->loadFile($filename);
$engineFactory = new EngineFactory();
foreach (array_keys($decodedFileContent) as $engineName) {
$engineName = (string) $engineName;
$engineData = $decodedFil... | php | public function addEnginesFile(string $filename) : void
{
$decodedFileContent = $this->loadFile($filename);
$engineFactory = new EngineFactory();
foreach (array_keys($decodedFileContent) as $engineName) {
$engineName = (string) $engineName;
$engineData = $decodedFil... | [
"public",
"function",
"addEnginesFile",
"(",
"string",
"$",
"filename",
")",
":",
"void",
"{",
"$",
"decodedFileContent",
"=",
"$",
"this",
"->",
"loadFile",
"(",
"$",
"filename",
")",
";",
"$",
"engineFactory",
"=",
"new",
"EngineFactory",
"(",
")",
";",
... | Load a engines.json file and parse it into the platforms data array, validates these data and creates a
collection of Engine objects
@param string $filename Name of the file
@throws \RuntimeException if the file does not exist or has invalid JSON
@throws \Assert\AssertionFailedException | [
"Load",
"a",
"engines",
".",
"json",
"file",
"and",
"parse",
"it",
"into",
"the",
"platforms",
"data",
"array",
"validates",
"these",
"data",
"and",
"creates",
"a",
"collection",
"of",
"Engine",
"objects"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Factory/DataCollectionFactory.php#L154-L166 |
browscap/browscap | src/Browscap/Data/Factory/DataCollectionFactory.php | DataCollectionFactory.addBrowserFile | public function addBrowserFile(string $filename) : void
{
$decodedFileContent = $this->loadFile($filename);
Assertion::isArray($decodedFileContent, 'required "browsers" structure has to be an array');
$browserFactory = new BrowserFactory();
foreach (array_keys($decodedFileContent)... | php | public function addBrowserFile(string $filename) : void
{
$decodedFileContent = $this->loadFile($filename);
Assertion::isArray($decodedFileContent, 'required "browsers" structure has to be an array');
$browserFactory = new BrowserFactory();
foreach (array_keys($decodedFileContent)... | [
"public",
"function",
"addBrowserFile",
"(",
"string",
"$",
"filename",
")",
":",
"void",
"{",
"$",
"decodedFileContent",
"=",
"$",
"this",
"->",
"loadFile",
"(",
"$",
"filename",
")",
";",
"Assertion",
"::",
"isArray",
"(",
"$",
"decodedFileContent",
",",
... | Load a browsers.json file and parse it into the browsers data array, validates these data and creates a
collection of Browser objects
@param string $filename Name of the file
@throws \RuntimeException if the file does not exist or has invalid JSON
@throws \Assert\AssertionFailedException | [
"Load",
"a",
"browsers",
".",
"json",
"file",
"and",
"parse",
"it",
"into",
"the",
"browsers",
"data",
"array",
"validates",
"these",
"data",
"and",
"creates",
"a",
"collection",
"of",
"Browser",
"objects"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Factory/DataCollectionFactory.php#L177-L191 |
browscap/browscap | src/Browscap/Data/Factory/DataCollectionFactory.php | DataCollectionFactory.addDevicesFile | public function addDevicesFile(string $filename) : void
{
$decodedFileContent = $this->loadFile($filename);
foreach ($decodedFileContent as $deviceName => $deviceData) {
$this->collection->addDevice($deviceName, $this->deviceFactory->build($deviceData, $deviceName));
}
} | php | public function addDevicesFile(string $filename) : void
{
$decodedFileContent = $this->loadFile($filename);
foreach ($decodedFileContent as $deviceName => $deviceData) {
$this->collection->addDevice($deviceName, $this->deviceFactory->build($deviceData, $deviceName));
}
} | [
"public",
"function",
"addDevicesFile",
"(",
"string",
"$",
"filename",
")",
":",
"void",
"{",
"$",
"decodedFileContent",
"=",
"$",
"this",
"->",
"loadFile",
"(",
"$",
"filename",
")",
";",
"foreach",
"(",
"$",
"decodedFileContent",
"as",
"$",
"deviceName",
... | Load a devices.json file and parse it into the platforms data array, validates these data and creates a
collection of Device objects
@param string $filename Name of the file
@throws \Assert\AssertionFailedException
@throws \RuntimeException if the file does not exist or has invalid JSON | [
"Load",
"a",
"devices",
".",
"json",
"file",
"and",
"parse",
"it",
"into",
"the",
"platforms",
"data",
"array",
"validates",
"these",
"data",
"and",
"creates",
"a",
"collection",
"of",
"Device",
"objects"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Factory/DataCollectionFactory.php#L202-L209 |
browscap/browscap | src/Browscap/Data/Factory/DataCollectionFactory.php | DataCollectionFactory.addSourceFile | public function addSourceFile(string $filename) : void
{
$divisionData = $this->loadFile($filename);
$this->divisionDataValidator->validate($divisionData, $filename, $this->allDivisions, false);
$this->collection->addDivision(
$this->divisionFactory->build(
$div... | php | public function addSourceFile(string $filename) : void
{
$divisionData = $this->loadFile($filename);
$this->divisionDataValidator->validate($divisionData, $filename, $this->allDivisions, false);
$this->collection->addDivision(
$this->divisionFactory->build(
$div... | [
"public",
"function",
"addSourceFile",
"(",
"string",
"$",
"filename",
")",
":",
"void",
"{",
"$",
"divisionData",
"=",
"$",
"this",
"->",
"loadFile",
"(",
"$",
"filename",
")",
";",
"$",
"this",
"->",
"divisionDataValidator",
"->",
"validate",
"(",
"$",
... | Load a JSON file, parse it's JSON to arrays, validates these data and creates a
collection of Division objects
@param string $filename Name of the file
@throws \Assert\AssertionFailedException
@throws \RuntimeException If the file does not exist or has invalid JSON | [
"Load",
"a",
"JSON",
"file",
"parse",
"it",
"s",
"JSON",
"to",
"arrays",
"validates",
"these",
"data",
"and",
"creates",
"a",
"collection",
"of",
"Division",
"objects"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Factory/DataCollectionFactory.php#L220-L233 |
browscap/browscap | src/Browscap/Data/Factory/DataCollectionFactory.php | DataCollectionFactory.setDefaultProperties | public function setDefaultProperties(string $filename) : void
{
$divisionData = $this->loadFile($filename);
$this->divisionDataValidator->validate($divisionData, $filename, $this->allDivisions, true);
$this->collection->setDefaultProperties(
$this->divisionFactory->build(
... | php | public function setDefaultProperties(string $filename) : void
{
$divisionData = $this->loadFile($filename);
$this->divisionDataValidator->validate($divisionData, $filename, $this->allDivisions, true);
$this->collection->setDefaultProperties(
$this->divisionFactory->build(
... | [
"public",
"function",
"setDefaultProperties",
"(",
"string",
"$",
"filename",
")",
":",
"void",
"{",
"$",
"divisionData",
"=",
"$",
"this",
"->",
"loadFile",
"(",
"$",
"filename",
")",
";",
"$",
"this",
"->",
"divisionDataValidator",
"->",
"validate",
"(",
... | Load the file for the default properties
@param string $filename Name of the file
@throws \Assert\AssertionFailedException
@throws \RuntimeException if the file does not exist or has invalid JSON | [
"Load",
"the",
"file",
"for",
"the",
"default",
"properties"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Factory/DataCollectionFactory.php#L243-L255 |
browscap/browscap | src/Browscap/Data/Factory/DataCollectionFactory.php | DataCollectionFactory.loadFile | private function loadFile(string $filename) : array
{
Assertion::file($filename, 'File "' . $filename . '" does not exist.');
Assertion::readable($filename, 'File "' . $filename . '" is not readable.');
/** @var string $fileContent */
$fileContent = file_get_contents($filename);
... | php | private function loadFile(string $filename) : array
{
Assertion::file($filename, 'File "' . $filename . '" does not exist.');
Assertion::readable($filename, 'File "' . $filename . '" is not readable.');
/** @var string $fileContent */
$fileContent = file_get_contents($filename);
... | [
"private",
"function",
"loadFile",
"(",
"string",
"$",
"filename",
")",
":",
"array",
"{",
"Assertion",
"::",
"file",
"(",
"$",
"filename",
",",
"'File \"'",
".",
"$",
"filename",
".",
"'\" does not exist.'",
")",
";",
"Assertion",
"::",
"readable",
"(",
"... | @param string $filename
@throws \RuntimeException
@throws \Assert\AssertionFailedException
@return array | [
"@param",
"string",
"$filename"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Factory/DataCollectionFactory.php#L287-L312 |
browscap/browscap | src/Browscap/Filter/FullFilter.php | FullFilter.isOutputProperty | public function isOutputProperty(string $property, WriterInterface $writer) : bool
{
return $this->propertyHolder->isOutputProperty($property, $writer);
} | php | public function isOutputProperty(string $property, WriterInterface $writer) : bool
{
return $this->propertyHolder->isOutputProperty($property, $writer);
} | [
"public",
"function",
"isOutputProperty",
"(",
"string",
"$",
"property",
",",
"WriterInterface",
"$",
"writer",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"propertyHolder",
"->",
"isOutputProperty",
"(",
"$",
"property",
",",
"$",
"writer",
")",
";... | checks if a property should be in the output
@param string $property
@param WriterInterface $writer
@return bool | [
"checks",
"if",
"a",
"property",
"should",
"be",
"in",
"the",
"output"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Filter/FullFilter.php#L69-L72 |
browscap/browscap | src/Browscap/Writer/IniWriter.php | IniWriter.renderHeader | public function renderHeader(array $comments = []) : void
{
if ($this->isSilent()) {
return;
}
$this->logger->debug('rendering comments');
foreach ($comments as $comment) {
fwrite($this->file, ';;; ' . $comment . PHP_EOL);
}
fwrite($this->fi... | php | public function renderHeader(array $comments = []) : void
{
if ($this->isSilent()) {
return;
}
$this->logger->debug('rendering comments');
foreach ($comments as $comment) {
fwrite($this->file, ';;; ' . $comment . PHP_EOL);
}
fwrite($this->fi... | [
"public",
"function",
"renderHeader",
"(",
"array",
"$",
"comments",
"=",
"[",
"]",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"isSilent",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"'renderin... | Generate the header
@param string[] $comments | [
"Generate",
"the",
"header"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/IniWriter.php#L156-L169 |
browscap/browscap | src/Browscap/Writer/IniWriter.php | IniWriter.renderVersion | public function renderVersion(array $versionData = []) : void
{
if ($this->isSilent()) {
return;
}
$this->logger->debug('rendering version information');
$this->renderDivisionHeader('Browscap Version');
fwrite($this->file, '[GJK_Browscap_Version]' . PHP_EOL);
... | php | public function renderVersion(array $versionData = []) : void
{
if ($this->isSilent()) {
return;
}
$this->logger->debug('rendering version information');
$this->renderDivisionHeader('Browscap Version');
fwrite($this->file, '[GJK_Browscap_Version]' . PHP_EOL);
... | [
"public",
"function",
"renderVersion",
"(",
"array",
"$",
"versionData",
"=",
"[",
"]",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"isSilent",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"'rend... | renders the version information
@param string[] $versionData | [
"renders",
"the",
"version",
"information"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/IniWriter.php#L176-L208 |
browscap/browscap | src/Browscap/Writer/IniWriter.php | IniWriter.renderDivisionHeader | public function renderDivisionHeader(string $division, string $parent = 'DefaultProperties') : void
{
if ($this->isSilent() || 'DefaultProperties' !== $parent) {
return;
}
fwrite($this->file, ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ' . $division . PHP_EOL . PHP_EOL);
} | php | public function renderDivisionHeader(string $division, string $parent = 'DefaultProperties') : void
{
if ($this->isSilent() || 'DefaultProperties' !== $parent) {
return;
}
fwrite($this->file, ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ' . $division . PHP_EOL . PHP_EOL);
} | [
"public",
"function",
"renderDivisionHeader",
"(",
"string",
"$",
"division",
",",
"string",
"$",
"parent",
"=",
"'DefaultProperties'",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"isSilent",
"(",
")",
"||",
"'DefaultProperties'",
"!==",
"$",
"paren... | renders the header for a division
@param string $division
@param string $parent | [
"renders",
"the",
"header",
"for",
"a",
"division"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/IniWriter.php#L226-L233 |
browscap/browscap | src/Browscap/Writer/IniWriter.php | IniWriter.renderSectionBody | public function renderSectionBody(array $section, DataCollection $collection, array $sections = [], string $sectionName = '') : void
{
if ($this->isSilent()) {
return;
}
$division = $collection->getDefaultProperties();
$ua = $division->getUserAgen... | php | public function renderSectionBody(array $section, DataCollection $collection, array $sections = [], string $sectionName = '') : void
{
if ($this->isSilent()) {
return;
}
$division = $collection->getDefaultProperties();
$ua = $division->getUserAgen... | [
"public",
"function",
"renderSectionBody",
"(",
"array",
"$",
"section",
",",
"DataCollection",
"$",
"collection",
",",
"array",
"$",
"sections",
"=",
"[",
"]",
",",
"string",
"$",
"sectionName",
"=",
"''",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
... | renders all found useragents into a string
@param array $section
@param DataCollection $collection
@param array[] $sections
@param string $sectionName
@throws \InvalidArgumentException | [
"renders",
"all",
"found",
"useragents",
"into",
"a",
"string"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/IniWriter.php#L259-L317 |
browscap/browscap | src/Browscap/Data/Expander.php | Expander.expand | public function expand(Division $division, string $divisionName) : array
{
$defaultproperties = $this->collection->getDefaultProperties()->getUserAgents()[0];
$allInputDivisions = [$defaultproperties->getUserAgent() => $defaultproperties->getProperties()];
$allExpandedDivisions = [];
... | php | public function expand(Division $division, string $divisionName) : array
{
$defaultproperties = $this->collection->getDefaultProperties()->getUserAgents()[0];
$allInputDivisions = [$defaultproperties->getUserAgent() => $defaultproperties->getProperties()];
$allExpandedDivisions = [];
... | [
"public",
"function",
"expand",
"(",
"Division",
"$",
"division",
",",
"string",
"$",
"divisionName",
")",
":",
"array",
"{",
"$",
"defaultproperties",
"=",
"$",
"this",
"->",
"collection",
"->",
"getDefaultProperties",
"(",
")",
"->",
"getUserAgents",
"(",
... | @param Division $division
@param string $divisionName
@throws \UnexpectedValueException
@throws \OutOfBoundsException
@throws \Browscap\Data\DuplicateDataException
@return array | [
"@param",
"Division",
"$division",
"@param",
"string",
"$divisionName"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Expander.php#L59-L87 |
browscap/browscap | src/Browscap/Data/Expander.php | Expander.parseDivision | private function parseDivision(Division $division, string $divisionName) : \Generator
{
$i = 0;
foreach ($division->getUserAgents() as $uaData) {
$this->resetPatternId();
$this->patternId['division'] = $division->getFileName();
$this->patternId['useragent'] = $i;... | php | private function parseDivision(Division $division, string $divisionName) : \Generator
{
$i = 0;
foreach ($division->getUserAgents() as $uaData) {
$this->resetPatternId();
$this->patternId['division'] = $division->getFileName();
$this->patternId['useragent'] = $i;... | [
"private",
"function",
"parseDivision",
"(",
"Division",
"$",
"division",
",",
"string",
"$",
"divisionName",
")",
":",
"\\",
"Generator",
"{",
"$",
"i",
"=",
"0",
";",
"foreach",
"(",
"$",
"division",
"->",
"getUserAgents",
"(",
")",
"as",
"$",
"uaData"... | parses and expands a single division
@param Division $division
@param string $divisionName
@throws \OutOfBoundsException
@throws \UnexpectedValueException
@return \Generator | [
"parses",
"and",
"expands",
"a",
"single",
"division"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Expander.php#L114-L133 |
browscap/browscap | src/Browscap/Data/Expander.php | Expander.parseUserAgent | private function parseUserAgent(UserAgent $uaData, bool $lite, bool $standard, int $sortIndex, string $divisionName) : \Generator
{
$uaProperties = $uaData->getProperties();
if (null !== $uaData->getPlatform()) {
$this->patternId['platform'] = $uaData->getPlatform();
$platfo... | php | private function parseUserAgent(UserAgent $uaData, bool $lite, bool $standard, int $sortIndex, string $divisionName) : \Generator
{
$uaProperties = $uaData->getProperties();
if (null !== $uaData->getPlatform()) {
$this->patternId['platform'] = $uaData->getPlatform();
$platfo... | [
"private",
"function",
"parseUserAgent",
"(",
"UserAgent",
"$",
"uaData",
",",
"bool",
"$",
"lite",
",",
"bool",
"$",
"standard",
",",
"int",
"$",
"sortIndex",
",",
"string",
"$",
"divisionName",
")",
":",
"\\",
"Generator",
"{",
"$",
"uaProperties",
"=",
... | parses and expands a single User Agent block
@param UserAgent $uaData
@param bool $lite
@param bool $standard
@param int $sortIndex
@param string $divisionName
@throws \OutOfBoundsException
@throws \UnexpectedValueException
@return \Generator | [
"parses",
"and",
"expands",
"a",
"single",
"User",
"Agent",
"block"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Expander.php#L149-L279 |
browscap/browscap | src/Browscap/Data/Expander.php | Expander.parseChildren | private function parseChildren(string $ua, array $uaDataChild, bool $lite = true, bool $standard = true) : \Generator
{
if (isset($uaDataChild['platforms']) && is_array($uaDataChild['platforms'])) {
foreach ($uaDataChild['platforms'] as $platform) {
$this->patternId['platform'] =... | php | private function parseChildren(string $ua, array $uaDataChild, bool $lite = true, bool $standard = true) : \Generator
{
if (isset($uaDataChild['platforms']) && is_array($uaDataChild['platforms'])) {
foreach ($uaDataChild['platforms'] as $platform) {
$this->patternId['platform'] =... | [
"private",
"function",
"parseChildren",
"(",
"string",
"$",
"ua",
",",
"array",
"$",
"uaDataChild",
",",
"bool",
"$",
"lite",
"=",
"true",
",",
"bool",
"$",
"standard",
"=",
"true",
")",
":",
"\\",
"Generator",
"{",
"if",
"(",
"isset",
"(",
"$",
"uaD... | parses and expands the children section in a single User Agent block
@param string $ua
@param array $uaDataChild
@param bool $lite
@param bool $standard
@throws \OutOfBoundsException
@throws \UnexpectedValueException
@return \Generator | [
"parses",
"and",
"expands",
"the",
"children",
"section",
"in",
"a",
"single",
"User",
"Agent",
"block"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Expander.php#L294-L480 |
browscap/browscap | src/Browscap/Data/Expander.php | Expander.getPatternId | private function getPatternId() : string
{
return sprintf(
'%s::u%d::c%d::d%s::p%s',
$this->patternId['division'],
$this->patternId['useragent'],
$this->patternId['child'],
$this->patternId['device'],
$this->patternId['platform']
... | php | private function getPatternId() : string
{
return sprintf(
'%s::u%d::c%d::d%s::p%s',
$this->patternId['division'],
$this->patternId['useragent'],
$this->patternId['child'],
$this->patternId['device'],
$this->patternId['platform']
... | [
"private",
"function",
"getPatternId",
"(",
")",
":",
"string",
"{",
"return",
"sprintf",
"(",
"'%s::u%d::c%d::d%s::p%s'",
",",
"$",
"this",
"->",
"patternId",
"[",
"'division'",
"]",
",",
"$",
"this",
"->",
"patternId",
"[",
"'useragent'",
"]",
",",
"$",
... | Builds and returns the string pattern id from the array components
@return string | [
"Builds",
"and",
"returns",
"the",
"string",
"pattern",
"id",
"from",
"the",
"array",
"components"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Expander.php#L487-L497 |
browscap/browscap | src/Browscap/Data/Expander.php | Expander.expandProperties | private function expandProperties(string $ua, array $properties, array $defaultproperties, array $allInputDivisions) : array
{
$this->logger->debug('expand all properties for useragent "' . $ua . '"');
$userAgent = $ua;
$parents = [$userAgent];
while (isset($allInputDivisions[$us... | php | private function expandProperties(string $ua, array $properties, array $defaultproperties, array $allInputDivisions) : array
{
$this->logger->debug('expand all properties for useragent "' . $ua . '"');
$userAgent = $ua;
$parents = [$userAgent];
while (isset($allInputDivisions[$us... | [
"private",
"function",
"expandProperties",
"(",
"string",
"$",
"ua",
",",
"array",
"$",
"properties",
",",
"array",
"$",
"defaultproperties",
",",
"array",
"$",
"allInputDivisions",
")",
":",
"array",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"... | expands all properties for one useragent to make sure all properties are set and make it possible to skip
incomplete properties and remove duplicate definitions
@param string $ua
@param array $properties
@param array $defaultproperties
@param array $allInputDivisions
@return array | [
"expands",
"all",
"properties",
"for",
"one",
"useragent",
"to",
"make",
"sure",
"all",
"properties",
"are",
"set",
"and",
"make",
"it",
"possible",
"to",
"skip",
"incomplete",
"properties",
"and",
"remove",
"duplicate",
"definitions"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Expander.php#L510-L583 |
browscap/browscap | src/Browscap/Writer/Factory/PhpWriterFactory.php | PhpWriterFactory.createCollection | public function createCollection(LoggerInterface $logger, string $buildFolder) : WriterCollection
{
$writerCollection = new WriterCollection();
$propertyHolder = new PropertyHolder();
$fullFilter = new FullFilter($propertyHolder);
$stdFilter = new StandardFilter($propertyHolder);... | php | public function createCollection(LoggerInterface $logger, string $buildFolder) : WriterCollection
{
$writerCollection = new WriterCollection();
$propertyHolder = new PropertyHolder();
$fullFilter = new FullFilter($propertyHolder);
$stdFilter = new StandardFilter($propertyHolder);... | [
"public",
"function",
"createCollection",
"(",
"LoggerInterface",
"$",
"logger",
",",
"string",
"$",
"buildFolder",
")",
":",
"WriterCollection",
"{",
"$",
"writerCollection",
"=",
"new",
"WriterCollection",
"(",
")",
";",
"$",
"propertyHolder",
"=",
"new",
"Pro... | @param LoggerInterface $logger
@param string $buildFolder
@return WriterCollection | [
"@param",
"LoggerInterface",
"$logger",
"@param",
"string",
"$buildFolder"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/Factory/PhpWriterFactory.php#L25-L52 |
browscap/browscap | src/Browscap/Data/Factory/BrowserFactory.php | BrowserFactory.build | public function build(array $browserData, $browserName)
{
if (!isset($browserData['properties']) || !is_array($browserData['properties'])) {
$browserData['properties'] = [];
}
Assertion::keyExists($browserData, 'standard', 'the value for "standard" key is missing for browser "' ... | php | public function build(array $browserData, $browserName)
{
if (!isset($browserData['properties']) || !is_array($browserData['properties'])) {
$browserData['properties'] = [];
}
Assertion::keyExists($browserData, 'standard', 'the value for "standard" key is missing for browser "' ... | [
"public",
"function",
"build",
"(",
"array",
"$",
"browserData",
",",
"$",
"browserName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"browserData",
"[",
"'properties'",
"]",
")",
"||",
"!",
"is_array",
"(",
"$",
"browserData",
"[",
"'properties'",
"]",... | validates the $browserData array and creates Browser objects from it
@param array $browserData
@param string $browserName
@throws \RuntimeException if the file does not exist or has invalid JSON
@throws \Assert\AssertionFailedException
@return \Browscap\Data\Browser | [
"validates",
"the",
"$browserData",
"array",
"and",
"creates",
"Browser",
"objects",
"from",
"it"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Factory/BrowserFactory.php#L22-L46 |
browscap/browscap | src/Browscap/Data/Factory/UserAgentFactory.php | UserAgentFactory.build | public function build(array $userAgentsData, bool $isCore) : array
{
$useragents = [];
foreach ($userAgentsData as $useragent) {
$children = [];
if (!$isCore) {
$children = $useragent['children'];
}
$useragents[] = new UserAgent(
... | php | public function build(array $userAgentsData, bool $isCore) : array
{
$useragents = [];
foreach ($userAgentsData as $useragent) {
$children = [];
if (!$isCore) {
$children = $useragent['children'];
}
$useragents[] = new UserAgent(
... | [
"public",
"function",
"build",
"(",
"array",
"$",
"userAgentsData",
",",
"bool",
"$",
"isCore",
")",
":",
"array",
"{",
"$",
"useragents",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"userAgentsData",
"as",
"$",
"useragent",
")",
"{",
"$",
"children",
"="... | validates the $userAgentsData array and creates at least one Useragent object from it
@param array[] $userAgentsData
@param bool $isCore
@return UserAgent[] | [
"validates",
"the",
"$userAgentsData",
"array",
"and",
"creates",
"at",
"least",
"one",
"Useragent",
"object",
"from",
"it"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Factory/UserAgentFactory.php#L17-L40 |
browscap/browscap | src/Browscap/Data/Helper/TrimProperty.php | TrimProperty.trimProperty | public function trimProperty(string $propertyValue)
{
switch ($propertyValue) {
case 'true':
$propertyValue = true;
break;
case 'false':
$propertyValue = false;
break;
default:
$propertyValu... | php | public function trimProperty(string $propertyValue)
{
switch ($propertyValue) {
case 'true':
$propertyValue = true;
break;
case 'false':
$propertyValue = false;
break;
default:
$propertyValu... | [
"public",
"function",
"trimProperty",
"(",
"string",
"$",
"propertyValue",
")",
"{",
"switch",
"(",
"$",
"propertyValue",
")",
"{",
"case",
"'true'",
":",
"$",
"propertyValue",
"=",
"true",
";",
"break",
";",
"case",
"'false'",
":",
"$",
"propertyValue",
"... | trims the value of a property and converts the string values "true" and "false" to boolean
@param string $propertyValue
@return bool|string | [
"trims",
"the",
"value",
"of",
"a",
"property",
"and",
"converts",
"the",
"string",
"values",
"true",
"and",
"false",
"to",
"boolean"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Helper/TrimProperty.php#L14-L32 |
browscap/browscap | src/Browscap/Data/Validator/PropertiesValidator.php | PropertiesValidator.validate | public function validate(array $properties, string $key) : void
{
if (!in_array($key, ['DefaultProperties', '*'])) {
Assertion::keyExists($properties, 'Parent', 'property "Parent" is missing for key "' . $key . '"');
Assertion::string($properties['Parent'], 'property "Parent" must be... | php | public function validate(array $properties, string $key) : void
{
if (!in_array($key, ['DefaultProperties', '*'])) {
Assertion::keyExists($properties, 'Parent', 'property "Parent" is missing for key "' . $key . '"');
Assertion::string($properties['Parent'], 'property "Parent" must be... | [
"public",
"function",
"validate",
"(",
"array",
"$",
"properties",
",",
"string",
"$",
"key",
")",
":",
"void",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"key",
",",
"[",
"'DefaultProperties'",
",",
"'*'",
"]",
")",
")",
"{",
"Assertion",
"::",
"key... | validates the fully expanded properties
@param array $properties Data to validate
@param string $key
@throws \LogicException
@throws \Assert\AssertionFailedException | [
"validates",
"the",
"fully",
"expanded",
"properties"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Validator/PropertiesValidator.php#L18-L165 |
browscap/browscap | src/Browscap/Command/ValidateDivisionsCommand.php | ValidateDivisionsCommand.execute | protected function execute(InputInterface $input, OutputInterface $output) : ?int
{
$loggerHelper = new LoggerHelper();
$logger = $loggerHelper->create($output);
/** @var string $resources */
$resources = $input->getOption('resources');
$divisionsResourcePath = $resou... | php | protected function execute(InputInterface $input, OutputInterface $output) : ?int
{
$loggerHelper = new LoggerHelper();
$logger = $loggerHelper->create($output);
/** @var string $resources */
$resources = $input->getOption('resources');
$divisionsResourcePath = $resou... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
":",
"?",
"int",
"{",
"$",
"loggerHelper",
"=",
"new",
"LoggerHelper",
"(",
")",
";",
"$",
"logger",
"=",
"$",
"loggerHelper",
"->",
"creat... | @param InputInterface $input
@param OutputInterface $output
@return int|null null or 0 if everything went fine, or an error code | [
"@param",
"InputInterface",
"$input",
"@param",
"OutputInterface",
"$output"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Command/ValidateDivisionsCommand.php#L40-L115 |
browscap/browscap | src/Browscap/Generator/BuildGenerator.php | BuildGenerator.run | public function run(string $buildVersion, bool $createZipFile = true) : void
{
$this->logger->info('Resource folder: ' . $this->resourceFolder . '');
$this->logger->info('Build folder: ' . $this->buildFolder . '');
Helper\BuildHelper::run(
$buildVersion,
$this->resou... | php | public function run(string $buildVersion, bool $createZipFile = true) : void
{
$this->logger->info('Resource folder: ' . $this->resourceFolder . '');
$this->logger->info('Build folder: ' . $this->buildFolder . '');
Helper\BuildHelper::run(
$buildVersion,
$this->resou... | [
"public",
"function",
"run",
"(",
"string",
"$",
"buildVersion",
",",
"bool",
"$",
"createZipFile",
"=",
"true",
")",
":",
"void",
"{",
"$",
"this",
"->",
"logger",
"->",
"info",
"(",
"'Resource folder: '",
".",
"$",
"this",
"->",
"resourceFolder",
".",
... | Entry point for generating builds for a specified version
@param string $buildVersion
@param bool $createZipFile
@throws \Exception
@throws \Assert\AssertionFailedException | [
"Entry",
"point",
"for",
"generating",
"builds",
"for",
"a",
"specified",
"version"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Generator/BuildGenerator.php#L72-L120 |
browscap/browscap | src/Browscap/Generator/BuildGenerator.php | BuildGenerator.checkDirectoryExists | private function checkDirectoryExists(string $directory) : string
{
$realDirectory = realpath($directory);
if (false === $realDirectory) {
throw new DirectoryMissingException('The directory "' . $directory . '" does not exist, or we cannot access it');
}
if (!is_dir($re... | php | private function checkDirectoryExists(string $directory) : string
{
$realDirectory = realpath($directory);
if (false === $realDirectory) {
throw new DirectoryMissingException('The directory "' . $directory . '" does not exist, or we cannot access it');
}
if (!is_dir($re... | [
"private",
"function",
"checkDirectoryExists",
"(",
"string",
"$",
"directory",
")",
":",
"string",
"{",
"$",
"realDirectory",
"=",
"realpath",
"(",
"$",
"directory",
")",
";",
"if",
"(",
"false",
"===",
"$",
"realDirectory",
")",
"{",
"throw",
"new",
"Dir... | @param string $directory
@throws \InvalidArgumentException
@return string | [
"@param",
"string",
"$directory"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Generator/BuildGenerator.php#L139-L152 |
browscap/browscap | src/Browscap/Helper/LoggerHelper.php | LoggerHelper.create | public function create(OutputInterface $output) : LoggerInterface
{
$logger = new Logger('browscap');
$consoleLogger = new ConsoleLogger($output);
$psrHandler = new PsrHandler($consoleLogger);
$logger->pushHandler($psrHandler);
$logger->pushHandler(new ErrorLogHand... | php | public function create(OutputInterface $output) : LoggerInterface
{
$logger = new Logger('browscap');
$consoleLogger = new ConsoleLogger($output);
$psrHandler = new PsrHandler($consoleLogger);
$logger->pushHandler($psrHandler);
$logger->pushHandler(new ErrorLogHand... | [
"public",
"function",
"create",
"(",
"OutputInterface",
"$",
"output",
")",
":",
"LoggerInterface",
"{",
"$",
"logger",
"=",
"new",
"Logger",
"(",
"'browscap'",
")",
";",
"$",
"consoleLogger",
"=",
"new",
"ConsoleLogger",
"(",
"$",
"output",
")",
";",
"$",... | creates an instance of a PSR-3 Logger
@param OutputInterface $output
@return LoggerInterface | [
"creates",
"an",
"instance",
"of",
"a",
"PSR",
"-",
"3",
"Logger"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Helper/LoggerHelper.php#L22-L34 |
browscap/browscap | src/Browscap/Writer/CsvWriter.php | CsvWriter.renderVersion | public function renderVersion(array $versionData = []) : void
{
if ($this->isSilent()) {
return;
}
$this->logger->debug('rendering version information');
fwrite($this->file, '"GJK_Browscap_Version","GJK_Browscap_Version"' . PHP_EOL);
if (!isset($versionData['ve... | php | public function renderVersion(array $versionData = []) : void
{
if ($this->isSilent()) {
return;
}
$this->logger->debug('rendering version information');
fwrite($this->file, '"GJK_Browscap_Version","GJK_Browscap_Version"' . PHP_EOL);
if (!isset($versionData['ve... | [
"public",
"function",
"renderVersion",
"(",
"array",
"$",
"versionData",
"=",
"[",
"]",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"isSilent",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"'rend... | renders the version information
@param string[] $versionData | [
"renders",
"the",
"version",
"information"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/CsvWriter.php#L159-L178 |
browscap/browscap | src/Browscap/Writer/CsvWriter.php | CsvWriter.renderAllDivisionsHeader | public function renderAllDivisionsHeader(DataCollection $collection) : void
{
$division = $collection->getDefaultProperties();
$ua = $division->getUserAgents()[0];
if (empty($ua->getProperties())) {
return;
}
$defaultproperties = $ua->getProperties();
... | php | public function renderAllDivisionsHeader(DataCollection $collection) : void
{
$division = $collection->getDefaultProperties();
$ua = $division->getUserAgents()[0];
if (empty($ua->getProperties())) {
return;
}
$defaultproperties = $ua->getProperties();
... | [
"public",
"function",
"renderAllDivisionsHeader",
"(",
"DataCollection",
"$",
"collection",
")",
":",
"void",
"{",
"$",
"division",
"=",
"$",
"collection",
"->",
"getDefaultProperties",
"(",
")",
";",
"$",
"ua",
"=",
"$",
"division",
"->",
"getUserAgents",
"("... | renders the header for all divisions
@param DataCollection $collection | [
"renders",
"the",
"header",
"for",
"all",
"divisions"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/CsvWriter.php#L185-L215 |
browscap/browscap | src/Browscap/Writer/CsvWriter.php | CsvWriter.renderSectionBody | public function renderSectionBody(array $section, DataCollection $collection, array $sections = [], string $sectionName = '') : void
{
if ($this->isSilent()) {
return;
}
$division = $collection->getDefaultProperties();
$ua = $division->getUserAgen... | php | public function renderSectionBody(array $section, DataCollection $collection, array $sections = [], string $sectionName = '') : void
{
if ($this->isSilent()) {
return;
}
$division = $collection->getDefaultProperties();
$ua = $division->getUserAgen... | [
"public",
"function",
"renderSectionBody",
"(",
"array",
"$",
"section",
",",
"DataCollection",
"$",
"collection",
",",
"array",
"$",
"sections",
"=",
"[",
"]",
",",
"string",
"$",
"sectionName",
"=",
"''",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
... | renders all found useragents into a string
@param array $section
@param DataCollection $collection
@param array[] $sections
@param string $sectionName
@throws \InvalidArgumentException | [
"renders",
"all",
"found",
"useragents",
"into",
"a",
"string"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/CsvWriter.php#L248-L292 |
browscap/browscap | src/Browscap/Writer/CsvWriter.php | CsvWriter.detectMasterParent | private function detectMasterParent(string $key, array $properties) : string
{
$this->logger->debug('check if the element can be marked as "MasterParent"');
if (in_array($key, ['DefaultProperties', '*'])
|| empty($properties['Parent'])
|| 'DefaultProperties' === $properties[... | php | private function detectMasterParent(string $key, array $properties) : string
{
$this->logger->debug('check if the element can be marked as "MasterParent"');
if (in_array($key, ['DefaultProperties', '*'])
|| empty($properties['Parent'])
|| 'DefaultProperties' === $properties[... | [
"private",
"function",
"detectMasterParent",
"(",
"string",
"$",
"key",
",",
"array",
"$",
"properties",
")",
":",
"string",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"'check if the element can be marked as \"MasterParent\"'",
")",
";",
"if",
"(",
"i... | @param string $key
@param array $properties
@return string | [
"@param",
"string",
"$key",
"@param",
"array",
"$properties"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/CsvWriter.php#L326-L338 |
browscap/browscap | src/Browscap/Parser/IniParser.php | IniParser.getLinesFromFile | public function getLinesFromFile() : array
{
$filename = $this->filename;
if (!file_exists($filename)) {
throw new \InvalidArgumentException("File not found: {$filename}");
}
return (array) file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
} | php | public function getLinesFromFile() : array
{
$filename = $this->filename;
if (!file_exists($filename)) {
throw new \InvalidArgumentException("File not found: {$filename}");
}
return (array) file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
} | [
"public",
"function",
"getLinesFromFile",
"(",
")",
":",
"array",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"filename",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"filename",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\... | @throws \InvalidArgumentException
@return array | [
"@throws",
"\\",
"InvalidArgumentException"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Parser/IniParser.php#L72-L81 |
browscap/browscap | src/Browscap/Parser/IniParser.php | IniParser.parse | public function parse() : array
{
$fileLines = $this->getFileLines();
$data = [];
$currentSection = '';
$currentDivision = '';
for ($line = 0, $count = count($fileLines); $line < $count; ++$line) {
$currentLine = ($fileLines[$line]);
$current... | php | public function parse() : array
{
$fileLines = $this->getFileLines();
$data = [];
$currentSection = '';
$currentDivision = '';
for ($line = 0, $count = count($fileLines); $line < $count; ++$line) {
$currentLine = ($fileLines[$line]);
$current... | [
"public",
"function",
"parse",
"(",
")",
":",
"array",
"{",
"$",
"fileLines",
"=",
"$",
"this",
"->",
"getFileLines",
"(",
")",
";",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"currentSection",
"=",
"''",
";",
"$",
"currentDivision",
"=",
"''",
";",
"fo... | @throws \RuntimeException
@return array | [
"@throws",
"\\",
"RuntimeException"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Parser/IniParser.php#L110-L165 |
browscap/browscap | src/Browscap/Parser/IniParser.php | IniParser.sortArrayAndChildArrays | private function sortArrayAndChildArrays(array $array) : array
{
ksort($array);
foreach (array_keys($array) as $key) {
if (!is_array($array[$key]) || empty($array[$key])) {
continue;
}
$array[$key] = $this->sortArrayAndChildArrays($array[$key]);
... | php | private function sortArrayAndChildArrays(array $array) : array
{
ksort($array);
foreach (array_keys($array) as $key) {
if (!is_array($array[$key]) || empty($array[$key])) {
continue;
}
$array[$key] = $this->sortArrayAndChildArrays($array[$key]);
... | [
"private",
"function",
"sortArrayAndChildArrays",
"(",
"array",
"$",
"array",
")",
":",
"array",
"{",
"ksort",
"(",
"$",
"array",
")",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"array",
")",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"is_array",
... | @param array $array
@return array | [
"@param",
"array",
"$array"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Parser/IniParser.php#L172-L185 |
browscap/browscap | src/Browscap/Command/RewriteEnginesCommand.php | RewriteEnginesCommand.execute | protected function execute(InputInterface $input, OutputInterface $output) : ?int
{
$loggerHelper = new LoggerHelper();
$logger = $loggerHelper->create($output);
/** @var string $resources */
$resources = $input->getOption('resources');
$logger->info('Resource folder:... | php | protected function execute(InputInterface $input, OutputInterface $output) : ?int
{
$loggerHelper = new LoggerHelper();
$logger = $loggerHelper->create($output);
/** @var string $resources */
$resources = $input->getOption('resources');
$logger->info('Resource folder:... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
":",
"?",
"int",
"{",
"$",
"loggerHelper",
"=",
"new",
"LoggerHelper",
"(",
")",
";",
"$",
"logger",
"=",
"$",
"loggerHelper",
"->",
"creat... | @param InputInterface $input
@param OutputInterface $output
@return int|null null or 0 if everything went fine, or an error code | [
"@param",
"InputInterface",
"$input",
"@param",
"OutputInterface",
"$output"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Command/RewriteEnginesCommand.php#L36-L90 |
browscap/browscap | src/Browscap/Formatter/CsvFormatter.php | CsvFormatter.formatPropertyValue | public function formatPropertyValue($value, string $property) : string
{
$valueOutput = (string) $value;
switch ($this->propertyHolder->getPropertyType($property)) {
case PropertyHolder::TYPE_STRING:
$valueOutput = trim((string) $value);
break;
... | php | public function formatPropertyValue($value, string $property) : string
{
$valueOutput = (string) $value;
switch ($this->propertyHolder->getPropertyType($property)) {
case PropertyHolder::TYPE_STRING:
$valueOutput = trim((string) $value);
break;
... | [
"public",
"function",
"formatPropertyValue",
"(",
"$",
"value",
",",
"string",
"$",
"property",
")",
":",
"string",
"{",
"$",
"valueOutput",
"=",
"(",
"string",
")",
"$",
"value",
";",
"switch",
"(",
"$",
"this",
"->",
"propertyHolder",
"->",
"getPropertyT... | formats the name of a property
@param bool|int|string $value
@param string $property
@throws \Exception
@return string | [
"formats",
"the",
"name",
"of",
"a",
"property"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Formatter/CsvFormatter.php#L57-L94 |
browscap/browscap | src/Browscap/Filter/CustomFilter.php | CustomFilter.isOutputProperty | public function isOutputProperty(string $property, WriterInterface $writer) : bool
{
if (!$this->propertyHolder->isOutputProperty($property, $writer)) {
return false;
}
return in_array($property, $this->fields);
} | php | public function isOutputProperty(string $property, WriterInterface $writer) : bool
{
if (!$this->propertyHolder->isOutputProperty($property, $writer)) {
return false;
}
return in_array($property, $this->fields);
} | [
"public",
"function",
"isOutputProperty",
"(",
"string",
"$",
"property",
",",
"WriterInterface",
"$",
"writer",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"propertyHolder",
"->",
"isOutputProperty",
"(",
"$",
"property",
",",
"$",
"writer",
... | checks if a property should be in the output
@param string $property
@param WriterInterface $writer
@return bool | [
"checks",
"if",
"a",
"property",
"should",
"be",
"in",
"the",
"output"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Filter/CustomFilter.php#L76-L83 |
browscap/browscap | src/Browscap/Data/Validator/DivisionDataValidator.php | DivisionDataValidator.validate | public function validate(
array $divisionData,
string $filename,
array &$allDivisions = [],
bool $isCore = false
) : void {
Assertion::keyExists($divisionData, 'division', 'required attibute "division" is missing in File ' . $filename);
Assertion::string($divisionData... | php | public function validate(
array $divisionData,
string $filename,
array &$allDivisions = [],
bool $isCore = false
) : void {
Assertion::keyExists($divisionData, 'division', 'required attibute "division" is missing in File ' . $filename);
Assertion::string($divisionData... | [
"public",
"function",
"validate",
"(",
"array",
"$",
"divisionData",
",",
"string",
"$",
"filename",
",",
"array",
"&",
"$",
"allDivisions",
"=",
"[",
"]",
",",
"bool",
"$",
"isCore",
"=",
"false",
")",
":",
"void",
"{",
"Assertion",
"::",
"keyExists",
... | valdates the structure of a division
@param array $divisionData Data to validate
@param string $filename
@param array $allDivisions
@param bool $isCore
@throws \Assert\AssertionFailedException
@throws \LogicException | [
"valdates",
"the",
"structure",
"of",
"a",
"division"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Validator/DivisionDataValidator.php#L20-L57 |
browscap/browscap | src/Browscap/Data/Validator/DivisionDataValidator.php | DivisionDataValidator.validateUserAgentSection | private function validateUserAgentSection(
array $useragentData,
array $versions,
array $allDivisions,
bool $isCore,
string $filename,
int $index
) : void {
Assertion::keyExists($useragentData, 'userAgent', 'required attibute "userAgent" is missing in userAgen... | php | private function validateUserAgentSection(
array $useragentData,
array $versions,
array $allDivisions,
bool $isCore,
string $filename,
int $index
) : void {
Assertion::keyExists($useragentData, 'userAgent', 'required attibute "userAgent" is missing in userAgen... | [
"private",
"function",
"validateUserAgentSection",
"(",
"array",
"$",
"useragentData",
",",
"array",
"$",
"versions",
",",
"array",
"$",
"allDivisions",
",",
"bool",
"$",
"isCore",
",",
"string",
"$",
"filename",
",",
"int",
"$",
"index",
")",
":",
"void",
... | @param array $useragentData
@param array $versions
@param array $allDivisions
@param bool $isCore
@param string $filename
@param int $index
@throws \Assert\AssertionFailedException
@throws \LogicException | [
"@param",
"array",
"$useragentData",
"@param",
"array",
"$versions",
"@param",
"array",
"$allDivisions",
"@param",
"bool",
"$isCore",
"@param",
"string",
"$filename",
"@param",
"int",
"$index"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Validator/DivisionDataValidator.php#L70-L199 |
browscap/browscap | src/Browscap/Data/Validator/DivisionDataValidator.php | DivisionDataValidator.validateChildSection | private function validateChildSection(array $childData, array $useragentData, array $versions) : void
{
if (array_key_exists('device', $childData) && array_key_exists('devices', $childData)) {
throw new \LogicException(
'a child entry may not define both the "device" and the "dev... | php | private function validateChildSection(array $childData, array $useragentData, array $versions) : void
{
if (array_key_exists('device', $childData) && array_key_exists('devices', $childData)) {
throw new \LogicException(
'a child entry may not define both the "device" and the "dev... | [
"private",
"function",
"validateChildSection",
"(",
"array",
"$",
"childData",
",",
"array",
"$",
"useragentData",
",",
"array",
"$",
"versions",
")",
":",
"void",
"{",
"if",
"(",
"array_key_exists",
"(",
"'device'",
",",
"$",
"childData",
")",
"&&",
"array_... | @param array $childData The children section to be validated
@param array $useragentData The complete UserAgent section which is the parent of the children section
@param array $versions The versions from the division
@throws \LogicException
@throws \Assert\AssertionFailedException | [
"@param",
"array",
"$childData",
"The",
"children",
"section",
"to",
"be",
"validated",
"@param",
"array",
"$useragentData",
"The",
"complete",
"UserAgent",
"section",
"which",
"is",
"the",
"parent",
"of",
"the",
"children",
"section",
"@param",
"array",
"$version... | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Validator/DivisionDataValidator.php#L209-L359 |
browscap/browscap | src/Browscap/Data/Validator/DivisionDataValidator.php | DivisionDataValidator.checkPlatformProperties | private function checkPlatformProperties(array $properties, string $message) : void
{
if (array_key_exists('Platform', $properties)
|| array_key_exists('Platform_Description', $properties)
|| array_key_exists('Platform_Maker', $properties)
|| array_key_exists('Platform_Bi... | php | private function checkPlatformProperties(array $properties, string $message) : void
{
if (array_key_exists('Platform', $properties)
|| array_key_exists('Platform_Description', $properties)
|| array_key_exists('Platform_Maker', $properties)
|| array_key_exists('Platform_Bi... | [
"private",
"function",
"checkPlatformProperties",
"(",
"array",
"$",
"properties",
",",
"string",
"$",
"message",
")",
":",
"void",
"{",
"if",
"(",
"array_key_exists",
"(",
"'Platform'",
",",
"$",
"properties",
")",
"||",
"array_key_exists",
"(",
"'Platform_Desc... | checks if platform properties are set inside a properties array
@param array $properties
@param string $message
@throws \LogicException | [
"checks",
"if",
"platform",
"properties",
"are",
"set",
"inside",
"a",
"properties",
"array"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Validator/DivisionDataValidator.php#L369-L383 |
browscap/browscap | src/Browscap/Data/Validator/DivisionDataValidator.php | DivisionDataValidator.checkEngineProperties | public function checkEngineProperties(array $properties, string $message) : void
{
if (array_key_exists('RenderingEngine_Name', $properties)
|| array_key_exists('RenderingEngine_Version', $properties)
|| array_key_exists('RenderingEngine_Description', $properties)
|| arra... | php | public function checkEngineProperties(array $properties, string $message) : void
{
if (array_key_exists('RenderingEngine_Name', $properties)
|| array_key_exists('RenderingEngine_Version', $properties)
|| array_key_exists('RenderingEngine_Description', $properties)
|| arra... | [
"public",
"function",
"checkEngineProperties",
"(",
"array",
"$",
"properties",
",",
"string",
"$",
"message",
")",
":",
"void",
"{",
"if",
"(",
"array_key_exists",
"(",
"'RenderingEngine_Name'",
",",
"$",
"properties",
")",
"||",
"array_key_exists",
"(",
"'Rend... | checks if platform properties are set inside a properties array
@param array $properties
@param string $message
@throws \LogicException | [
"checks",
"if",
"platform",
"properties",
"are",
"set",
"inside",
"a",
"properties",
"array"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Validator/DivisionDataValidator.php#L393-L405 |
browscap/browscap | src/Browscap/Data/Validator/DivisionDataValidator.php | DivisionDataValidator.checkDeviceProperties | public function checkDeviceProperties(array $properties, string $message) : void
{
if (array_key_exists('Device_Name', $properties)
|| array_key_exists('Device_Maker', $properties)
|| array_key_exists('Device_Type', $properties)
|| array_key_exists('Device_Pointing_Method... | php | public function checkDeviceProperties(array $properties, string $message) : void
{
if (array_key_exists('Device_Name', $properties)
|| array_key_exists('Device_Maker', $properties)
|| array_key_exists('Device_Type', $properties)
|| array_key_exists('Device_Pointing_Method... | [
"public",
"function",
"checkDeviceProperties",
"(",
"array",
"$",
"properties",
",",
"string",
"$",
"message",
")",
":",
"void",
"{",
"if",
"(",
"array_key_exists",
"(",
"'Device_Name'",
",",
"$",
"properties",
")",
"||",
"array_key_exists",
"(",
"'Device_Maker'... | checks if device properties are set inside a properties array
@param array $properties
@param string $message
@throws \LogicException | [
"checks",
"if",
"device",
"properties",
"are",
"set",
"inside",
"a",
"properties",
"array"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Validator/DivisionDataValidator.php#L415-L428 |
browscap/browscap | src/Browscap/Data/Validator/DivisionDataValidator.php | DivisionDataValidator.checkBrowserProperties | public function checkBrowserProperties(array $properties, string $message) : void
{
if (array_key_exists('Browser', $properties)
|| array_key_exists('Browser_Type', $properties)
|| array_key_exists('Browser_Maker', $properties)
|| array_key_exists('isSyndicationReader', $... | php | public function checkBrowserProperties(array $properties, string $message) : void
{
if (array_key_exists('Browser', $properties)
|| array_key_exists('Browser_Type', $properties)
|| array_key_exists('Browser_Maker', $properties)
|| array_key_exists('isSyndicationReader', $... | [
"public",
"function",
"checkBrowserProperties",
"(",
"array",
"$",
"properties",
",",
"string",
"$",
"message",
")",
":",
"void",
"{",
"if",
"(",
"array_key_exists",
"(",
"'Browser'",
",",
"$",
"properties",
")",
"||",
"array_key_exists",
"(",
"'Browser_Type'",
... | checks if browser properties are set inside a properties array
@param array $properties
@param string $message
@throws \LogicException | [
"checks",
"if",
"browser",
"properties",
"are",
"set",
"inside",
"a",
"properties",
"array"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Validator/DivisionDataValidator.php#L438-L448 |
browscap/browscap | src/Browscap/Data/Validator/DivisionDataValidator.php | DivisionDataValidator.checkDeprecatedProperties | public function checkDeprecatedProperties(array $properties, string $message) : void
{
if (array_key_exists('AolVersion', $properties)
|| array_key_exists('MinorVer', $properties)
|| array_key_exists('MajorVer', $properties)
) {
throw new \LogicException($message)... | php | public function checkDeprecatedProperties(array $properties, string $message) : void
{
if (array_key_exists('AolVersion', $properties)
|| array_key_exists('MinorVer', $properties)
|| array_key_exists('MajorVer', $properties)
) {
throw new \LogicException($message)... | [
"public",
"function",
"checkDeprecatedProperties",
"(",
"array",
"$",
"properties",
",",
"string",
"$",
"message",
")",
":",
"void",
"{",
"if",
"(",
"array_key_exists",
"(",
"'AolVersion'",
",",
"$",
"properties",
")",
"||",
"array_key_exists",
"(",
"'MinorVer'"... | checks if deprecated properties are set inside a properties array
@param array $properties
@param string $message
@throws \LogicException | [
"checks",
"if",
"deprecated",
"properties",
"are",
"set",
"inside",
"a",
"properties",
"array"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Validator/DivisionDataValidator.php#L458-L466 |
browscap/browscap | src/Browscap/Writer/Factory/CustomWriterFactory.php | CustomWriterFactory.createCollection | public function createCollection(
LoggerInterface $logger,
string $buildFolder,
?string $file = null,
array $fields = [],
string $format = FormatterInterface::TYPE_PHP
) : WriterCollection {
$writerCollection = new WriterCollection();
$propertyHolder = new P... | php | public function createCollection(
LoggerInterface $logger,
string $buildFolder,
?string $file = null,
array $fields = [],
string $format = FormatterInterface::TYPE_PHP
) : WriterCollection {
$writerCollection = new WriterCollection();
$propertyHolder = new P... | [
"public",
"function",
"createCollection",
"(",
"LoggerInterface",
"$",
"logger",
",",
"string",
"$",
"buildFolder",
",",
"?",
"string",
"$",
"file",
"=",
"null",
",",
"array",
"$",
"fields",
"=",
"[",
"]",
",",
"string",
"$",
"format",
"=",
"FormatterInter... | @param LoggerInterface $logger
@param string $buildFolder
@param string|null $file
@param array $fields
@param string $format
@return WriterCollection | [
"@param",
"LoggerInterface",
"$logger",
"@param",
"string",
"$buildFolder",
"@param",
"string|null",
"$file",
"@param",
"array",
"$fields",
"@param",
"string",
"$format"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/Factory/CustomWriterFactory.php#L27-L100 |
browscap/browscap | src/Browscap/Data/Factory/PlatformFactory.php | PlatformFactory.build | public function build(array $platformData, array $dataAllPlatforms, string $platformName) : Platform
{
Assertion::isArray($platformData, 'each entry has to be an array');
Assertion::keyExists($platformData, 'lite', 'the value for "lite" key is missing for the platform with the key "' . $platformName... | php | public function build(array $platformData, array $dataAllPlatforms, string $platformName) : Platform
{
Assertion::isArray($platformData, 'each entry has to be an array');
Assertion::keyExists($platformData, 'lite', 'the value for "lite" key is missing for the platform with the key "' . $platformName... | [
"public",
"function",
"build",
"(",
"array",
"$",
"platformData",
",",
"array",
"$",
"dataAllPlatforms",
",",
"string",
"$",
"platformName",
")",
":",
"Platform",
"{",
"Assertion",
"::",
"isArray",
"(",
"$",
"platformData",
",",
"'each entry has to be an array'",
... | validates the $platformData array and creates Platform objects from it
@param array $platformData The Platform data for the current object
@param array $dataAllPlatforms The Platform data for all platforms
@param string $platformName The name for the current platform
@throws \RuntimeException ... | [
"validates",
"the",
"$platformData",
"array",
"and",
"creates",
"Platform",
"objects",
"from",
"it"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Factory/PlatformFactory.php#L23-L79 |
browscap/browscap | src/Browscap/Data/PropertyHolder.php | PropertyHolder.getPropertyType | public function getPropertyType(string $propertyName) : string
{
$stringProperties = [
'Comment' => 1,
'Browser' => 1,
'Browser_Maker' => 1,
'Browser_Modus' => 1,
'Browser_Type' => 1,
'Platform' => 1,
'Platform_Name' => 1,
... | php | public function getPropertyType(string $propertyName) : string
{
$stringProperties = [
'Comment' => 1,
'Browser' => 1,
'Browser_Maker' => 1,
'Browser_Modus' => 1,
'Browser_Type' => 1,
'Platform' => 1,
'Platform_Name' => 1,
... | [
"public",
"function",
"getPropertyType",
"(",
"string",
"$",
"propertyName",
")",
":",
"string",
"{",
"$",
"stringProperties",
"=",
"[",
"'Comment'",
"=>",
"1",
",",
"'Browser'",
"=>",
"1",
",",
"'Browser_Maker'",
"=>",
"1",
",",
"'Browser_Modus'",
"=>",
"1"... | Get the type of a property
@param string $propertyName
@throws \InvalidArgumentException
@return string | [
"Get",
"the",
"type",
"of",
"a",
"property"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/PropertyHolder.php#L24-L115 |
browscap/browscap | src/Browscap/Data/PropertyHolder.php | PropertyHolder.isLiteModeProperty | public function isLiteModeProperty(string $propertyName, WriterInterface $writer) : bool
{
$outputProperties = [
'Parent' => 1,
'Comment' => 1,
'Browser' => 1,
'Platform' => 1,
'Version' => 1,
'isMobileDevice' => 1,
'isTable... | php | public function isLiteModeProperty(string $propertyName, WriterInterface $writer) : bool
{
$outputProperties = [
'Parent' => 1,
'Comment' => 1,
'Browser' => 1,
'Platform' => 1,
'Version' => 1,
'isMobileDevice' => 1,
'isTable... | [
"public",
"function",
"isLiteModeProperty",
"(",
"string",
"$",
"propertyName",
",",
"WriterInterface",
"$",
"writer",
")",
":",
"bool",
"{",
"$",
"outputProperties",
"=",
"[",
"'Parent'",
"=>",
"1",
",",
"'Comment'",
"=>",
"1",
",",
"'Browser'",
"=>",
"1",
... | Determine if the specified property is an property that should
be included in the all versions of the files
@param string $propertyName
@param WriterInterface $writer
@return bool | [
"Determine",
"if",
"the",
"specified",
"property",
"is",
"an",
"property",
"that",
"should",
"be",
"included",
"in",
"the",
"all",
"versions",
"of",
"the",
"files"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/PropertyHolder.php#L126-L152 |
browscap/browscap | src/Browscap/Data/PropertyHolder.php | PropertyHolder.isStandardModeProperty | public function isStandardModeProperty(string $propertyName, WriterInterface $writer) : bool
{
$outputProperties = [
'MajorVer' => 1,
'MinorVer' => 1,
'Crawler' => 1,
'Browser_Maker' => 1,
'Device_Pointing_Method' => 1,
];
if (isse... | php | public function isStandardModeProperty(string $propertyName, WriterInterface $writer) : bool
{
$outputProperties = [
'MajorVer' => 1,
'MinorVer' => 1,
'Crawler' => 1,
'Browser_Maker' => 1,
'Device_Pointing_Method' => 1,
];
if (isse... | [
"public",
"function",
"isStandardModeProperty",
"(",
"string",
"$",
"propertyName",
",",
"WriterInterface",
"$",
"writer",
")",
":",
"bool",
"{",
"$",
"outputProperties",
"=",
"[",
"'MajorVer'",
"=>",
"1",
",",
"'MinorVer'",
"=>",
"1",
",",
"'Crawler'",
"=>",
... | Determine if the specified property is an property that should
be included in the "standard" or "full" versions of the files only
@param string $propertyName
@param WriterInterface $writer
@return bool | [
"Determine",
"if",
"the",
"specified",
"property",
"is",
"an",
"property",
"that",
"should",
"be",
"included",
"in",
"the",
"standard",
"or",
"full",
"versions",
"of",
"the",
"files",
"only"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/PropertyHolder.php#L163-L186 |
browscap/browscap | src/Browscap/Data/PropertyHolder.php | PropertyHolder.isDeprecatedProperty | public function isDeprecatedProperty(string $propertyName) : bool
{
$deprecatedProperties = [
'Win16' => 1,
'Win32' => 1,
'Win64' => 1,
'isMobileDevice' => 1,
'isTablet' => 1,
'Crawler' => 1,
'AolVersion' => 1,
'... | php | public function isDeprecatedProperty(string $propertyName) : bool
{
$deprecatedProperties = [
'Win16' => 1,
'Win32' => 1,
'Win64' => 1,
'isMobileDevice' => 1,
'isTablet' => 1,
'Crawler' => 1,
'AolVersion' => 1,
'... | [
"public",
"function",
"isDeprecatedProperty",
"(",
"string",
"$",
"propertyName",
")",
":",
"bool",
"{",
"$",
"deprecatedProperties",
"=",
"[",
"'Win16'",
"=>",
"1",
",",
"'Win32'",
"=>",
"1",
",",
"'Win64'",
"=>",
"1",
",",
"'isMobileDevice'",
"=>",
"1",
... | Determine if the specified property is marked as "deprecated"
@param string $propertyName
@return bool | [
"Determine",
"if",
"the",
"specified",
"property",
"is",
"marked",
"as",
"deprecated"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/PropertyHolder.php#L279-L298 |
browscap/browscap | src/Browscap/Data/PropertyHolder.php | PropertyHolder.checkValueInArray | public function checkValueInArray(string $property, string $value) : string
{
switch ($property) {
case 'Device_Pointing_Method':
// This property is taken from http://www.scientiamobile.com/wurflCapability
$allowedValues = [
'joystick', 'stylu... | php | public function checkValueInArray(string $property, string $value) : string
{
switch ($property) {
case 'Device_Pointing_Method':
// This property is taken from http://www.scientiamobile.com/wurflCapability
$allowedValues = [
'joystick', 'stylu... | [
"public",
"function",
"checkValueInArray",
"(",
"string",
"$",
"property",
",",
"string",
"$",
"value",
")",
":",
"string",
"{",
"switch",
"(",
"$",
"property",
")",
"{",
"case",
"'Device_Pointing_Method'",
":",
"// This property is taken from http://www.scientiamobil... | @param string $property
@param string $value
@throws \InvalidArgumentException
@return string | [
"@param",
"string",
"$property",
"@param",
"string",
"$value"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/PropertyHolder.php#L308-L337 |
browscap/browscap | src/Browscap/Writer/Factory/FullPhpWriterFactory.php | FullPhpWriterFactory.createCollection | public function createCollection(LoggerInterface $logger, string $buildFolder, ?string $file = null) : WriterCollection
{
$writerCollection = new WriterCollection();
$propertyHolder = new PropertyHolder();
if (null === $file) {
$file = $buildFolder . '/full_php_browscap.ini';
... | php | public function createCollection(LoggerInterface $logger, string $buildFolder, ?string $file = null) : WriterCollection
{
$writerCollection = new WriterCollection();
$propertyHolder = new PropertyHolder();
if (null === $file) {
$file = $buildFolder . '/full_php_browscap.ini';
... | [
"public",
"function",
"createCollection",
"(",
"LoggerInterface",
"$",
"logger",
",",
"string",
"$",
"buildFolder",
",",
"?",
"string",
"$",
"file",
"=",
"null",
")",
":",
"WriterCollection",
"{",
"$",
"writerCollection",
"=",
"new",
"WriterCollection",
"(",
"... | @param LoggerInterface $logger
@param string $buildFolder
@param string|null $file
@return WriterCollection | [
"@param",
"LoggerInterface",
"$logger",
"@param",
"string",
"$buildFolder",
"@param",
"string|null",
"$file"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/Factory/FullPhpWriterFactory.php#L24-L42 |
browscap/browscap | src/Browscap/Writer/WriterCollection.php | WriterCollection.renderHeader | public function renderHeader(array $comments = []) : void
{
foreach ($this->writers as $writer) {
$writer->renderHeader($comments);
}
} | php | public function renderHeader(array $comments = []) : void
{
foreach ($this->writers as $writer) {
$writer->renderHeader($comments);
}
} | [
"public",
"function",
"renderHeader",
"(",
"array",
"$",
"comments",
"=",
"[",
"]",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"->",
"writers",
"as",
"$",
"writer",
")",
"{",
"$",
"writer",
"->",
"renderHeader",
"(",
"$",
"comments",
")",
";... | Generate the header
@param string[] $comments | [
"Generate",
"the",
"header"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/WriterCollection.php#L83-L88 |
browscap/browscap | src/Browscap/Writer/WriterCollection.php | WriterCollection.renderVersion | public function renderVersion(string $version, DataCollection $collection) : void
{
foreach ($this->writers as $writer) {
$writer->renderVersion(
[
'version' => $version,
'released' => $collection->getGenerationDate()->format('r'),
... | php | public function renderVersion(string $version, DataCollection $collection) : void
{
foreach ($this->writers as $writer) {
$writer->renderVersion(
[
'version' => $version,
'released' => $collection->getGenerationDate()->format('r'),
... | [
"public",
"function",
"renderVersion",
"(",
"string",
"$",
"version",
",",
"DataCollection",
"$",
"collection",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"->",
"writers",
"as",
"$",
"writer",
")",
"{",
"$",
"writer",
"->",
"renderVersion",
"(",
... | renders the version information
@param string $version
@param DataCollection $collection | [
"renders",
"the",
"version",
"information"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/WriterCollection.php#L96-L108 |
browscap/browscap | src/Browscap/Writer/WriterCollection.php | WriterCollection.renderAllDivisionsHeader | public function renderAllDivisionsHeader(DataCollection $collection) : void
{
foreach ($this->writers as $writer) {
$writer->renderAllDivisionsHeader($collection);
}
} | php | public function renderAllDivisionsHeader(DataCollection $collection) : void
{
foreach ($this->writers as $writer) {
$writer->renderAllDivisionsHeader($collection);
}
} | [
"public",
"function",
"renderAllDivisionsHeader",
"(",
"DataCollection",
"$",
"collection",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"->",
"writers",
"as",
"$",
"writer",
")",
"{",
"$",
"writer",
"->",
"renderAllDivisionsHeader",
"(",
"$",
"collecti... | renders the header for all divisions
@param DataCollection $collection | [
"renders",
"the",
"header",
"for",
"all",
"divisions"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/WriterCollection.php#L115-L120 |
browscap/browscap | src/Browscap/Writer/WriterCollection.php | WriterCollection.renderDivisionHeader | public function renderDivisionHeader(string $division, string $parent = 'DefaultProperties') : void
{
foreach ($this->writers as $writer) {
$writer->renderDivisionHeader($division, $parent);
}
} | php | public function renderDivisionHeader(string $division, string $parent = 'DefaultProperties') : void
{
foreach ($this->writers as $writer) {
$writer->renderDivisionHeader($division, $parent);
}
} | [
"public",
"function",
"renderDivisionHeader",
"(",
"string",
"$",
"division",
",",
"string",
"$",
"parent",
"=",
"'DefaultProperties'",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"->",
"writers",
"as",
"$",
"writer",
")",
"{",
"$",
"writer",
"->",... | renders the header for a division
@param string $division
@param string $parent | [
"renders",
"the",
"header",
"for",
"a",
"division"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/WriterCollection.php#L128-L133 |
browscap/browscap | src/Browscap/Writer/WriterCollection.php | WriterCollection.renderSectionHeader | public function renderSectionHeader(string $sectionName) : void
{
foreach ($this->writers as $writer) {
$writer->renderSectionHeader($sectionName);
}
} | php | public function renderSectionHeader(string $sectionName) : void
{
foreach ($this->writers as $writer) {
$writer->renderSectionHeader($sectionName);
}
} | [
"public",
"function",
"renderSectionHeader",
"(",
"string",
"$",
"sectionName",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"->",
"writers",
"as",
"$",
"writer",
")",
"{",
"$",
"writer",
"->",
"renderSectionHeader",
"(",
"$",
"sectionName",
")",
";... | renders the header for a section
@param string $sectionName | [
"renders",
"the",
"header",
"for",
"a",
"section"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/WriterCollection.php#L140-L145 |
browscap/browscap | src/Browscap/Writer/WriterCollection.php | WriterCollection.renderSectionBody | public function renderSectionBody(array $section, DataCollection $collection, array $sections = [], string $sectionName = '') : void
{
foreach ($this->writers as $writer) {
$writer->renderSectionBody($section, $collection, $sections, $sectionName);
}
} | php | public function renderSectionBody(array $section, DataCollection $collection, array $sections = [], string $sectionName = '') : void
{
foreach ($this->writers as $writer) {
$writer->renderSectionBody($section, $collection, $sections, $sectionName);
}
} | [
"public",
"function",
"renderSectionBody",
"(",
"array",
"$",
"section",
",",
"DataCollection",
"$",
"collection",
",",
"array",
"$",
"sections",
"=",
"[",
"]",
",",
"string",
"$",
"sectionName",
"=",
"''",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"th... | renders all found useragents into a string
@param array $section
@param DataCollection $collection
@param array[] $sections
@param string $sectionName
@throws \InvalidArgumentException | [
"renders",
"all",
"found",
"useragents",
"into",
"a",
"string"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/WriterCollection.php#L157-L162 |
browscap/browscap | src/Browscap/Writer/WriterCollection.php | WriterCollection.renderSectionFooter | public function renderSectionFooter(string $sectionName = '') : void
{
foreach ($this->writers as $writer) {
$writer->renderSectionFooter($sectionName);
}
} | php | public function renderSectionFooter(string $sectionName = '') : void
{
foreach ($this->writers as $writer) {
$writer->renderSectionFooter($sectionName);
}
} | [
"public",
"function",
"renderSectionFooter",
"(",
"string",
"$",
"sectionName",
"=",
"''",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"->",
"writers",
"as",
"$",
"writer",
")",
"{",
"$",
"writer",
"->",
"renderSectionFooter",
"(",
"$",
"sectionNam... | renders the footer for a section
@param string $sectionName | [
"renders",
"the",
"footer",
"for",
"a",
"section"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/WriterCollection.php#L169-L174 |
browscap/browscap | src/Browscap/Writer/Factory/FullCollectionFactory.php | FullCollectionFactory.createCollection | public function createCollection(LoggerInterface $logger, string $buildFolder) : WriterCollection
{
$writerCollection = new WriterCollection();
$propertyHolder = new PropertyHolder();
$fullFilter = new FullFilter($propertyHolder);
$stdFilter = new StandardFilter($propertyHolder);... | php | public function createCollection(LoggerInterface $logger, string $buildFolder) : WriterCollection
{
$writerCollection = new WriterCollection();
$propertyHolder = new PropertyHolder();
$fullFilter = new FullFilter($propertyHolder);
$stdFilter = new StandardFilter($propertyHolder);... | [
"public",
"function",
"createCollection",
"(",
"LoggerInterface",
"$",
"logger",
",",
"string",
"$",
"buildFolder",
")",
":",
"WriterCollection",
"{",
"$",
"writerCollection",
"=",
"new",
"WriterCollection",
"(",
")",
";",
"$",
"propertyHolder",
"=",
"new",
"Pro... | @param LoggerInterface $logger
@param string $buildFolder
@return WriterCollection | [
"@param",
"LoggerInterface",
"$logger",
"@param",
"string",
"$buildFolder"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Writer/Factory/FullCollectionFactory.php#L32-L98 |
browscap/browscap | src/Browscap/Command/ValidateCommand.php | ValidateCommand.execute | protected function execute(InputInterface $input, OutputInterface $output) : ?int
{
$loggerHelper = new LoggerHelper();
$logger = $loggerHelper->create($output);
/** @var string $resources */
$resources = $input->getOption('resources');
$failed = false;
$comm... | php | protected function execute(InputInterface $input, OutputInterface $output) : ?int
{
$loggerHelper = new LoggerHelper();
$logger = $loggerHelper->create($output);
/** @var string $resources */
$resources = $input->getOption('resources');
$failed = false;
$comm... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
":",
"?",
"int",
"{",
"$",
"loggerHelper",
"=",
"new",
"LoggerHelper",
"(",
")",
";",
"$",
"logger",
"=",
"$",
"loggerHelper",
"->",
"creat... | @param InputInterface $input
@param OutputInterface $output
@throws \Exception
@return int|null null or 0 if everything went fine, or an error code | [
"@param",
"InputInterface",
"$input",
"@param",
"OutputInterface",
"$output"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Command/ValidateCommand.php#L37-L152 |
browscap/browscap | src/Browscap/Data/DataCollection.php | DataCollection.setDefaultProperties | public function setDefaultProperties(Division $division) : void
{
$this->defaultProperties = $division;
$this->divisionsHaveBeenSorted = false;
} | php | public function setDefaultProperties(Division $division) : void
{
$this->defaultProperties = $division;
$this->divisionsHaveBeenSorted = false;
} | [
"public",
"function",
"setDefaultProperties",
"(",
"Division",
"$",
"division",
")",
":",
"void",
"{",
"$",
"this",
"->",
"defaultProperties",
"=",
"$",
"division",
";",
"$",
"this",
"->",
"divisionsHaveBeenSorted",
"=",
"false",
";",
"}"
] | Load the file for the default properties
@param Division $division | [
"Load",
"the",
"file",
"for",
"the",
"default",
"properties"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/DataCollection.php#L139-L144 |
browscap/browscap | src/Browscap/Data/DataCollection.php | DataCollection.setDefaultBrowser | public function setDefaultBrowser(Division $division) : void
{
$this->defaultBrowser = $division;
$this->divisionsHaveBeenSorted = false;
} | php | public function setDefaultBrowser(Division $division) : void
{
$this->defaultBrowser = $division;
$this->divisionsHaveBeenSorted = false;
} | [
"public",
"function",
"setDefaultBrowser",
"(",
"Division",
"$",
"division",
")",
":",
"void",
"{",
"$",
"this",
"->",
"defaultBrowser",
"=",
"$",
"division",
";",
"$",
"this",
"->",
"divisionsHaveBeenSorted",
"=",
"false",
";",
"}"
] | Load the file for the default browser
@param Division $division | [
"Load",
"the",
"file",
"for",
"the",
"default",
"browser"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/DataCollection.php#L151-L156 |
browscap/browscap | src/Browscap/Data/DataCollection.php | DataCollection.sortDivisions | private function sortDivisions() : void
{
if ($this->divisionsHaveBeenSorted) {
return;
}
$sortIndex = [];
$sortPosition = [];
foreach ($this->divisions as $key => $division) {
/* @var \Browscap\Data\Division $division */
$sortIndex[$k... | php | private function sortDivisions() : void
{
if ($this->divisionsHaveBeenSorted) {
return;
}
$sortIndex = [];
$sortPosition = [];
foreach ($this->divisions as $key => $division) {
/* @var \Browscap\Data\Division $division */
$sortIndex[$k... | [
"private",
"function",
"sortDivisions",
"(",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"divisionsHaveBeenSorted",
")",
"{",
"return",
";",
"}",
"$",
"sortIndex",
"=",
"[",
"]",
";",
"$",
"sortPosition",
"=",
"[",
"]",
";",
"foreach",
"(",
... | Sort the divisions (if they haven't already been sorted) | [
"Sort",
"the",
"divisions",
"(",
"if",
"they",
"haven",
"t",
"already",
"been",
"sorted",
")"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/DataCollection.php#L173-L199 |
browscap/browscap | src/Browscap/Data/DataCollection.php | DataCollection.getPlatform | public function getPlatform(string $platform) : Platform
{
if (!array_key_exists($platform, $this->platforms)) {
throw new \OutOfBoundsException(
'Platform "' . $platform . '" does not exist in data'
);
}
return $this->platforms[$platform];
} | php | public function getPlatform(string $platform) : Platform
{
if (!array_key_exists($platform, $this->platforms)) {
throw new \OutOfBoundsException(
'Platform "' . $platform . '" does not exist in data'
);
}
return $this->platforms[$platform];
} | [
"public",
"function",
"getPlatform",
"(",
"string",
"$",
"platform",
")",
":",
"Platform",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"platform",
",",
"$",
"this",
"->",
"platforms",
")",
")",
"{",
"throw",
"new",
"\\",
"OutOfBoundsException",
"(",... | Get a single platform data array
@param string $platform
@throws \OutOfBoundsException
@throws \UnexpectedValueException
@return Platform | [
"Get",
"a",
"single",
"platform",
"data",
"array"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/DataCollection.php#L231-L240 |
browscap/browscap | src/Browscap/Data/DataCollection.php | DataCollection.getEngine | public function getEngine(string $engine) : Engine
{
if (!array_key_exists($engine, $this->engines)) {
throw new \OutOfBoundsException(
'Rendering Engine "' . $engine . '" does not exist in data'
);
}
return $this->engines[$engine];
} | php | public function getEngine(string $engine) : Engine
{
if (!array_key_exists($engine, $this->engines)) {
throw new \OutOfBoundsException(
'Rendering Engine "' . $engine . '" does not exist in data'
);
}
return $this->engines[$engine];
} | [
"public",
"function",
"getEngine",
"(",
"string",
"$",
"engine",
")",
":",
"Engine",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"engine",
",",
"$",
"this",
"->",
"engines",
")",
")",
"{",
"throw",
"new",
"\\",
"OutOfBoundsException",
"(",
"'Rende... | Get a single engine data array
@param string $engine
@throws \OutOfBoundsException
@throws \UnexpectedValueException
@return Engine | [
"Get",
"a",
"single",
"engine",
"data",
"array"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/DataCollection.php#L252-L261 |
browscap/browscap | src/Browscap/Data/DataCollection.php | DataCollection.getBrowser | public function getBrowser(string $browser) : Browser
{
if (!array_key_exists($browser, $this->browsers)) {
throw new \OutOfBoundsException(
'Browser "' . $browser . '" does not exist in data'
);
}
return $this->browsers[$browser];
} | php | public function getBrowser(string $browser) : Browser
{
if (!array_key_exists($browser, $this->browsers)) {
throw new \OutOfBoundsException(
'Browser "' . $browser . '" does not exist in data'
);
}
return $this->browsers[$browser];
} | [
"public",
"function",
"getBrowser",
"(",
"string",
"$",
"browser",
")",
":",
"Browser",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"browser",
",",
"$",
"this",
"->",
"browsers",
")",
")",
"{",
"throw",
"new",
"\\",
"OutOfBoundsException",
"(",
"'... | Get a single browser data array
@param string $browser
@throws \OutOfBoundsException
@throws \UnexpectedValueException
@return Browser | [
"Get",
"a",
"single",
"browser",
"data",
"array"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/DataCollection.php#L273-L282 |
browscap/browscap | src/Browscap/Data/DataCollection.php | DataCollection.getDevice | public function getDevice(string $device) : Device
{
if (!array_key_exists($device, $this->devices)) {
throw new \OutOfBoundsException(
'Device "' . $device . '" does not exist in data'
);
}
return $this->devices[$device];
} | php | public function getDevice(string $device) : Device
{
if (!array_key_exists($device, $this->devices)) {
throw new \OutOfBoundsException(
'Device "' . $device . '" does not exist in data'
);
}
return $this->devices[$device];
} | [
"public",
"function",
"getDevice",
"(",
"string",
"$",
"device",
")",
":",
"Device",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"device",
",",
"$",
"this",
"->",
"devices",
")",
")",
"{",
"throw",
"new",
"\\",
"OutOfBoundsException",
"(",
"'Devic... | Get a single engine data array
@param string $device
@throws \OutOfBoundsException
@throws \UnexpectedValueException
@return Device | [
"Get",
"a",
"single",
"engine",
"data",
"array"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/DataCollection.php#L294-L303 |
browscap/browscap | src/Browscap/Generator/Helper/BuildHelper.php | BuildHelper.run | public static function run(
string $buildVersion,
string $resourceFolder,
LoggerInterface $logger,
WriterCollection $writerCollection,
DataCollectionFactory $dataCollectionFactory,
bool $collectPatternIds = false
) : void {
$logger->info('started creating a da... | php | public static function run(
string $buildVersion,
string $resourceFolder,
LoggerInterface $logger,
WriterCollection $writerCollection,
DataCollectionFactory $dataCollectionFactory,
bool $collectPatternIds = false
) : void {
$logger->info('started creating a da... | [
"public",
"static",
"function",
"run",
"(",
"string",
"$",
"buildVersion",
",",
"string",
"$",
"resourceFolder",
",",
"LoggerInterface",
"$",
"logger",
",",
"WriterCollection",
"$",
"writerCollection",
",",
"DataCollectionFactory",
"$",
"dataCollectionFactory",
",",
... | @param string $buildVersion
@param string $resourceFolder
@param LoggerInterface $logger
@param WriterCollection $writerCollection
@param DataCollectionFactory $dataCollectionFactory
@param bool $collectPatternIds
@throws \Exception
@throws \Assert\AssertionFai... | [
"@param",
"string",
"$buildVersion",
"@param",
"string",
"$resourceFolder",
"@param",
"LoggerInterface",
"$logger",
"@param",
"WriterCollection",
"$writerCollection",
"@param",
"DataCollectionFactory",
"$dataCollectionFactory",
"@param",
"bool",
"$collectPatternIds"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Generator/Helper/BuildHelper.php#L26-L185 |
browscap/browscap | src/Browscap/Data/Helper/SplitVersion.php | SplitVersion.getVersionParts | public function getVersionParts(string $version) : array
{
$dots = explode('.', $version, 2);
$majorVer = $dots[0];
$minorVer = (isset($dots[1]) ? $dots[1] : '0');
return [$majorVer, $minorVer];
} | php | public function getVersionParts(string $version) : array
{
$dots = explode('.', $version, 2);
$majorVer = $dots[0];
$minorVer = (isset($dots[1]) ? $dots[1] : '0');
return [$majorVer, $minorVer];
} | [
"public",
"function",
"getVersionParts",
"(",
"string",
"$",
"version",
")",
":",
"array",
"{",
"$",
"dots",
"=",
"explode",
"(",
"'.'",
",",
"$",
"version",
",",
"2",
")",
";",
"$",
"majorVer",
"=",
"$",
"dots",
"[",
"0",
"]",
";",
"$",
"minorVer"... | splits a version into the major and the minor version
@param string $version
@return string[] | [
"splits",
"a",
"version",
"into",
"the",
"major",
"and",
"the",
"minor",
"version"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Helper/SplitVersion.php#L14-L22 |
browscap/browscap | src/Browscap/Data/Helper/VersionNumber.php | VersionNumber.replace | public function replace(string $value, string $majorVer, string $minorVer) : string
{
return str_replace(
['#MAJORVER#', '#MINORVER#'],
[$majorVer, $minorVer],
$value
);
} | php | public function replace(string $value, string $majorVer, string $minorVer) : string
{
return str_replace(
['#MAJORVER#', '#MINORVER#'],
[$majorVer, $minorVer],
$value
);
} | [
"public",
"function",
"replace",
"(",
"string",
"$",
"value",
",",
"string",
"$",
"majorVer",
",",
"string",
"$",
"minorVer",
")",
":",
"string",
"{",
"return",
"str_replace",
"(",
"[",
"'#MAJORVER#'",
",",
"'#MINORVER#'",
"]",
",",
"[",
"$",
"majorVer",
... | Render the property of a single User Agent and replaces version placeholders
@param string $value
@param string $majorVer
@param string $minorVer
@return string | [
"Render",
"the",
"property",
"of",
"a",
"single",
"User",
"Agent",
"and",
"replaces",
"version",
"placeholders"
] | train | https://github.com/browscap/browscap/blob/5dca9e80c43eb50f703e68b6851e1da7e683b85c/src/Browscap/Data/Helper/VersionNumber.php#L16-L23 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.