id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
11,800 | internalsystemerror/ise-module-bootstrap | src/View/Helper/Navigation/Navbar.php | Navbar.setRightMenu | public function setRightMenu($container)
{
if (null === $container) {
throw Exception\InvalidArgumentException(
'Container must be a string alias or an instance of '
. 'Zend\Navigation\AbstractContainer'
);
}
$this->parseContainer($cont... | php | public function setRightMenu($container)
{
if (null === $container) {
throw Exception\InvalidArgumentException(
'Container must be a string alias or an instance of '
. 'Zend\Navigation\AbstractContainer'
);
}
$this->parseContainer($cont... | [
"public",
"function",
"setRightMenu",
"(",
"$",
"container",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"container",
")",
"{",
"throw",
"Exception",
"\\",
"InvalidArgumentException",
"(",
"'Container must be a string alias or an instance of '",
".",
"'Zend\\Navigation\\Ab... | Set right menu
@param boolean|string|AbstractContainer $container Container to render or
false for no menu
@return Navbar | [
"Set",
"right",
"menu"
] | 289afa531a12e6159568b592b95964374442e850 | https://github.com/internalsystemerror/ise-module-bootstrap/blob/289afa531a12e6159568b592b95964374442e850/src/View/Helper/Navigation/Navbar.php#L136-L147 |
11,801 | internalsystemerror/ise-module-bootstrap | src/View/Helper/Navigation/Navbar.php | Navbar.renderNavigation | protected function renderNavigation(AbstractContainer $container, array $options)
{
// Start html
$html = $this->renderNavbarContainerHeader($options)
. $this->renderNavbarMenu($container, $options);
// Add form if applicable
if ($options['useForm']) {
$html ... | php | protected function renderNavigation(AbstractContainer $container, array $options)
{
// Start html
$html = $this->renderNavbarContainerHeader($options)
. $this->renderNavbarMenu($container, $options);
// Add form if applicable
if ($options['useForm']) {
$html ... | [
"protected",
"function",
"renderNavigation",
"(",
"AbstractContainer",
"$",
"container",
",",
"array",
"$",
"options",
")",
"{",
"// Start html",
"$",
"html",
"=",
"$",
"this",
"->",
"renderNavbarContainerHeader",
"(",
"$",
"options",
")",
".",
"$",
"this",
"-... | Render navbar container
@param AbstractContainer $container Container to create menu from.
@param array $options Options for controlling rendering
@throws Exception\InvalidArgumentException | [
"Render",
"navbar",
"container"
] | 289afa531a12e6159568b592b95964374442e850 | https://github.com/internalsystemerror/ise-module-bootstrap/blob/289afa531a12e6159568b592b95964374442e850/src/View/Helper/Navigation/Navbar.php#L174-L193 |
11,802 | internalsystemerror/ise-module-bootstrap | src/View/Helper/Navigation/Navbar.php | Navbar.renderNavbarMenu | protected function renderNavbarMenu(AbstractContainer $container, array $options)
{
// Create iterator
$iterator = new \RecursiveIteratorIterator($container, \RecursiveIteratorIterator::SELF_FIRST);
$iterator->setMaxDepth(self::MAX_RENDER_DEPTH);
// Add pages
$html = ''... | php | protected function renderNavbarMenu(AbstractContainer $container, array $options)
{
// Create iterator
$iterator = new \RecursiveIteratorIterator($container, \RecursiveIteratorIterator::SELF_FIRST);
$iterator->setMaxDepth(self::MAX_RENDER_DEPTH);
// Add pages
$html = ''... | [
"protected",
"function",
"renderNavbarMenu",
"(",
"AbstractContainer",
"$",
"container",
",",
"array",
"$",
"options",
")",
"{",
"// Create iterator",
"$",
"iterator",
"=",
"new",
"\\",
"RecursiveIteratorIterator",
"(",
"$",
"container",
",",
"\\",
"RecursiveIterato... | Render navbar menu
@param AbstractContainer $container Container to render
@param array $options Options for controlling rendering
@return string | [
"Render",
"navbar",
"menu"
] | 289afa531a12e6159568b592b95964374442e850 | https://github.com/internalsystemerror/ise-module-bootstrap/blob/289afa531a12e6159568b592b95964374442e850/src/View/Helper/Navigation/Navbar.php#L272-L302 |
11,803 | internalsystemerror/ise-module-bootstrap | src/View/Helper/Navigation/Navbar.php | Navbar.renderNavbarMenuPage | protected function renderNavbarMenuPage(AbstractPage $page, array $options, $depth, $prevDepth)
{
// Check for depth
$html = '';
if ($depth > $prevDepth) {
// Start new ul tag
$ulClass = $this->createNavbarMenuClass($page, $options['ulClass'], $depth);
... | php | protected function renderNavbarMenuPage(AbstractPage $page, array $options, $depth, $prevDepth)
{
// Check for depth
$html = '';
if ($depth > $prevDepth) {
// Start new ul tag
$ulClass = $this->createNavbarMenuClass($page, $options['ulClass'], $depth);
... | [
"protected",
"function",
"renderNavbarMenuPage",
"(",
"AbstractPage",
"$",
"page",
",",
"array",
"$",
"options",
",",
"$",
"depth",
",",
"$",
"prevDepth",
")",
"{",
"// Check for depth",
"$",
"html",
"=",
"''",
";",
"if",
"(",
"$",
"depth",
">",
"$",
"pr... | Render navbar menu page
@param AbstractPage $page Page to render
@param array $options Options for controlling rendering
@param integer $depth Current iteration depth
@param integer $prevDepth Previous iteration depth
@return string | [
"Render",
"navbar",
"menu",
"page"
] | 289afa531a12e6159568b592b95964374442e850 | https://github.com/internalsystemerror/ise-module-bootstrap/blob/289afa531a12e6159568b592b95964374442e850/src/View/Helper/Navigation/Navbar.php#L313-L354 |
11,804 | internalsystemerror/ise-module-bootstrap | src/View/Helper/Navigation/Navbar.php | Navbar.isPageEmpty | protected function isPageEmpty(AbstractPage $page)
{
if ($page->get('route')) {
return false;
}
if (!$page->hasPages(true)) {
return true;
}
$isGranted = $this->getView()->plugin('isGranted');
foreach ($page->getPages() as $ch... | php | protected function isPageEmpty(AbstractPage $page)
{
if ($page->get('route')) {
return false;
}
if (!$page->hasPages(true)) {
return true;
}
$isGranted = $this->getView()->plugin('isGranted');
foreach ($page->getPages() as $ch... | [
"protected",
"function",
"isPageEmpty",
"(",
"AbstractPage",
"$",
"page",
")",
"{",
"if",
"(",
"$",
"page",
"->",
"get",
"(",
"'route'",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"page",
"->",
"hasPages",
"(",
"true",
")",
")... | Is the page empty?
@param AbstractPage $page Page to check
@return boolean | [
"Is",
"the",
"page",
"empty?"
] | 289afa531a12e6159568b592b95964374442e850 | https://github.com/internalsystemerror/ise-module-bootstrap/blob/289afa531a12e6159568b592b95964374442e850/src/View/Helper/Navigation/Navbar.php#L362-L384 |
11,805 | internalsystemerror/ise-module-bootstrap | src/View/Helper/Navigation/Navbar.php | Navbar.renderNavbarRightMenu | protected function renderNavbarRightMenu(array $options)
{
// Get container to use
$container = $options['rightMenu'];
$this->parseContainer($container);
if (null === $container) {
$container = new Navigation;
}
// Set option
$options['ulClass'] .... | php | protected function renderNavbarRightMenu(array $options)
{
// Get container to use
$container = $options['rightMenu'];
$this->parseContainer($container);
if (null === $container) {
$container = new Navigation;
}
// Set option
$options['ulClass'] .... | [
"protected",
"function",
"renderNavbarRightMenu",
"(",
"array",
"$",
"options",
")",
"{",
"// Get container to use",
"$",
"container",
"=",
"$",
"options",
"[",
"'rightMenu'",
"]",
";",
"$",
"this",
"->",
"parseContainer",
"(",
"$",
"container",
")",
";",
"if"... | Render navbar right aligned menu
@param array $options Options for controlling rendering
@return string | [
"Render",
"navbar",
"right",
"aligned",
"menu"
] | 289afa531a12e6159568b592b95964374442e850 | https://github.com/internalsystemerror/ise-module-bootstrap/blob/289afa531a12e6159568b592b95964374442e850/src/View/Helper/Navigation/Navbar.php#L392-L405 |
11,806 | internalsystemerror/ise-module-bootstrap | src/View/Helper/Navigation/Navbar.php | Navbar.createNavbarContainerClass | protected function createNavbarContainerClass(array $options)
{
// Create navbar container class
$containerClass = 'navbar';
if ($options['inverse']) {
$containerClass .= ' navbar-inverse';
}
if ($options['fixed']) {
$containerClass .= ' navbar-fixed-'... | php | protected function createNavbarContainerClass(array $options)
{
// Create navbar container class
$containerClass = 'navbar';
if ($options['inverse']) {
$containerClass .= ' navbar-inverse';
}
if ($options['fixed']) {
$containerClass .= ' navbar-fixed-'... | [
"protected",
"function",
"createNavbarContainerClass",
"(",
"array",
"$",
"options",
")",
"{",
"// Create navbar container class",
"$",
"containerClass",
"=",
"'navbar'",
";",
"if",
"(",
"$",
"options",
"[",
"'inverse'",
"]",
")",
"{",
"$",
"containerClass",
".=",... | Create navbar container class
@param array $options Options for controlling rendering
@return array
@throws Exception\InvalidArgumentException | [
"Create",
"navbar",
"container",
"class"
] | 289afa531a12e6159568b592b95964374442e850 | https://github.com/internalsystemerror/ise-module-bootstrap/blob/289afa531a12e6159568b592b95964374442e850/src/View/Helper/Navigation/Navbar.php#L433-L454 |
11,807 | internalsystemerror/ise-module-bootstrap | src/View/Helper/Navigation/Navbar.php | Navbar.createNavbarMenuClass | protected function createNavbarMenuClass(AbstractPage $page, $ulClass, $depth)
{
if ($depth === 0 && $ulClass) {
return ' class="' . $this->escapeHtmlAttribute($ulClass) . '"';
} elseif ($page->getParent() && $depth <= self::MAX_RENDER_DEPTH) {
return ' class="dropdown-menu"'... | php | protected function createNavbarMenuClass(AbstractPage $page, $ulClass, $depth)
{
if ($depth === 0 && $ulClass) {
return ' class="' . $this->escapeHtmlAttribute($ulClass) . '"';
} elseif ($page->getParent() && $depth <= self::MAX_RENDER_DEPTH) {
return ' class="dropdown-menu"'... | [
"protected",
"function",
"createNavbarMenuClass",
"(",
"AbstractPage",
"$",
"page",
",",
"$",
"ulClass",
",",
"$",
"depth",
")",
"{",
"if",
"(",
"$",
"depth",
"===",
"0",
"&&",
"$",
"ulClass",
")",
"{",
"return",
"' class=\"'",
".",
"$",
"this",
"->",
... | Create navbar menu class
@param AbstractPage $page Page being rendered
@param string $ulClass The ul class to set,
$param integer $depth Current iteration depth
@return string | [
"Create",
"navbar",
"menu",
"class"
] | 289afa531a12e6159568b592b95964374442e850 | https://github.com/internalsystemerror/ise-module-bootstrap/blob/289afa531a12e6159568b592b95964374442e850/src/View/Helper/Navigation/Navbar.php#L464-L473 |
11,808 | internalsystemerror/ise-module-bootstrap | src/View/Helper/Navigation/Navbar.php | Navbar.createNavbarMenuItemClass | protected function createNavbarMenuItemClass(AbstractPage $page, $addClassToLi, $depth)
{
// Render li tag and page
$liClasses = [];
// Is page active
if ($page->isActive()) {
$liClasses[] = 'active';
}
// Does page have children
if ($page->hasPa... | php | protected function createNavbarMenuItemClass(AbstractPage $page, $addClassToLi, $depth)
{
// Render li tag and page
$liClasses = [];
// Is page active
if ($page->isActive()) {
$liClasses[] = 'active';
}
// Does page have children
if ($page->hasPa... | [
"protected",
"function",
"createNavbarMenuItemClass",
"(",
"AbstractPage",
"$",
"page",
",",
"$",
"addClassToLi",
",",
"$",
"depth",
")",
"{",
"// Render li tag and page",
"$",
"liClasses",
"=",
"[",
"]",
";",
"// Is page active",
"if",
"(",
"$",
"page",
"->",
... | Create navbar menu item class
@param AbstractPage $page Page being rendered
@param boolean $addClassToLi Whether to add the page class to the
li, or leave it for the a
$param integer $depth Current iteration depth
@return string | [
"Create",
"navbar",
"menu",
"item",
"class"
] | 289afa531a12e6159568b592b95964374442e850 | https://github.com/internalsystemerror/ise-module-bootstrap/blob/289afa531a12e6159568b592b95964374442e850/src/View/Helper/Navigation/Navbar.php#L484-L510 |
11,809 | Arcavias/ext-zend | lib/custom/src/MW/Common/Criteria/Lucene.php | MW_Common_Criteria_Lucene.getConditionString | public function getConditionString( array $types, array $translations = array(), array $plugins = array() )
{
if( $this->_conditions !== null ) {
return $string = $this->_conditions->toString( $types, $translations, $plugins );
}
return new Zend_Search_Lucene_Search_Query_Insignificant();
} | php | public function getConditionString( array $types, array $translations = array(), array $plugins = array() )
{
if( $this->_conditions !== null ) {
return $string = $this->_conditions->toString( $types, $translations, $plugins );
}
return new Zend_Search_Lucene_Search_Query_Insignificant();
} | [
"public",
"function",
"getConditionString",
"(",
"array",
"$",
"types",
",",
"array",
"$",
"translations",
"=",
"array",
"(",
")",
",",
"array",
"$",
"plugins",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_conditions",
"!==",
"null... | Returns the expression string.
@param array $types Associative list of item names and their types
@param array $translations Associative list of item names that should be translated
@param array $plugins Associative list of item names and plugins implementing MW_Common_Criteria_Plugin_Interface
@return string Expressi... | [
"Returns",
"the",
"expression",
"string",
"."
] | 1d2adc81ae0091a70f1053e0f095d55e656a3c96 | https://github.com/Arcavias/ext-zend/blob/1d2adc81ae0091a70f1053e0f095d55e656a3c96/lib/custom/src/MW/Common/Criteria/Lucene.php#L106-L113 |
11,810 | Arcavias/ext-zend | lib/custom/src/MW/Common/Criteria/Lucene.php | MW_Common_Criteria_Lucene.getSortationString | public function getSortationString( array $types, array $translations = array() )
{
$sortation = '';
foreach( $this->_sortations as $sortitem )
{
if( ( $string = $sortitem->toString( $types, $translations ) ) !== '' ) {
$sortation .= $string;
}
}
return $sortation;
} | php | public function getSortationString( array $types, array $translations = array() )
{
$sortation = '';
foreach( $this->_sortations as $sortitem )
{
if( ( $string = $sortitem->toString( $types, $translations ) ) !== '' ) {
$sortation .= $string;
}
}
return $sortation;
} | [
"public",
"function",
"getSortationString",
"(",
"array",
"$",
"types",
",",
"array",
"$",
"translations",
"=",
"array",
"(",
")",
")",
"{",
"$",
"sortation",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"_sortations",
"as",
"$",
"sortitem",
")",
... | Returns the string for sorting the result
@param array $names List of item names
@param array $translations Associative list of item names that should be translated
@return string Order string for sorting the items | [
"Returns",
"the",
"string",
"for",
"sorting",
"the",
"result"
] | 1d2adc81ae0091a70f1053e0f095d55e656a3c96 | https://github.com/Arcavias/ext-zend/blob/1d2adc81ae0091a70f1053e0f095d55e656a3c96/lib/custom/src/MW/Common/Criteria/Lucene.php#L151-L163 |
11,811 | vworldat/composer-construction-kit-installer | src/ConstructionKitBuildingBlocksDetector.php | ConstructionKitBuildingBlocksDetector.checkSettings | protected function checkSettings()
{
$io = $this->event->getIO();
if ($this->disabled) {
$io->write('<info>[C33sConstructionKitBundle] C33sConstructionKit is disabled</info>');
return false;
}
if (!is_dir($this->appDir)) {
$currentDir = getcwd()... | php | protected function checkSettings()
{
$io = $this->event->getIO();
if ($this->disabled) {
$io->write('<info>[C33sConstructionKitBundle] C33sConstructionKit is disabled</info>');
return false;
}
if (!is_dir($this->appDir)) {
$currentDir = getcwd()... | [
"protected",
"function",
"checkSettings",
"(",
")",
"{",
"$",
"io",
"=",
"$",
"this",
"->",
"event",
"->",
"getIO",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"disabled",
")",
"{",
"$",
"io",
"->",
"write",
"(",
"'<info>[C33sConstructionKitBundle] C33s... | Check various settings before performing any updates.
@return bool | [
"Check",
"various",
"settings",
"before",
"performing",
"any",
"updates",
"."
] | 1ccf82bb86d5a7e5c95fff5f50c83f21f10b89ca | https://github.com/vworldat/composer-construction-kit-installer/blob/1ccf82bb86d5a7e5c95fff5f50c83f21f10b89ca/src/ConstructionKitBuildingBlocksDetector.php#L68-L86 |
11,812 | vworldat/composer-construction-kit-installer | src/ConstructionKitBuildingBlocksDetector.php | ConstructionKitBuildingBlocksDetector.listChanges | protected function listChanges($existingConfig, array $blocks)
{
$existingBlocks = array();
if (isset($existingConfig['c33s_construction_kit']['composer_building_blocks']) && is_array($existingConfig['c33s_construction_kit']['composer_building_blocks'])) {
foreach ($existingConfig['c33s_... | php | protected function listChanges($existingConfig, array $blocks)
{
$existingBlocks = array();
if (isset($existingConfig['c33s_construction_kit']['composer_building_blocks']) && is_array($existingConfig['c33s_construction_kit']['composer_building_blocks'])) {
foreach ($existingConfig['c33s_... | [
"protected",
"function",
"listChanges",
"(",
"$",
"existingConfig",
",",
"array",
"$",
"blocks",
")",
"{",
"$",
"existingBlocks",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"existingConfig",
"[",
"'c33s_construction_kit'",
"]",
"[",
"'compose... | Display information regarding changed building blocks.
@param mixed $existingConfig
@param mixed $blocks | [
"Display",
"information",
"regarding",
"changed",
"building",
"blocks",
"."
] | 1ccf82bb86d5a7e5c95fff5f50c83f21f10b89ca | https://github.com/vworldat/composer-construction-kit-installer/blob/1ccf82bb86d5a7e5c95fff5f50c83f21f10b89ca/src/ConstructionKitBuildingBlocksDetector.php#L134-L163 |
11,813 | vworldat/composer-construction-kit-installer | src/ConstructionKitBuildingBlocksDetector.php | ConstructionKitBuildingBlocksDetector.getPackagesData | protected function getPackagesData()
{
$composer = $this->event->getComposer();
$locker = $composer->getLocker();
if (isset($locker)) {
$lockData = $locker->getLockData();
$allPackages = isset($lockData['packages']) ? $lockData['packages'] : array();
}
... | php | protected function getPackagesData()
{
$composer = $this->event->getComposer();
$locker = $composer->getLocker();
if (isset($locker)) {
$lockData = $locker->getLockData();
$allPackages = isset($lockData['packages']) ? $lockData['packages'] : array();
}
... | [
"protected",
"function",
"getPackagesData",
"(",
")",
"{",
"$",
"composer",
"=",
"$",
"this",
"->",
"event",
"->",
"getComposer",
"(",
")",
";",
"$",
"locker",
"=",
"$",
"composer",
"->",
"getLocker",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"loc... | Get active non-dev packages from composer's locker that include an c33s-building-blocks extra array.
@return array | [
"Get",
"active",
"non",
"-",
"dev",
"packages",
"from",
"composer",
"s",
"locker",
"that",
"include",
"an",
"c33s",
"-",
"building",
"-",
"blocks",
"extra",
"array",
"."
] | 1ccf82bb86d5a7e5c95fff5f50c83f21f10b89ca | https://github.com/vworldat/composer-construction-kit-installer/blob/1ccf82bb86d5a7e5c95fff5f50c83f21f10b89ca/src/ConstructionKitBuildingBlocksDetector.php#L170-L200 |
11,814 | vworldat/composer-construction-kit-installer | src/ConstructionKitBuildingBlocksDetector.php | ConstructionKitBuildingBlocksDetector.storeConfig | protected function storeConfig(array $blocksByPackage)
{
$content = "# This file is auto-generated by c33s/composer-construction-kit-installer\n# upon each composer dump-autoload event\n";
$content .= Yaml::dump(array(
'c33s_construction_kit' => array(
'composer_building_... | php | protected function storeConfig(array $blocksByPackage)
{
$content = "# This file is auto-generated by c33s/composer-construction-kit-installer\n# upon each composer dump-autoload event\n";
$content .= Yaml::dump(array(
'c33s_construction_kit' => array(
'composer_building_... | [
"protected",
"function",
"storeConfig",
"(",
"array",
"$",
"blocksByPackage",
")",
"{",
"$",
"content",
"=",
"\"# This file is auto-generated by c33s/composer-construction-kit-installer\\n# upon each composer dump-autoload event\\n\"",
";",
"$",
"content",
".=",
"Yaml",
"::",
"... | Save new blocks config to file.
@param array $blocks | [
"Save",
"new",
"blocks",
"config",
"to",
"file",
"."
] | 1ccf82bb86d5a7e5c95fff5f50c83f21f10b89ca | https://github.com/vworldat/composer-construction-kit-installer/blob/1ccf82bb86d5a7e5c95fff5f50c83f21f10b89ca/src/ConstructionKitBuildingBlocksDetector.php#L217-L228 |
11,815 | zepi/turbo-base | Zepi/Web/General/src/Manager/AssetCacheManager.php | AssetCacheManager.isCached | public function isCached($type, $hash, $version)
{
// If the base file isn't cached we do not need to check the file names
if (!isset($this->cachedFiles[$hash])) {
return false;
}
$searchedFile = $this->buildFilePath($type, $hash, $version);
foreach ($thi... | php | public function isCached($type, $hash, $version)
{
// If the base file isn't cached we do not need to check the file names
if (!isset($this->cachedFiles[$hash])) {
return false;
}
$searchedFile = $this->buildFilePath($type, $hash, $version);
foreach ($thi... | [
"public",
"function",
"isCached",
"(",
"$",
"type",
",",
"$",
"hash",
",",
"$",
"version",
")",
"{",
"// If the base file isn't cached we do not need to check the file names",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"cachedFiles",
"[",
"$",
"hash",
"]",... | Returns true if the given file is cached, otherwise return false.
@access public
@param string $type
@param string $hash
@param string $version
@return boolean | [
"Returns",
"true",
"if",
"the",
"given",
"file",
"is",
"cached",
"otherwise",
"return",
"false",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/General/src/Manager/AssetCacheManager.php#L199-L214 |
11,816 | zepi/turbo-base | Zepi/Web/General/src/Manager/AssetCacheManager.php | AssetCacheManager.getAssetContent | public function getAssetContent($type, $hash, $version)
{
if (!$this->isCached($type, $hash, $version)) {
return '';
}
$targetFile = $this->buildFilePath($type, $hash, $version);
return $this->fileBackend->loadFromFile($targetFile);
} | php | public function getAssetContent($type, $hash, $version)
{
if (!$this->isCached($type, $hash, $version)) {
return '';
}
$targetFile = $this->buildFilePath($type, $hash, $version);
return $this->fileBackend->loadFromFile($targetFile);
} | [
"public",
"function",
"getAssetContent",
"(",
"$",
"type",
",",
"$",
"hash",
",",
"$",
"version",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isCached",
"(",
"$",
"type",
",",
"$",
"hash",
",",
"$",
"version",
")",
")",
"{",
"return",
"''",
";"... | Returns the content of the given type and file.
@access public
@param string $type
@param string $hash
@param string $version
@return string | [
"Returns",
"the",
"content",
"of",
"the",
"given",
"type",
"and",
"file",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/General/src/Manager/AssetCacheManager.php#L225-L233 |
11,817 | zepi/turbo-base | Zepi/Web/General/src/Manager/AssetCacheManager.php | AssetCacheManager.getCachedAssetTimestamp | public function getCachedAssetTimestamp($type, $hash, $version)
{
if (!$this->isCached($type, $hash, $version)) {
return 0;
}
return $this->cachedFiles[$hash]['timestamp'];
} | php | public function getCachedAssetTimestamp($type, $hash, $version)
{
if (!$this->isCached($type, $hash, $version)) {
return 0;
}
return $this->cachedFiles[$hash]['timestamp'];
} | [
"public",
"function",
"getCachedAssetTimestamp",
"(",
"$",
"type",
",",
"$",
"hash",
",",
"$",
"version",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isCached",
"(",
"$",
"type",
",",
"$",
"hash",
",",
"$",
"version",
")",
")",
"{",
"return",
"0"... | Returns the timestamp of the cached asset
@param string $type
@param string $hash
@param string $version
@return integer | [
"Returns",
"the",
"timestamp",
"of",
"the",
"cached",
"asset"
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/General/src/Manager/AssetCacheManager.php#L243-L250 |
11,818 | zepi/turbo-base | Zepi/Web/General/src/Manager/AssetCacheManager.php | AssetCacheManager.displayAssetType | public function displayAssetType($type)
{
$files = $this->assetManager->getAssetFiles($type);
// If there are no files for the given type return here.
if ($files === false) {
return;
}
if ($this->combineAssets) {
$this->displayCombinedAssets(... | php | public function displayAssetType($type)
{
$files = $this->assetManager->getAssetFiles($type);
// If there are no files for the given type return here.
if ($files === false) {
return;
}
if ($this->combineAssets) {
$this->displayCombinedAssets(... | [
"public",
"function",
"displayAssetType",
"(",
"$",
"type",
")",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"assetManager",
"->",
"getAssetFiles",
"(",
"$",
"type",
")",
";",
"// If there are no files for the given type return here.",
"if",
"(",
"$",
"files",
"=... | Make the cache for an asset type and display the html
code to include the asset type.
@access public
@param string $type
@return string | [
"Make",
"the",
"cache",
"for",
"an",
"asset",
"type",
"and",
"display",
"the",
"html",
"code",
"to",
"include",
"the",
"asset",
"type",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/General/src/Manager/AssetCacheManager.php#L260-L280 |
11,819 | zepi/turbo-base | Zepi/Web/General/src/Manager/AssetCacheManager.php | AssetCacheManager.displayCombinedAssets | protected function displayCombinedAssets($type, $files)
{
$isValid = $this->validateTypeCache($type, $files);
// If the cache isn't valid, we build the cache
$result = $isValid;
if (!$isValid) {
$result = $this->buildTypeCache($type, $files);
}
... | php | protected function displayCombinedAssets($type, $files)
{
$isValid = $this->validateTypeCache($type, $files);
// If the cache isn't valid, we build the cache
$result = $isValid;
if (!$isValid) {
$result = $this->buildTypeCache($type, $files);
}
... | [
"protected",
"function",
"displayCombinedAssets",
"(",
"$",
"type",
",",
"$",
"files",
")",
"{",
"$",
"isValid",
"=",
"$",
"this",
"->",
"validateTypeCache",
"(",
"$",
"type",
",",
"$",
"files",
")",
";",
"// If the cache isn't valid, we build the cache",
"$",
... | Displays the combined assets for the given asset type
@param string $type
@param array $files | [
"Displays",
"the",
"combined",
"assets",
"for",
"the",
"given",
"asset",
"type"
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/General/src/Manager/AssetCacheManager.php#L288-L305 |
11,820 | zepi/turbo-base | Zepi/Web/General/src/Manager/AssetCacheManager.php | AssetCacheManager.getAssetUrl | public function getAssetUrl($type, $assetName)
{
$file = $this->assetManager->getAssetFile($type, $assetName);
if ($file === false) {
return;
}
$cachedFile = $this->generateCachedFile($type, $file->getFileName());
return $this->getUrlToT... | php | public function getAssetUrl($type, $assetName)
{
$file = $this->assetManager->getAssetFile($type, $assetName);
if ($file === false) {
return;
}
$cachedFile = $this->generateCachedFile($type, $file->getFileName());
return $this->getUrlToT... | [
"public",
"function",
"getAssetUrl",
"(",
"$",
"type",
",",
"$",
"assetName",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"assetManager",
"->",
"getAssetFile",
"(",
"$",
"type",
",",
"$",
"assetName",
")",
";",
"if",
"(",
"$",
"file",
"===",
"fals... | Returns the url for one asset.
@access public
@param string $type
@param string $assetName
@return string | [
"Returns",
"the",
"url",
"for",
"one",
"asset",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/General/src/Manager/AssetCacheManager.php#L315-L326 |
11,821 | zepi/turbo-base | Zepi/Web/General/src/Manager/AssetCacheManager.php | AssetCacheManager.generateCachedFile | public function generateCachedFile($type, $fileName)
{
$isValid = $this->validateCache($fileName);
// If the cache isn't valid, we build the cache
$result = $isValid;
if (!$isValid) {
$result = $this->buildFileCache($type, $fileName);
}
... | php | public function generateCachedFile($type, $fileName)
{
$isValid = $this->validateCache($fileName);
// If the cache isn't valid, we build the cache
$result = $isValid;
if (!$isValid) {
$result = $this->buildFileCache($type, $fileName);
}
... | [
"public",
"function",
"generateCachedFile",
"(",
"$",
"type",
",",
"$",
"fileName",
")",
"{",
"$",
"isValid",
"=",
"$",
"this",
"->",
"validateCache",
"(",
"$",
"fileName",
")",
";",
"// If the cache isn't valid, we build the cache",
"$",
"result",
"=",
"$",
"... | Generates a cached file for the given type and base file.
@access public
@param string $type
@param string $fileName
@return string|false | [
"Generates",
"a",
"cached",
"file",
"for",
"the",
"given",
"type",
"and",
"base",
"file",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/General/src/Manager/AssetCacheManager.php#L336-L353 |
11,822 | zepi/turbo-base | Zepi/Web/General/src/Manager/AssetCacheManager.php | AssetCacheManager.clearAssetCache | public function clearAssetCache()
{
foreach ($this->cachedFiles as $hash => $fileData) {
if (!$this->fileBackend->isWritable($fileData['file'])) {
continue;
}
$this->fileBackend->deleteFile($fileData['file']);
}
$this->cac... | php | public function clearAssetCache()
{
foreach ($this->cachedFiles as $hash => $fileData) {
if (!$this->fileBackend->isWritable($fileData['file'])) {
continue;
}
$this->fileBackend->deleteFile($fileData['file']);
}
$this->cac... | [
"public",
"function",
"clearAssetCache",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"cachedFiles",
"as",
"$",
"hash",
"=>",
"$",
"fileData",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"fileBackend",
"->",
"isWritable",
"(",
"$",
"fileData",
"[... | Clears the asset cache.
@access public | [
"Clears",
"the",
"asset",
"cache",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/General/src/Manager/AssetCacheManager.php#L374-L386 |
11,823 | zepi/turbo-base | Zepi/Web/General/src/Manager/AssetCacheManager.php | AssetCacheManager.buildTypeCache | protected function buildTypeCache($type, $files)
{
$typeContent = '';
$fileHashs = array();
// Generate the content for all the files
foreach ($files as $file) {
$fileName = $file->getFileName();
if (!file_exists($fileName)) {
continue;
... | php | protected function buildTypeCache($type, $files)
{
$typeContent = '';
$fileHashs = array();
// Generate the content for all the files
foreach ($files as $file) {
$fileName = $file->getFileName();
if (!file_exists($fileName)) {
continue;
... | [
"protected",
"function",
"buildTypeCache",
"(",
"$",
"type",
",",
"$",
"files",
")",
"{",
"$",
"typeContent",
"=",
"''",
";",
"$",
"fileHashs",
"=",
"array",
"(",
")",
";",
"// Generate the content for all the files",
"foreach",
"(",
"$",
"files",
"as",
"$",... | Builds the cache for an asset type
@access protected
@param string $type
@param array $files
@return string | [
"Builds",
"the",
"cache",
"for",
"an",
"asset",
"type"
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/General/src/Manager/AssetCacheManager.php#L396-L442 |
11,824 | zepi/turbo-base | Zepi/Web/General/src/Manager/AssetCacheManager.php | AssetCacheManager.buildFileCache | protected function buildFileCache($type, $fileName)
{
if (!file_exists($fileName)) {
return false;
}
// Load the content
$content = $this->fileBackend->loadFromFile($fileName);
// Optimze the content
$content = $this->optimizeContent($typ... | php | protected function buildFileCache($type, $fileName)
{
if (!file_exists($fileName)) {
return false;
}
// Load the content
$content = $this->fileBackend->loadFromFile($fileName);
// Optimze the content
$content = $this->optimizeContent($typ... | [
"protected",
"function",
"buildFileCache",
"(",
"$",
"type",
",",
"$",
"fileName",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"fileName",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Load the content",
"$",
"content",
"=",
"$",
"this",
"->",
... | Generates the cache for the given files.
@access protected
@param string $type
@param string $fileName
@return false|string | [
"Generates",
"the",
"cache",
"for",
"the",
"given",
"files",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/General/src/Manager/AssetCacheManager.php#L452-L488 |
11,825 | zepi/turbo-base | Zepi/Web/General/src/Manager/AssetCacheManager.php | AssetCacheManager.removeCacheFile | protected function removeCacheFile($hash)
{
if (!$this->hasCachedFile($hash)) {
return false;
}
$fileData = $this->cachedFiles[$hash];
$this->fileBackend->deleteFile($fileData['file']);
} | php | protected function removeCacheFile($hash)
{
if (!$this->hasCachedFile($hash)) {
return false;
}
$fileData = $this->cachedFiles[$hash];
$this->fileBackend->deleteFile($fileData['file']);
} | [
"protected",
"function",
"removeCacheFile",
"(",
"$",
"hash",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasCachedFile",
"(",
"$",
"hash",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"fileData",
"=",
"$",
"this",
"->",
"cachedFiles",
"[",
"$"... | Deletes the cache file for the given hash
@param string $hash
@return boolean | [
"Deletes",
"the",
"cache",
"file",
"for",
"the",
"given",
"hash"
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/General/src/Manager/AssetCacheManager.php#L579-L587 |
11,826 | zepi/turbo-base | Zepi/Web/General/src/Manager/AssetCacheManager.php | AssetCacheManager.validateCache | protected function validateCache($fileName)
{
$hash = $this->getHash($fileName);
if (!file_exists($fileName) || !isset($this->cachedFiles[$hash])) {
return false;
}
$fileChecksum = md5_file($fileName);
$cachedChecksum = $this->cachedFiles[$hash]['checksum... | php | protected function validateCache($fileName)
{
$hash = $this->getHash($fileName);
if (!file_exists($fileName) || !isset($this->cachedFiles[$hash])) {
return false;
}
$fileChecksum = md5_file($fileName);
$cachedChecksum = $this->cachedFiles[$hash]['checksum... | [
"protected",
"function",
"validateCache",
"(",
"$",
"fileName",
")",
"{",
"$",
"hash",
"=",
"$",
"this",
"->",
"getHash",
"(",
"$",
"fileName",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"fileName",
")",
"||",
"!",
"isset",
"(",
"$",
"this",
... | Returns false, if the cached version of the given
file isn't up to date.
@access protected
@param string $fileName
@return boolean | [
"Returns",
"false",
"if",
"the",
"cached",
"version",
"of",
"the",
"given",
"file",
"isn",
"t",
"up",
"to",
"date",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/General/src/Manager/AssetCacheManager.php#L597-L612 |
11,827 | zepi/turbo-base | Zepi/Web/General/src/Manager/AssetCacheManager.php | AssetCacheManager.validateTypeCache | protected function validateTypeCache($type, $files)
{
// If the files isn't cached we have to cache the file
$hash = $this->getTypeHash($type);
if (!isset($this->cachedFiles[$hash])) {
return false;
}
$data = $this->cachedFiles[$hash];
$checksums... | php | protected function validateTypeCache($type, $files)
{
// If the files isn't cached we have to cache the file
$hash = $this->getTypeHash($type);
if (!isset($this->cachedFiles[$hash])) {
return false;
}
$data = $this->cachedFiles[$hash];
$checksums... | [
"protected",
"function",
"validateTypeCache",
"(",
"$",
"type",
",",
"$",
"files",
")",
"{",
"// If the files isn't cached we have to cache the file",
"$",
"hash",
"=",
"$",
"this",
"->",
"getTypeHash",
"(",
"$",
"type",
")",
";",
"if",
"(",
"!",
"isset",
"(",... | Validates the cache for an asset type. Return false, if the
cache isn't valid.
@access protected
@param string $type
@param array $files
@return boolean | [
"Validates",
"the",
"cache",
"for",
"an",
"asset",
"type",
".",
"Return",
"false",
"if",
"the",
"cache",
"isn",
"t",
"valid",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/General/src/Manager/AssetCacheManager.php#L623-L648 |
11,828 | zepi/turbo-base | Zepi/Web/General/src/Manager/AssetCacheManager.php | AssetCacheManager.generateHtmlCode | protected function generateHtmlCode($type, $file)
{
// Generate the url
$url = $this->getUrlToTheAssetLoader($file);
// Return the correct html tag
if ($type === AssetManager::CSS) {
return '<link rel="stylesheet" type="text/css" href="' . $url . '">' . PHP_EOL;
... | php | protected function generateHtmlCode($type, $file)
{
// Generate the url
$url = $this->getUrlToTheAssetLoader($file);
// Return the correct html tag
if ($type === AssetManager::CSS) {
return '<link rel="stylesheet" type="text/css" href="' . $url . '">' . PHP_EOL;
... | [
"protected",
"function",
"generateHtmlCode",
"(",
"$",
"type",
",",
"$",
"file",
")",
"{",
"// Generate the url",
"$",
"url",
"=",
"$",
"this",
"->",
"getUrlToTheAssetLoader",
"(",
"$",
"file",
")",
";",
"// Return the correct html tag",
"if",
"(",
"$",
"type"... | Generates the html code for the given asset
@access protected
@param string $type
@param string $file
@return string | [
"Generates",
"the",
"html",
"code",
"for",
"the",
"given",
"asset"
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/General/src/Manager/AssetCacheManager.php#L674-L685 |
11,829 | Briareos/mongodb-odm | lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataInfo.php | ClassMetadataInfo.setDiscriminatorField | public function setDiscriminatorField($discriminatorField)
{
if ($discriminatorField === null) {
$this->discriminatorField = null;
return;
}
// Handle array argument with name/fieldName keys for BC
if (is_array($discriminatorField)) {
if (isset($... | php | public function setDiscriminatorField($discriminatorField)
{
if ($discriminatorField === null) {
$this->discriminatorField = null;
return;
}
// Handle array argument with name/fieldName keys for BC
if (is_array($discriminatorField)) {
if (isset($... | [
"public",
"function",
"setDiscriminatorField",
"(",
"$",
"discriminatorField",
")",
"{",
"if",
"(",
"$",
"discriminatorField",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"discriminatorField",
"=",
"null",
";",
"return",
";",
"}",
"// Handle array argument with na... | Sets the discriminator field.
The field name is the the unmapped database field. Discriminator values
are only used to discern the hydration class and are not mapped to class
properties.
@param string $discriminatorField
@throws MappingException If the discriminator field conflicts with the
"name" attribute of a map... | [
"Sets",
"the",
"discriminator",
"field",
"."
] | 29e28bed9a265efd7d05473b0a909fb7c83f76e0 | https://github.com/Briareos/mongodb-odm/blob/29e28bed9a265efd7d05473b0a909fb7c83f76e0/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataInfo.php#L635-L659 |
11,830 | agalbourdin/agl-core | src/Data/Dir.php | Dir.deleteRecursive | public static function deleteRecursive($pDir)
{
$files = glob($pDir . '*', GLOB_MARK);
foreach ($files as $file) {
if (substr($file, -1) == '/') {
self::deleteRecursive($file);
} else {
unlink($file);
}
}
if (is_dir... | php | public static function deleteRecursive($pDir)
{
$files = glob($pDir . '*', GLOB_MARK);
foreach ($files as $file) {
if (substr($file, -1) == '/') {
self::deleteRecursive($file);
} else {
unlink($file);
}
}
if (is_dir... | [
"public",
"static",
"function",
"deleteRecursive",
"(",
"$",
"pDir",
")",
"{",
"$",
"files",
"=",
"glob",
"(",
"$",
"pDir",
".",
"'*'",
",",
"GLOB_MARK",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"substr",
"(",... | Recursive deletion of a directory.
@param string $pDir
@return bool | [
"Recursive",
"deletion",
"of",
"a",
"directory",
"."
] | 1db556f9a49488aa9fab6887fefb7141a79ad97d | https://github.com/agalbourdin/agl-core/blob/1db556f9a49488aa9fab6887fefb7141a79ad97d/src/Data/Dir.php#L25-L41 |
11,831 | agalbourdin/agl-core | src/Data/Dir.php | Dir.chmod | public static function chmod($pDir, $pMode)
{
if (strpos($pMode, '0') !== 0) {
$mode = octdec('0' . $pMode);
} else {
$mode = octdec($pMode);
}
return chmod($pDir, $mode);
} | php | public static function chmod($pDir, $pMode)
{
if (strpos($pMode, '0') !== 0) {
$mode = octdec('0' . $pMode);
} else {
$mode = octdec($pMode);
}
return chmod($pDir, $mode);
} | [
"public",
"static",
"function",
"chmod",
"(",
"$",
"pDir",
",",
"$",
"pMode",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"pMode",
",",
"'0'",
")",
"!==",
"0",
")",
"{",
"$",
"mode",
"=",
"octdec",
"(",
"'0'",
".",
"$",
"pMode",
")",
";",
"}",
"... | CHMOD a directory.
@param string $pDir
@param mixed $pMode
@return bool | [
"CHMOD",
"a",
"directory",
"."
] | 1db556f9a49488aa9fab6887fefb7141a79ad97d | https://github.com/agalbourdin/agl-core/blob/1db556f9a49488aa9fab6887fefb7141a79ad97d/src/Data/Dir.php#L126-L135 |
11,832 | scholtz/AsyncWeb | src/AsyncWeb/Text/Texts.php | Texts.word_substr | public static function word_substr($text, $from, $minlength, $maxlength) {
$text = mb_substr($text, $from, $maxlength);
$p1 = strrpos($text, ' ');
if ($p1 >= $minlength) {
return mb_substr($text, 0, $p1);
}
return $text;
} | php | public static function word_substr($text, $from, $minlength, $maxlength) {
$text = mb_substr($text, $from, $maxlength);
$p1 = strrpos($text, ' ');
if ($p1 >= $minlength) {
return mb_substr($text, 0, $p1);
}
return $text;
} | [
"public",
"static",
"function",
"word_substr",
"(",
"$",
"text",
",",
"$",
"from",
",",
"$",
"minlength",
",",
"$",
"maxlength",
")",
"{",
"$",
"text",
"=",
"mb_substr",
"(",
"$",
"text",
",",
"$",
"from",
",",
"$",
"maxlength",
")",
";",
"$",
"p1"... | This function does the substr function, but does not end the string in the middle of the word if the end is between min and max length. | [
"This",
"function",
"does",
"the",
"substr",
"function",
"but",
"does",
"not",
"end",
"the",
"string",
"in",
"the",
"middle",
"of",
"the",
"word",
"if",
"the",
"end",
"is",
"between",
"min",
"and",
"max",
"length",
"."
] | 66a906298080c2c66d8f0fb85211b6100b3776bf | https://github.com/scholtz/AsyncWeb/blob/66a906298080c2c66d8f0fb85211b6100b3776bf/src/AsyncWeb/Text/Texts.php#L7-L14 |
11,833 | gentry-php/gentry | src/Generator.php | Generator.generate | public function generate(ReflectionClass $class, array $methods, array $uncovered) : void
{
$this->objectUnderTest = $class;
$this->features = [];
foreach ($methods as $method) {
if (isset($uncovered[$method->name]) && $uncovered[$method->name]) {
$this->addFeatur... | php | public function generate(ReflectionClass $class, array $methods, array $uncovered) : void
{
$this->objectUnderTest = $class;
$this->features = [];
foreach ($methods as $method) {
if (isset($uncovered[$method->name]) && $uncovered[$method->name]) {
$this->addFeatur... | [
"public",
"function",
"generate",
"(",
"ReflectionClass",
"$",
"class",
",",
"array",
"$",
"methods",
",",
"array",
"$",
"uncovered",
")",
":",
"void",
"{",
"$",
"this",
"->",
"objectUnderTest",
"=",
"$",
"class",
";",
"$",
"this",
"->",
"features",
"=",... | Generates stub test methods for all found features.
@param ReflectionClass $class The reflection of the object or trait under
test.
@param array $methods Array of reflected methods to generate test
skeletons for.
@param array $uncovered Array of uncovered method calls.
@return void | [
"Generates",
"stub",
"test",
"methods",
"for",
"all",
"found",
"features",
"."
] | 1e6a909f63cdf653e640540b116c92885c3329cf | https://github.com/gentry-php/gentry/blob/1e6a909f63cdf653e640540b116c92885c3329cf/src/Generator.php#L48-L58 |
11,834 | gentry-php/gentry | src/Generator.php | Generator.addFeature | private function addFeature(ReflectionClass $class, ReflectionMethod $method, array $calls) : void
{
Formatter::out("<gray> Adding tests for feature <magenta>{$class->name}::{$method->name}\n");
$tested = $method->name;
$this->features[$method->name] = (object)['calls' => []];
foreac... | php | private function addFeature(ReflectionClass $class, ReflectionMethod $method, array $calls) : void
{
Formatter::out("<gray> Adding tests for feature <magenta>{$class->name}::{$method->name}\n");
$tested = $method->name;
$this->features[$method->name] = (object)['calls' => []];
foreac... | [
"private",
"function",
"addFeature",
"(",
"ReflectionClass",
"$",
"class",
",",
"ReflectionMethod",
"$",
"method",
",",
"array",
"$",
"calls",
")",
":",
"void",
"{",
"Formatter",
"::",
"out",
"(",
"\"<gray> Adding tests for feature <magenta>{$class->name}::{$method->nam... | Internal method to add a testable feature.
@param string The reflection of the object or trait to test a feature on.
@param ReflectionMethod $method Reflection of the feature to test.
@param array $calls Array of possible types of calls.
@return void | [
"Internal",
"method",
"to",
"add",
"a",
"testable",
"feature",
"."
] | 1e6a909f63cdf653e640540b116c92885c3329cf | https://github.com/gentry-php/gentry/blob/1e6a909f63cdf653e640540b116c92885c3329cf/src/Generator.php#L68-L97 |
11,835 | gentry-php/gentry | src/Generator.php | Generator.write | public function write() : void
{
if (!$this->features) {
return;
}
$i = 0;
while (true) {
$file = sprintf('%s/%s%s.php', $this->config->output, $this->normalize($this->objectUnderTest->getName()), $i ? ".$i" : '');
if (!file_exists($file)) {
... | php | public function write() : void
{
if (!$this->features) {
return;
}
$i = 0;
while (true) {
$file = sprintf('%s/%s%s.php', $this->config->output, $this->normalize($this->objectUnderTest->getName()), $i ? ".$i" : '');
if (!file_exists($file)) {
... | [
"public",
"function",
"write",
"(",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"features",
")",
"{",
"return",
";",
"}",
"$",
"i",
"=",
"0",
";",
"while",
"(",
"true",
")",
"{",
"$",
"file",
"=",
"sprintf",
"(",
"'%s/%s%s.php'",
... | Actually write the generated stubs to file. If a file by the name of the
feature already exists, a number is appended.
@return void | [
"Actually",
"write",
"the",
"generated",
"stubs",
"to",
"file",
".",
"If",
"a",
"file",
"by",
"the",
"name",
"of",
"the",
"feature",
"already",
"exists",
"a",
"number",
"is",
"appended",
"."
] | 1e6a909f63cdf653e640540b116c92885c3329cf | https://github.com/gentry-php/gentry/blob/1e6a909f63cdf653e640540b116c92885c3329cf/src/Generator.php#L105-L119 |
11,836 | gentry-php/gentry | src/Generator.php | Generator.render | private function render() : string
{
return $this->twig->render('template.html.twig', [
'namespace' => $this->config->namespace ?? null,
'objectUnderTest' => $this->objectUnderTest->name,
'features' => $this->features,
]);
} | php | private function render() : string
{
return $this->twig->render('template.html.twig', [
'namespace' => $this->config->namespace ?? null,
'objectUnderTest' => $this->objectUnderTest->name,
'features' => $this->features,
]);
} | [
"private",
"function",
"render",
"(",
")",
":",
"string",
"{",
"return",
"$",
"this",
"->",
"twig",
"->",
"render",
"(",
"'template.html.twig'",
",",
"[",
"'namespace'",
"=>",
"$",
"this",
"->",
"config",
"->",
"namespace",
"??",
"null",
",",
"'objectUnder... | Renders the testing code according to the supplied template.
@return string | [
"Renders",
"the",
"testing",
"code",
"according",
"to",
"the",
"supplied",
"template",
"."
] | 1e6a909f63cdf653e640540b116c92885c3329cf | https://github.com/gentry-php/gentry/blob/1e6a909f63cdf653e640540b116c92885c3329cf/src/Generator.php#L126-L133 |
11,837 | gentry-php/gentry | src/Generator.php | Generator.getDefaultForType | private function getDefaultForType(string $type, int $mode = 0) : string
{
$isClass = false;
switch ($type) {
case 'string': $value = "'blarps'"; break;
case 'int': $value = '1'; break;
case 'float': $value = '1.1'; break;
case 'mixed': $value = "'MIXE... | php | private function getDefaultForType(string $type, int $mode = 0) : string
{
$isClass = false;
switch ($type) {
case 'string': $value = "'blarps'"; break;
case 'int': $value = '1'; break;
case 'float': $value = '1.1'; break;
case 'mixed': $value = "'MIXE... | [
"private",
"function",
"getDefaultForType",
"(",
"string",
"$",
"type",
",",
"int",
"$",
"mode",
"=",
"0",
")",
":",
"string",
"{",
"$",
"isClass",
"=",
"false",
";",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"'string'",
":",
"$",
"value",
"=",
... | Get a string representation of a default value for a given type.
@param string $type
@param int $mode
@return string | [
"Get",
"a",
"string",
"representation",
"of",
"a",
"default",
"value",
"for",
"a",
"given",
"type",
"."
] | 1e6a909f63cdf653e640540b116c92885c3329cf | https://github.com/gentry-php/gentry/blob/1e6a909f63cdf653e640540b116c92885c3329cf/src/Generator.php#L142-L178 |
11,838 | lengthofrope/create-jsonld-tiny | src/Elements/ElementGroup.php | ElementGroup.remove | public function remove(Interfaces\IElement $element)
{
if ($this->elements->contains($element)) {
$this->elements->detach($element);
}
return $this;
} | php | public function remove(Interfaces\IElement $element)
{
if ($this->elements->contains($element)) {
$this->elements->detach($element);
}
return $this;
} | [
"public",
"function",
"remove",
"(",
"Interfaces",
"\\",
"IElement",
"$",
"element",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"elements",
"->",
"contains",
"(",
"$",
"element",
")",
")",
"{",
"$",
"this",
"->",
"elements",
"->",
"detach",
"(",
"$",
"e... | Remove a JSONLD element
@param Interfaces\IElement $element
@return ElementGroup | [
"Remove",
"a",
"JSONLD",
"element"
] | 7abf2e46b8eb4a5e886949ef737588c67c65acd9 | https://github.com/lengthofrope/create-jsonld-tiny/blob/7abf2e46b8eb4a5e886949ef737588c67c65acd9/src/Elements/ElementGroup.php#L66-L73 |
11,839 | AnonymPHP/Anonym-Library | src/Anonym/Html/Form/ExpressionFactory.php | ExpressionFactory.replaceTokens | public function replaceTokens($tokens){
$keys = array_keys($tokens);
$values = array_values($tokens);
return str_replace($keys, $values, $this->getExpression());
} | php | public function replaceTokens($tokens){
$keys = array_keys($tokens);
$values = array_values($tokens);
return str_replace($keys, $values, $this->getExpression());
} | [
"public",
"function",
"replaceTokens",
"(",
"$",
"tokens",
")",
"{",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"tokens",
")",
";",
"$",
"values",
"=",
"array_values",
"(",
"$",
"tokens",
")",
";",
"return",
"str_replace",
"(",
"$",
"keys",
",",
"$",
... | replace tokens and return new string
@param array $tokens
@return mixed | [
"replace",
"tokens",
"and",
"return",
"new",
"string"
] | c967ad804f84e8fb204593a0959cda2fed5ae075 | https://github.com/AnonymPHP/Anonym-Library/blob/c967ad804f84e8fb204593a0959cda2fed5ae075/src/Anonym/Html/Form/ExpressionFactory.php#L84-L89 |
11,840 | samokspv/CakePHP-DBConfigure | Utility/DBConfigure.php | DBConfigure._getEngine | protected static function _getEngine() {
if (!self::$_Engine) {
self::$_Engine = ClassRegistry::init('DBConfigure.' . self::$_EngineName);
}
return self::$_Engine;
} | php | protected static function _getEngine() {
if (!self::$_Engine) {
self::$_Engine = ClassRegistry::init('DBConfigure.' . self::$_EngineName);
}
return self::$_Engine;
} | [
"protected",
"static",
"function",
"_getEngine",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"_Engine",
")",
"{",
"self",
"::",
"$",
"_Engine",
"=",
"ClassRegistry",
"::",
"init",
"(",
"'DBConfigure.'",
".",
"self",
"::",
"$",
"_EngineName",
")",
... | Return engine instance
@return object | [
"Return",
"engine",
"instance"
] | e288c3f2bff9c621f57c141f7e61315bf270ce28 | https://github.com/samokspv/CakePHP-DBConfigure/blob/e288c3f2bff9c621f57c141f7e61315bf270ce28/Utility/DBConfigure.php#L92-L98 |
11,841 | samokspv/CakePHP-DBConfigure | Utility/DBConfigure.php | DBConfigure._buildWriteParams | protected static function _buildWriteParams($params = array()) {
$writeParams['equalKeysOnly'] = (
isset($params['equalKeysOnly']) &&
empty($params['equalKeysOnly']) ? false : true
);
return $writeParams;
} | php | protected static function _buildWriteParams($params = array()) {
$writeParams['equalKeysOnly'] = (
isset($params['equalKeysOnly']) &&
empty($params['equalKeysOnly']) ? false : true
);
return $writeParams;
} | [
"protected",
"static",
"function",
"_buildWriteParams",
"(",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"writeParams",
"[",
"'equalKeysOnly'",
"]",
"=",
"(",
"isset",
"(",
"$",
"params",
"[",
"'equalKeysOnly'",
"]",
")",
"&&",
"empty",
"(",
"$... | Build write params
@param array $params
@return array | [
"Build",
"write",
"params"
] | e288c3f2bff9c621f57c141f7e61315bf270ce28 | https://github.com/samokspv/CakePHP-DBConfigure/blob/e288c3f2bff9c621f57c141f7e61315bf270ce28/Utility/DBConfigure.php#L121-L128 |
11,842 | mfrost503/Snaggle | src/Client/Header/Header.php | Header.createAuthorizationHeader | public function createAuthorizationHeader($includePrefix = false)
{
$headerParams = array(
'oauth_signature' => $this->signature->sign(),
'oauth_nonce' => $this->signature->getNonce(),
'oauth_signature_method' => $this->signature->getSignatureMethod(),
'oauth_... | php | public function createAuthorizationHeader($includePrefix = false)
{
$headerParams = array(
'oauth_signature' => $this->signature->sign(),
'oauth_nonce' => $this->signature->getNonce(),
'oauth_signature_method' => $this->signature->getSignatureMethod(),
'oauth_... | [
"public",
"function",
"createAuthorizationHeader",
"(",
"$",
"includePrefix",
"=",
"false",
")",
"{",
"$",
"headerParams",
"=",
"array",
"(",
"'oauth_signature'",
"=>",
"$",
"this",
"->",
"signature",
"->",
"sign",
"(",
")",
",",
"'oauth_nonce'",
"=>",
"$",
... | Build the authorization header
@return string | [
"Build",
"the",
"authorization",
"header"
] | 20990fe94b12b2013bca22689cde3b231eac4380 | https://github.com/mfrost503/Snaggle/blob/20990fe94b12b2013bca22689cde3b231eac4380/src/Client/Header/Header.php#L29-L58 |
11,843 | bkdotcom/Toolbox | src/DateTimeUtil.php | DateTimeUtil.getDateTime | public static function getDateTime($datetime = null)
{
if ($datetime instanceof \DateTime) {
return clone $datetime;
}
if ($datetime instanceof \DateTimeImmutable) {
return new \DateTime($datetime->format(\DateTime::ATOM));
}
if (\is_string($datetime))... | php | public static function getDateTime($datetime = null)
{
if ($datetime instanceof \DateTime) {
return clone $datetime;
}
if ($datetime instanceof \DateTimeImmutable) {
return new \DateTime($datetime->format(\DateTime::ATOM));
}
if (\is_string($datetime))... | [
"public",
"static",
"function",
"getDateTime",
"(",
"$",
"datetime",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"datetime",
"instanceof",
"\\",
"DateTime",
")",
"{",
"return",
"clone",
"$",
"datetime",
";",
"}",
"if",
"(",
"$",
"datetime",
"instanceof",
"\\"... | Return a datetime obj
@param mixed $datetime DateTime, DatetimeImmutable, int, or string
@return DateTime | [
"Return",
"a",
"datetime",
"obj"
] | 2f9d34fd57bd8382baee4c29aac13a6710e3a994 | https://github.com/bkdotcom/Toolbox/blob/2f9d34fd57bd8382baee4c29aac13a6710e3a994/src/DateTimeUtil.php#L113-L141 |
11,844 | bkdotcom/Toolbox | src/DateTimeUtil.php | DateTimeUtil.getNextBusinessDay | public static function getNextBusinessDay($datetime, $holidays = array())
{
$dateParts = self::getdate($datetime);
// Add 1 day to begin with
$ts = \mktime(0, 0, 0, $dateParts['mon'], $dateParts['mday']+1, $dateParts['year']);
$goodDate = false;
while (!$goodDate) {
... | php | public static function getNextBusinessDay($datetime, $holidays = array())
{
$dateParts = self::getdate($datetime);
// Add 1 day to begin with
$ts = \mktime(0, 0, 0, $dateParts['mon'], $dateParts['mday']+1, $dateParts['year']);
$goodDate = false;
while (!$goodDate) {
... | [
"public",
"static",
"function",
"getNextBusinessDay",
"(",
"$",
"datetime",
",",
"$",
"holidays",
"=",
"array",
"(",
")",
")",
"{",
"$",
"dateParts",
"=",
"self",
"::",
"getdate",
"(",
"$",
"datetime",
")",
";",
"// Add 1 day to begin with",
"$",
"ts",
"="... | Given passed datetime return DateTime of next business day
@param mixed $datetime DateTime, string, or timestamp
@param array $holidays array() Optional array of dates (formatted yyyymmdd) that will be skipped
@return DateTime | [
"Given",
"passed",
"datetime",
"return",
"DateTime",
"of",
"next",
"business",
"day"
] | 2f9d34fd57bd8382baee4c29aac13a6710e3a994 | https://github.com/bkdotcom/Toolbox/blob/2f9d34fd57bd8382baee4c29aac13a6710e3a994/src/DateTimeUtil.php#L151-L173 |
11,845 | bkdotcom/Toolbox | src/DateTimeUtil.php | DateTimeUtil.getRelTime | public static function getRelTime($datetime, $datetimeFrom = null)
{
$ret = '';
$dateTime = self::getDateTime($datetime);
$dateTimeFrom = self::getDateTime($datetimeFrom);
$dateTimeSameDay = clone $dateTimeFrom;
$dateTimeSameDay->setTime(0, 0, 0);
$diffSec = $dateTime... | php | public static function getRelTime($datetime, $datetimeFrom = null)
{
$ret = '';
$dateTime = self::getDateTime($datetime);
$dateTimeFrom = self::getDateTime($datetimeFrom);
$dateTimeSameDay = clone $dateTimeFrom;
$dateTimeSameDay->setTime(0, 0, 0);
$diffSec = $dateTime... | [
"public",
"static",
"function",
"getRelTime",
"(",
"$",
"datetime",
",",
"$",
"datetimeFrom",
"=",
"null",
")",
"{",
"$",
"ret",
"=",
"''",
";",
"$",
"dateTime",
"=",
"self",
"::",
"getDateTime",
"(",
"$",
"datetime",
")",
";",
"$",
"dateTimeFrom",
"="... | Return a "3 hours ago" type string for passed timestamp
@param mixed $datetime DateTime, string, or timestamp
@param mixed $datetimeFrom (default = now) DateTime, string, or timestamp
@return string | [
"Return",
"a",
"3",
"hours",
"ago",
"type",
"string",
"for",
"passed",
"timestamp"
] | 2f9d34fd57bd8382baee4c29aac13a6710e3a994 | https://github.com/bkdotcom/Toolbox/blob/2f9d34fd57bd8382baee4c29aac13a6710e3a994/src/DateTimeUtil.php#L266-L307 |
11,846 | snapwp/snap-debug | src/Handlers/General.php | General.get_handler | public function get_handler()
{
$handler = new PrettyPageHandler();
$handler->addDataTableCallback('$wp_query', [$this, 'add_query']);
$handler->addDataTableCallback('$post', [$this, 'add_post']);
$handler->addDataTableCallback('$wp', [$this, 'add_wp']);
retur... | php | public function get_handler()
{
$handler = new PrettyPageHandler();
$handler->addDataTableCallback('$wp_query', [$this, 'add_query']);
$handler->addDataTableCallback('$post', [$this, 'add_post']);
$handler->addDataTableCallback('$wp', [$this, 'add_wp']);
retur... | [
"public",
"function",
"get_handler",
"(",
")",
"{",
"$",
"handler",
"=",
"new",
"PrettyPageHandler",
"(",
")",
";",
"$",
"handler",
"->",
"addDataTableCallback",
"(",
"'$wp_query'",
",",
"[",
"$",
"this",
",",
"'add_query'",
"]",
")",
";",
"$",
"handler",
... | Return the Whoops PrettyPageHandler.
@since 1.0.0
@return PrettyPageHandler | [
"Return",
"the",
"Whoops",
"PrettyPageHandler",
"."
] | 49c0c258ce50098a3fca076ce122adf57571f2e2 | https://github.com/snapwp/snap-debug/blob/49c0c258ce50098a3fca076ce122adf57571f2e2/src/Handlers/General.php#L22-L33 |
11,847 | snapwp/snap-debug | src/Handlers/General.php | General.add_query | public function add_query()
{
global $wp_query;
if (! $wp_query instanceof WP_Query) {
return [];
}
$output = \get_object_vars($wp_query);
$output['query_vars'] = \array_filter($output['query_vars']);
unset($output['posts'], $output['post']);
... | php | public function add_query()
{
global $wp_query;
if (! $wp_query instanceof WP_Query) {
return [];
}
$output = \get_object_vars($wp_query);
$output['query_vars'] = \array_filter($output['query_vars']);
unset($output['posts'], $output['post']);
... | [
"public",
"function",
"add_query",
"(",
")",
"{",
"global",
"$",
"wp_query",
";",
"if",
"(",
"!",
"$",
"wp_query",
"instanceof",
"WP_Query",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"output",
"=",
"\\",
"get_object_vars",
"(",
"$",
"wp_query",
")",... | Add the WP_Query global to Whoops data list.
@since 1.0.0
@return array | [
"Add",
"the",
"WP_Query",
"global",
"to",
"Whoops",
"data",
"list",
"."
] | 49c0c258ce50098a3fca076ce122adf57571f2e2 | https://github.com/snapwp/snap-debug/blob/49c0c258ce50098a3fca076ce122adf57571f2e2/src/Handlers/General.php#L42-L57 |
11,848 | snapwp/snap-debug | src/Handlers/General.php | General.add_wp | public function add_wp()
{
global $wp;
if (! $wp instanceof WP) {
return array();
}
$output = \get_object_vars($wp);
unset($output['private_query_vars'], $output['public_query_vars']);
return \array_filter($output);
} | php | public function add_wp()
{
global $wp;
if (! $wp instanceof WP) {
return array();
}
$output = \get_object_vars($wp);
unset($output['private_query_vars'], $output['public_query_vars']);
return \array_filter($output);
} | [
"public",
"function",
"add_wp",
"(",
")",
"{",
"global",
"$",
"wp",
";",
"if",
"(",
"!",
"$",
"wp",
"instanceof",
"WP",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"output",
"=",
"\\",
"get_object_vars",
"(",
"$",
"wp",
")",
";",
"unset... | Add the WP global to Whoops data list.
@since 1.0.0
@return array | [
"Add",
"the",
"WP",
"global",
"to",
"Whoops",
"data",
"list",
"."
] | 49c0c258ce50098a3fca076ce122adf57571f2e2 | https://github.com/snapwp/snap-debug/blob/49c0c258ce50098a3fca076ce122adf57571f2e2/src/Handlers/General.php#L84-L97 |
11,849 | rozaverta/cmf | core/Event/EventManager.php | EventManager.dispatcher | public static function dispatcher($name)
{
static $all = [];
if(! isset($all[$name]))
{
// system has been installed
// use default mode
if(Helper::isSystemInstall())
{
$cache = new Cache($name, 'events');
if( $cache->ready() )
{
$data = $cache->import();
}
else
{
... | php | public static function dispatcher($name)
{
static $all = [];
if(! isset($all[$name]))
{
// system has been installed
// use default mode
if(Helper::isSystemInstall())
{
$cache = new Cache($name, 'events');
if( $cache->ready() )
{
$data = $cache->import();
}
else
{
... | [
"public",
"static",
"function",
"dispatcher",
"(",
"$",
"name",
")",
"{",
"static",
"$",
"all",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"all",
"[",
"$",
"name",
"]",
")",
")",
"{",
"// system has been installed",
"// use default mode",
"... | Get event manager element from cache
@param $name
@return \EApp\Event\Dispatcher
@throws \Exception | [
"Get",
"event",
"manager",
"element",
"from",
"cache"
] | 95ed38362e397d1c700ee255f7200234ef98d356 | https://github.com/rozaverta/cmf/blob/95ed38362e397d1c700ee255f7200234ef98d356/core/Event/EventManager.php#L26-L78 |
11,850 | monomelodies/dabble | src/Query.php | Query.error | protected function error($msg, array $bind = [])
{
foreach ($bind as $key => $value) {
if (is_null($value)) {
$value = 'NULL';
} elseif (is_bool($value)) {
$value = $value ? 'true' : 'false';
}
$msg .= "$key => $value\n";
... | php | protected function error($msg, array $bind = [])
{
foreach ($bind as $key => $value) {
if (is_null($value)) {
$value = 'NULL';
} elseif (is_bool($value)) {
$value = $value ? 'true' : 'false';
}
$msg .= "$key => $value\n";
... | [
"protected",
"function",
"error",
"(",
"$",
"msg",
",",
"array",
"$",
"bind",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"bind",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"$",
"... | Internal helper to correctly format error messages.
@param string $msg The original error message.
@param array $bind Array of bound values.
@return string Formatted error message. | [
"Internal",
"helper",
"to",
"correctly",
"format",
"error",
"messages",
"."
] | 4ba771cf90116b61821af8d15652cb6e5665e4b7 | https://github.com/monomelodies/dabble/blob/4ba771cf90116b61821af8d15652cb6e5665e4b7/src/Query.php#L91-L102 |
11,851 | yuanqing/extract | src/Extract.php | Extract.parseCapturingGroup | private function parseCapturingGroup($group, $charBefore, $charAfter)
{
$split = explode(':', $group); # split on ':'
# $key is before the ':''
$key = trim($split[0]);
if ($key === '' || $key == '.') {
throw new \InvalidArgumentException('Invalid capturing group');
}
$this->keys[] = $ke... | php | private function parseCapturingGroup($group, $charBefore, $charAfter)
{
$split = explode(':', $group); # split on ':'
# $key is before the ':''
$key = trim($split[0]);
if ($key === '' || $key == '.') {
throw new \InvalidArgumentException('Invalid capturing group');
}
$this->keys[] = $ke... | [
"private",
"function",
"parseCapturingGroup",
"(",
"$",
"group",
",",
"$",
"charBefore",
",",
"$",
"charAfter",
")",
"{",
"$",
"split",
"=",
"explode",
"(",
"':'",
",",
"$",
"group",
")",
";",
"# split on ':'",
"# $key is before the ':''",
"$",
"key",
"=",
... | Parses a raw capturing group into a RegEx capturing group
@param string $group The string between the opening braces and closing braces
@param string $charBefore The character immediately before the opening braces
@param string $charAfter The character immediately after the closing braces
@throws UnexpectedValueExcept... | [
"Parses",
"a",
"raw",
"capturing",
"group",
"into",
"a",
"RegEx",
"capturing",
"group"
] | c1c207e19ce50bb244485c262ce7741ca36a0b8c | https://github.com/yuanqing/extract/blob/c1c207e19ce50bb244485c262ce7741ca36a0b8c/src/Extract.php#L81-L156 |
11,852 | sebastianmonzel/webfiles-framework-php | source/core/datatypes/time/MTimestampHelper.php | MTimestampHelper.getMonthEnd | public static function getMonthEnd($month = -1, $year = -1)
{
if ($month == -1) {
$month = date("n");
}
if ($year == -1) {
$year = date("Y");
}
//gets the number of days in the actual month
$tempTime = mktime(0, 0, 0, $month, 1, $year);
... | php | public static function getMonthEnd($month = -1, $year = -1)
{
if ($month == -1) {
$month = date("n");
}
if ($year == -1) {
$year = date("Y");
}
//gets the number of days in the actual month
$tempTime = mktime(0, 0, 0, $month, 1, $year);
... | [
"public",
"static",
"function",
"getMonthEnd",
"(",
"$",
"month",
"=",
"-",
"1",
",",
"$",
"year",
"=",
"-",
"1",
")",
"{",
"if",
"(",
"$",
"month",
"==",
"-",
"1",
")",
"{",
"$",
"month",
"=",
"date",
"(",
"\"n\"",
")",
";",
"}",
"if",
"(",
... | returns a timestamp of the end of a month
@param int $month
@param int $year
@return false|int | [
"returns",
"a",
"timestamp",
"of",
"the",
"end",
"of",
"a",
"month"
] | 5ac1fc99e8e9946080e3ba877b2320cd6a3e5b5d | https://github.com/sebastianmonzel/webfiles-framework-php/blob/5ac1fc99e8e9946080e3ba877b2320cd6a3e5b5d/source/core/datatypes/time/MTimestampHelper.php#L35-L49 |
11,853 | sebastianmonzel/webfiles-framework-php | source/core/datatypes/time/MTimestampHelper.php | MTimestampHelper.getFormatedDate | public static function getFormatedDate($timestamp)
{
return MTimestampHelper::getDay($timestamp) . "." . MTimestampHelper::getMonth($timestamp) . "." . MTimestampHelper::getYear($timestamp);
} | php | public static function getFormatedDate($timestamp)
{
return MTimestampHelper::getDay($timestamp) . "." . MTimestampHelper::getMonth($timestamp) . "." . MTimestampHelper::getYear($timestamp);
} | [
"public",
"static",
"function",
"getFormatedDate",
"(",
"$",
"timestamp",
")",
"{",
"return",
"MTimestampHelper",
"::",
"getDay",
"(",
"$",
"timestamp",
")",
".",
"\".\"",
".",
"MTimestampHelper",
"::",
"getMonth",
"(",
"$",
"timestamp",
")",
".",
"\".\"",
"... | returns the given timestamp in a manner like
@param duration duration in seconds
@return string | [
"returns",
"the",
"given",
"timestamp",
"in",
"a",
"manner",
"like"
] | 5ac1fc99e8e9946080e3ba877b2320cd6a3e5b5d | https://github.com/sebastianmonzel/webfiles-framework-php/blob/5ac1fc99e8e9946080e3ba877b2320cd6a3e5b5d/source/core/datatypes/time/MTimestampHelper.php#L143-L146 |
11,854 | bugadani/DBTiny | src/Driver.php | Driver.inTransaction | public function inTransaction(callable $function)
{
if (!is_callable($function)) {
throw new InvalidArgumentException('$function must be callable.');
}
$this->beginTransaction();
try {
if (func_num_args() === 1) {
$returnValue = $function($this... | php | public function inTransaction(callable $function)
{
if (!is_callable($function)) {
throw new InvalidArgumentException('$function must be callable.');
}
$this->beginTransaction();
try {
if (func_num_args() === 1) {
$returnValue = $function($this... | [
"public",
"function",
"inTransaction",
"(",
"callable",
"$",
"function",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"function",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'$function must be callable.'",
")",
";",
"}",
"$",
"this",... | Call a function guarded by a transaction.
@param callable $function The function to guard. First argument is the driver, the rest are the arguments
passed to the method.
@return mixed The return value of the guarded function | [
"Call",
"a",
"function",
"guarded",
"by",
"a",
"transaction",
"."
] | c25af0ae6234084cc4466bedea14b670b2169b34 | https://github.com/bugadani/DBTiny/blob/c25af0ae6234084cc4466bedea14b670b2169b34/src/Driver.php#L53-L73 |
11,855 | jamesmcfadden/gen | src/Layout.php | Layout.render | public function render(Page $page)
{
return $this->doRender(
$this->getRawContent(),
$this->getAttributes() + ['content' => $page->getRenderedContent()]
);
} | php | public function render(Page $page)
{
return $this->doRender(
$this->getRawContent(),
$this->getAttributes() + ['content' => $page->getRenderedContent()]
);
} | [
"public",
"function",
"render",
"(",
"Page",
"$",
"page",
")",
"{",
"return",
"$",
"this",
"->",
"doRender",
"(",
"$",
"this",
"->",
"getRawContent",
"(",
")",
",",
"$",
"this",
"->",
"getAttributes",
"(",
")",
"+",
"[",
"'content'",
"=>",
"$",
"page... | Render the layout with a given Page.
@param Page $page
@return string | [
"Render",
"the",
"layout",
"with",
"a",
"given",
"Page",
"."
] | 2c7a7da1c3a04e10463c956722f85f5da13dc179 | https://github.com/jamesmcfadden/gen/blob/2c7a7da1c3a04e10463c956722f85f5da13dc179/src/Layout.php#L58-L64 |
11,856 | vox-tecnologia/functions | src/Functions/AbstractFunctions.php | AbstractFunctions.parameterTypeCheck | public function parameterTypeCheck($param, string $type = 'string'): bool
{
$type = 'is_'.$type;
return (bool) ($type($param) && ! empty($param));
} | php | public function parameterTypeCheck($param, string $type = 'string'): bool
{
$type = 'is_'.$type;
return (bool) ($type($param) && ! empty($param));
} | [
"public",
"function",
"parameterTypeCheck",
"(",
"$",
"param",
",",
"string",
"$",
"type",
"=",
"'string'",
")",
":",
"bool",
"{",
"$",
"type",
"=",
"'is_'",
".",
"$",
"type",
";",
"return",
"(",
"bool",
")",
"(",
"$",
"type",
"(",
"$",
"param",
")... | Parameter type check.
@param mixed $param The input parameter
@param string $type The type of parameter [bool, float, int, string, array, object]
@return bool
@api | [
"Parameter",
"type",
"check",
"."
] | 1da249ac87f9d7c46d1c714d65443cda9face807 | https://github.com/vox-tecnologia/functions/blob/1da249ac87f9d7c46d1c714d65443cda9face807/src/Functions/AbstractFunctions.php#L110-L115 |
11,857 | vox-tecnologia/functions | src/Functions/AbstractFunctions.php | AbstractFunctions.arrayKeyExistsRecursive | public function arrayKeyExistsRecursive(string $needle, array $haystack): bool
{
$result = array_key_exists($needle, $haystack);
if (true === $result) {
return $result;
}
$this->arrayKeyExistsRecursiveExtended($needle, $haystack);
return $result;
} | php | public function arrayKeyExistsRecursive(string $needle, array $haystack): bool
{
$result = array_key_exists($needle, $haystack);
if (true === $result) {
return $result;
}
$this->arrayKeyExistsRecursiveExtended($needle, $haystack);
return $result;
} | [
"public",
"function",
"arrayKeyExistsRecursive",
"(",
"string",
"$",
"needle",
",",
"array",
"$",
"haystack",
")",
":",
"bool",
"{",
"$",
"result",
"=",
"array_key_exists",
"(",
"$",
"needle",
",",
"$",
"haystack",
")",
";",
"if",
"(",
"true",
"===",
"$"... | Recursive version of array_key_exists.
The PHP funcction 'array_key_exists' does NOT work recursively, so this
can be used to find a key nested in a multidimensional array.
Another option is to use the 'array_walk_recursive' function since PHP 5.3.
@param string $needle The search string
@param array $haystack The... | [
"Recursive",
"version",
"of",
"array_key_exists",
"."
] | 1da249ac87f9d7c46d1c714d65443cda9face807 | https://github.com/vox-tecnologia/functions/blob/1da249ac87f9d7c46d1c714d65443cda9face807/src/Functions/AbstractFunctions.php#L133-L142 |
11,858 | vox-tecnologia/functions | src/Functions/AbstractFunctions.php | AbstractFunctions.arrayKeyExistsRecursiveExtended | public function arrayKeyExistsRecursiveExtended(string $needle, array $haystack): bool
{
$result = false;
foreach ($haystack as $value) {
if (true === is_array($value)) {
$result = $this->arrayKeyExistsRecursive($needle, $value);
}
if (true === $re... | php | public function arrayKeyExistsRecursiveExtended(string $needle, array $haystack): bool
{
$result = false;
foreach ($haystack as $value) {
if (true === is_array($value)) {
$result = $this->arrayKeyExistsRecursive($needle, $value);
}
if (true === $re... | [
"public",
"function",
"arrayKeyExistsRecursiveExtended",
"(",
"string",
"$",
"needle",
",",
"array",
"$",
"haystack",
")",
":",
"bool",
"{",
"$",
"result",
"=",
"false",
";",
"foreach",
"(",
"$",
"haystack",
"as",
"$",
"value",
")",
"{",
"if",
"(",
"true... | Recursive version extended sub-function.
@param string $needle The search string
@param array $haystack The space indented setting
@return bool
@api | [
"Recursive",
"version",
"extended",
"sub",
"-",
"function",
"."
] | 1da249ac87f9d7c46d1c714d65443cda9face807 | https://github.com/vox-tecnologia/functions/blob/1da249ac87f9d7c46d1c714d65443cda9face807/src/Functions/AbstractFunctions.php#L156-L169 |
11,859 | vox-tecnologia/functions | src/Functions/AbstractFunctions.php | AbstractFunctions.getTitledItem | public function getTitledItem(string $str, string $item = null, string $delimiter = ';'): string
{
return (null === $item)
? trim(substr(trim(substr($str, 0)), 0, $this->getStringPositionX(trim(substr($str, 0)), $delimiter, 1)))
: trim(substr(trim(substr($str, $this->getStringPositio... | php | public function getTitledItem(string $str, string $item = null, string $delimiter = ';'): string
{
return (null === $item)
? trim(substr(trim(substr($str, 0)), 0, $this->getStringPositionX(trim(substr($str, 0)), $delimiter, 1)))
: trim(substr(trim(substr($str, $this->getStringPositio... | [
"public",
"function",
"getTitledItem",
"(",
"string",
"$",
"str",
",",
"string",
"$",
"item",
"=",
"null",
",",
"string",
"$",
"delimiter",
"=",
"';'",
")",
":",
"string",
"{",
"return",
"(",
"null",
"===",
"$",
"item",
")",
"?",
"trim",
"(",
"substr... | A parser for title delimited data.
@param string $str The string data used to parse
@param string $item The defined title item to find
@param string $delimiter The default ending delimiter
@return string
@api | [
"A",
"parser",
"for",
"title",
"delimited",
"data",
"."
] | 1da249ac87f9d7c46d1c714d65443cda9face807 | https://github.com/vox-tecnologia/functions/blob/1da249ac87f9d7c46d1c714d65443cda9face807/src/Functions/AbstractFunctions.php#L184-L189 |
11,860 | vox-tecnologia/functions | src/Functions/AbstractFunctions.php | AbstractFunctions.sftpCreateDirectory | protected function sftpCreateDirectory(): FunctionsInterface
{
/* the directory structure on remote host must exist to SFTP */
if (true === $this->get('_createRemoteDirectory')) {
(file_exists($this->get('_localCacheFilePath')) && $this->get('_localFileSize') > 0)
? $this... | php | protected function sftpCreateDirectory(): FunctionsInterface
{
/* the directory structure on remote host must exist to SFTP */
if (true === $this->get('_createRemoteDirectory')) {
(file_exists($this->get('_localCacheFilePath')) && $this->get('_localFileSize') > 0)
? $this... | [
"protected",
"function",
"sftpCreateDirectory",
"(",
")",
":",
"FunctionsInterface",
"{",
"/* the directory structure on remote host must exist to SFTP */",
"if",
"(",
"true",
"===",
"$",
"this",
"->",
"get",
"(",
"'_createRemoteDirectory'",
")",
")",
"{",
"(",
"file_ex... | Handling new directory creation.
@return FunctionsInterface
@api | [
"Handling",
"new",
"directory",
"creation",
"."
] | 1da249ac87f9d7c46d1c714d65443cda9face807 | https://github.com/vox-tecnologia/functions/blob/1da249ac87f9d7c46d1c714d65443cda9face807/src/Functions/AbstractFunctions.php#L219-L229 |
11,861 | vox-tecnologia/functions | src/Functions/AbstractFunctions.php | AbstractFunctions.sftpTransport | protected function sftpTransport(ServiceRequestContainer $service, string $account): FunctionsInterface
{
$this->set('_account', $account)
->set('_sftp', $service->Sftp)
->set('_persist', $service->Persistence)
->set('_localCacheFilePath', $this... | php | protected function sftpTransport(ServiceRequestContainer $service, string $account): FunctionsInterface
{
$this->set('_account', $account)
->set('_sftp', $service->Sftp)
->set('_persist', $service->Persistence)
->set('_localCacheFilePath', $this... | [
"protected",
"function",
"sftpTransport",
"(",
"ServiceRequestContainer",
"$",
"service",
",",
"string",
"$",
"account",
")",
":",
"FunctionsInterface",
"{",
"$",
"this",
"->",
"set",
"(",
"'_account'",
",",
"$",
"account",
")",
"->",
"set",
"(",
"'_sftp'",
... | Upload file to remote server.
@param ServiceRequestContainer $service The ServiceRequestContainer Instance
@param string $account The account on remote host for SFTP transfer
@return FunctionsInterface
@api | [
"Upload",
"file",
"to",
"remote",
"server",
"."
] | 1da249ac87f9d7c46d1c714d65443cda9face807 | https://github.com/vox-tecnologia/functions/blob/1da249ac87f9d7c46d1c714d65443cda9face807/src/Functions/AbstractFunctions.php#L285-L300 |
11,862 | vox-tecnologia/functions | src/Functions/AbstractFunctions.php | AbstractFunctions.setLocalCache | protected function setLocalCache(FilesystemInterface $filesystem, string $absoluteFilePath, $content): FunctionsInterface
{
$this->set(
'localCacheFilePath',
$this->get('localCacheDirectory').'/'.
sha1(Config::APPLICATION_KEY).'/'.
sha1($absoluteFilePath).'.'.... | php | protected function setLocalCache(FilesystemInterface $filesystem, string $absoluteFilePath, $content): FunctionsInterface
{
$this->set(
'localCacheFilePath',
$this->get('localCacheDirectory').'/'.
sha1(Config::APPLICATION_KEY).'/'.
sha1($absoluteFilePath).'.'.... | [
"protected",
"function",
"setLocalCache",
"(",
"FilesystemInterface",
"$",
"filesystem",
",",
"string",
"$",
"absoluteFilePath",
",",
"$",
"content",
")",
":",
"FunctionsInterface",
"{",
"$",
"this",
"->",
"set",
"(",
"'localCacheFilePath'",
",",
"$",
"this",
"-... | Cache a local file to disk.
@param FilesystemInterface $filesystem The FilesystemInterface
@param string $absoluteFilePath The absolute file path (e.g., the full unique filename)
@param TemplateFactoryInterface|string $content The TemplateFactory Interface or a strin... | [
"Cache",
"a",
"local",
"file",
"to",
"disk",
"."
] | 1da249ac87f9d7c46d1c714d65443cda9face807 | https://github.com/vox-tecnologia/functions/blob/1da249ac87f9d7c46d1c714d65443cda9face807/src/Functions/AbstractFunctions.php#L315-L328 |
11,863 | studyportals/SQL | src/QueryBuilder.php | QueryBuilder._checkType | protected function _checkType($value, $type){
// Integers and floats are allowed be NULL
if($value === null && $type != 'bool'){
return true;
}
switch($type){
case 'int':
$reducer = function($result, $value){
if(!is_int($value)){
$result = false;
}
return $result;
};
... | php | protected function _checkType($value, $type){
// Integers and floats are allowed be NULL
if($value === null && $type != 'bool'){
return true;
}
switch($type){
case 'int':
$reducer = function($result, $value){
if(!is_int($value)){
$result = false;
}
return $result;
};
... | [
"protected",
"function",
"_checkType",
"(",
"$",
"value",
",",
"$",
"type",
")",
"{",
"// Integers and floats are allowed be NULL",
"if",
"(",
"$",
"value",
"===",
"null",
"&&",
"$",
"type",
"!=",
"'bool'",
")",
"{",
"return",
"true",
";",
"}",
"switch",
"... | Check the type of the provided value.
<p>Checks whether the provided {@link $value} is of the provided {@link
$type}. When {@link $value} is an array the check is performed on all
elements of the array. The check fails if any of the array-elements (or
the value itself) are not of the specified type.</p>
@param mixed ... | [
"Check",
"the",
"type",
"of",
"the",
"provided",
"value",
"."
] | 4f038ced9a3738c1d4ad562f93547812931d9ed4 | https://github.com/studyportals/SQL/blob/4f038ced9a3738c1d4ad562f93547812931d9ed4/src/QueryBuilder.php#L135-L205 |
11,864 | studyportals/SQL | src/QueryBuilder.php | QueryBuilder._parseMarker | protected function _parseMarker($marker, $parameter, $brace){
$brace = strtolower($brace);
$result = [
'uid' => md5(uniqid($parameter, true)),
'force-type' => null,
'identifier' => false
];
// Integer quick-marker (#parameter# => @[int]parameter@)
if($marker == '#'){
assert('$brace == \'\'');... | php | protected function _parseMarker($marker, $parameter, $brace){
$brace = strtolower($brace);
$result = [
'uid' => md5(uniqid($parameter, true)),
'force-type' => null,
'identifier' => false
];
// Integer quick-marker (#parameter# => @[int]parameter@)
if($marker == '#'){
assert('$brace == \'\'');... | [
"protected",
"function",
"_parseMarker",
"(",
"$",
"marker",
",",
"$",
"parameter",
",",
"$",
"brace",
")",
"{",
"$",
"brace",
"=",
"strtolower",
"(",
"$",
"brace",
")",
";",
"$",
"result",
"=",
"[",
"'uid'",
"=>",
"md5",
"(",
"uniqid",
"(",
"$",
"... | Parse the contents of a QueryBuilder marker.
@param string $marker
@param string $parameter
@param string $brace
@return array
@throws InvalidSyntaxException | [
"Parse",
"the",
"contents",
"of",
"a",
"QueryBuilder",
"marker",
"."
] | 4f038ced9a3738c1d4ad562f93547812931d9ed4 | https://github.com/studyportals/SQL/blob/4f038ced9a3738c1d4ad562f93547812931d9ed4/src/QueryBuilder.php#L508-L567 |
11,865 | studyportals/SQL | src/QueryBuilder.php | QueryBuilder.compose | public function compose(SQL $SQL){
$tokens = [];
$query_string = '';
foreach($this->_values as $name => $value){
// Throws an exception on invalid name/value
$this->_checkParameter($name, $value);
assert('is_array($this->_parameters[$name])');
$prepared_value = $this->_prepareValue($value, $SQL,... | php | public function compose(SQL $SQL){
$tokens = [];
$query_string = '';
foreach($this->_values as $name => $value){
// Throws an exception on invalid name/value
$this->_checkParameter($name, $value);
assert('is_array($this->_parameters[$name])');
$prepared_value = $this->_prepareValue($value, $SQL,... | [
"public",
"function",
"compose",
"(",
"SQL",
"$",
"SQL",
")",
"{",
"$",
"tokens",
"=",
"[",
"]",
";",
"$",
"query_string",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"_values",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"// Throws an ... | Composes the query present in this QueryBuilder instance.
@param SQL $SQL
@return string
@throws QueryBuilderException | [
"Composes",
"the",
"query",
"present",
"in",
"this",
"QueryBuilder",
"instance",
"."
] | 4f038ced9a3738c1d4ad562f93547812931d9ed4 | https://github.com/studyportals/SQL/blob/4f038ced9a3738c1d4ad562f93547812931d9ed4/src/QueryBuilder.php#L577-L621 |
11,866 | studyportals/SQL | src/QueryBuilder.php | QueryBuilder._prepareValue | protected function _prepareValue($value, SQL $SQL, $identifier = false){
// Identifier should be string (purely a sanity-check, enforced elsewhere)
assert('!(!is_string($value) && $identifier)');
// String
if(is_string($value)){
// NULL
if(strtoupper($value) == 'NULL'){
$value = 'NULL';
}
... | php | protected function _prepareValue($value, SQL $SQL, $identifier = false){
// Identifier should be string (purely a sanity-check, enforced elsewhere)
assert('!(!is_string($value) && $identifier)');
// String
if(is_string($value)){
// NULL
if(strtoupper($value) == 'NULL'){
$value = 'NULL';
}
... | [
"protected",
"function",
"_prepareValue",
"(",
"$",
"value",
",",
"SQL",
"$",
"SQL",
",",
"$",
"identifier",
"=",
"false",
")",
"{",
"// Identifier should be string (purely a sanity-check, enforced elsewhere)",
"assert",
"(",
"'!(!is_string($value) && $identifier)'",
")",
... | Prepares a variable to be inserted into an SQL Query.
@param mixed $value
@param SQL $SQL
@param boolean $identifier Use the value as an SQL "identifier"
@return string
@throws QueryBuilderException | [
"Prepares",
"a",
"variable",
"to",
"be",
"inserted",
"into",
"an",
"SQL",
"Query",
"."
] | 4f038ced9a3738c1d4ad562f93547812931d9ed4 | https://github.com/studyportals/SQL/blob/4f038ced9a3738c1d4ad562f93547812931d9ed4/src/QueryBuilder.php#L633-L754 |
11,867 | studyportals/SQL | src/QueryBuilder.php | QueryBuilder.execute | public function execute(SQL $SQL, $return_set = false, $buffered = true){
$query_string = $this->compose($SQL);
$this->reset();
return $SQL->Query($query_string, $return_set, $buffered);
} | php | public function execute(SQL $SQL, $return_set = false, $buffered = true){
$query_string = $this->compose($SQL);
$this->reset();
return $SQL->Query($query_string, $return_set, $buffered);
} | [
"public",
"function",
"execute",
"(",
"SQL",
"$",
"SQL",
",",
"$",
"return_set",
"=",
"false",
",",
"$",
"buffered",
"=",
"true",
")",
"{",
"$",
"query_string",
"=",
"$",
"this",
"->",
"compose",
"(",
"$",
"SQL",
")",
";",
"$",
"this",
"->",
"reset... | Execute the query and reset the object's state.
<p>For details on the optional arguments to this method, see the
documentation of the {@link SQL::Query()} method.</p>
@param SQL $SQL
@param boolean $return_set
@param boolean $buffered
@throws QueryBuilderException
@return SQLResult
@see SQL::Query() | [
"Execute",
"the",
"query",
"and",
"reset",
"the",
"object",
"s",
"state",
"."
] | 4f038ced9a3738c1d4ad562f93547812931d9ed4 | https://github.com/studyportals/SQL/blob/4f038ced9a3738c1d4ad562f93547812931d9ed4/src/QueryBuilder.php#L771-L778 |
11,868 | benkle-libs/doctrine-adoption | src/MetadataListener.php | MetadataListener.loadClassMetadata | public function loadClassMetadata(LoadClassMetadataEventArgs $class)
{
$metaData = $class->getClassMetadata();
$adoptees = $this->collector->getAdoptees($metaData->name);
foreach ($adoptees as $discriminator => $adoptee) {
$metaData->discriminatorMap[$discriminator] = $adoptee;
... | php | public function loadClassMetadata(LoadClassMetadataEventArgs $class)
{
$metaData = $class->getClassMetadata();
$adoptees = $this->collector->getAdoptees($metaData->name);
foreach ($adoptees as $discriminator => $adoptee) {
$metaData->discriminatorMap[$discriminator] = $adoptee;
... | [
"public",
"function",
"loadClassMetadata",
"(",
"LoadClassMetadataEventArgs",
"$",
"class",
")",
"{",
"$",
"metaData",
"=",
"$",
"class",
"->",
"getClassMetadata",
"(",
")",
";",
"$",
"adoptees",
"=",
"$",
"this",
"->",
"collector",
"->",
"getAdoptees",
"(",
... | Handle LoadClassMetadataEvents to inject adoptees.
@param LoadClassMetadataEventArgs $class | [
"Handle",
"LoadClassMetadataEvents",
"to",
"inject",
"adoptees",
"."
] | 01dcb48d7224c7003fa0acbac5c2ddd54d860fd4 | https://github.com/benkle-libs/doctrine-adoption/blob/01dcb48d7224c7003fa0acbac5c2ddd54d860fd4/src/MetadataListener.php#L46-L53 |
11,869 | axypro/callbacks | Helper.php | Helper.toNative | public static function toNative($callback)
{
if (!is_array($callback)) {
return self::getNative($callback);
}
if (!array_key_exists('0', $callback)) {
return self::getFromDict($callback);
}
if (!array_key_exists(2, $callback)) {
return self... | php | public static function toNative($callback)
{
if (!is_array($callback)) {
return self::getNative($callback);
}
if (!array_key_exists('0', $callback)) {
return self::getFromDict($callback);
}
if (!array_key_exists(2, $callback)) {
return self... | [
"public",
"static",
"function",
"toNative",
"(",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"callback",
")",
")",
"{",
"return",
"self",
"::",
"getNative",
"(",
"$",
"callback",
")",
";",
"}",
"if",
"(",
"!",
"array_key_exists",
... | Separates a native callback and bound arguments
@param mixed $callback
a callback in the extended format
@return array
[native => ..., args => array]
@throws \axy\callbacks\errors\InvalidFormat
the callback has invalid format | [
"Separates",
"a",
"native",
"callback",
"and",
"bound",
"arguments"
] | 210981a2a864aff696ef4e34ba856dc229c4ec8f | https://github.com/axypro/callbacks/blob/210981a2a864aff696ef4e34ba856dc229c4ec8f/Helper.php#L26-L38 |
11,870 | axypro/callbacks | Helper.php | Helper.bindInstance | public static function bindInstance($instance, $methodName, $args = null)
{
$helper = new self();
return $helper->createClosure($methodName, $args)->bindTo($instance, get_class($instance));
} | php | public static function bindInstance($instance, $methodName, $args = null)
{
$helper = new self();
return $helper->createClosure($methodName, $args)->bindTo($instance, get_class($instance));
} | [
"public",
"static",
"function",
"bindInstance",
"(",
"$",
"instance",
",",
"$",
"methodName",
",",
"$",
"args",
"=",
"null",
")",
"{",
"$",
"helper",
"=",
"new",
"self",
"(",
")",
";",
"return",
"$",
"helper",
"->",
"createClosure",
"(",
"$",
"methodNa... | Binds an instance with its method
@param object $instance
@param string $methodName
@param array $args [optional]
@return \Closure | [
"Binds",
"an",
"instance",
"with",
"its",
"method"
] | 210981a2a864aff696ef4e34ba856dc229c4ec8f | https://github.com/axypro/callbacks/blob/210981a2a864aff696ef4e34ba856dc229c4ec8f/Helper.php#L48-L52 |
11,871 | axypro/callbacks | Helper.php | Helper.bindStatic | public static function bindStatic($className, $methodName, $args = null)
{
if (empty($args)) {
$args = null;
}
$native = [$className, $methodName];
$callback = function () use ($native, $args) {
$a = func_get_args();
if ($args !== null) {
... | php | public static function bindStatic($className, $methodName, $args = null)
{
if (empty($args)) {
$args = null;
}
$native = [$className, $methodName];
$callback = function () use ($native, $args) {
$a = func_get_args();
if ($args !== null) {
... | [
"public",
"static",
"function",
"bindStatic",
"(",
"$",
"className",
",",
"$",
"methodName",
",",
"$",
"args",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"args",
")",
")",
"{",
"$",
"args",
"=",
"null",
";",
"}",
"$",
"native",
"=",
"["... | Binds a class with its static method
@param string $className
@param string $methodName
@param array $args [optional]
@return \Closure | [
"Binds",
"a",
"class",
"with",
"its",
"static",
"method"
] | 210981a2a864aff696ef4e34ba856dc229c4ec8f | https://github.com/axypro/callbacks/blob/210981a2a864aff696ef4e34ba856dc229c4ec8f/Helper.php#L62-L76 |
11,872 | common-libs/user | src/user.php | user.find | public static function find($usernameOrId, string $password = "") {
self::check();
if (is_numeric($usernameOrId)) {
$bean = R::load('user', $usernameOrId);
}
else {
$userdbname = setup::getValidation("username");
if ($password != "") {
$pwdbname = setup::getValidation("password");
$bean = R... | php | public static function find($usernameOrId, string $password = "") {
self::check();
if (is_numeric($usernameOrId)) {
$bean = R::load('user', $usernameOrId);
}
else {
$userdbname = setup::getValidation("username");
if ($password != "") {
$pwdbname = setup::getValidation("password");
$bean = R... | [
"public",
"static",
"function",
"find",
"(",
"$",
"usernameOrId",
",",
"string",
"$",
"password",
"=",
"\"\"",
")",
"{",
"self",
"::",
"check",
"(",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"usernameOrId",
")",
")",
"{",
"$",
"bean",
"=",
"R",
... | find a user
@param string|int $usernameOrId
@param string $password
@return bool|\common\user\user | [
"find",
"a",
"user"
] | 820fce6748a59e8d692bf613b4694f903d9db6c1 | https://github.com/common-libs/user/blob/820fce6748a59e8d692bf613b4694f903d9db6c1/src/user.php#L89-L112 |
11,873 | common-libs/user | src/user.php | user.guest | public static function guest(): user {
self::check();
$userdbname = setup::getValidation("username");
return new self("", R::findOne('user', ' ' . $userdbname . ' = ? ', ["guest"]));
} | php | public static function guest(): user {
self::check();
$userdbname = setup::getValidation("username");
return new self("", R::findOne('user', ' ' . $userdbname . ' = ? ', ["guest"]));
} | [
"public",
"static",
"function",
"guest",
"(",
")",
":",
"user",
"{",
"self",
"::",
"check",
"(",
")",
";",
"$",
"userdbname",
"=",
"setup",
"::",
"getValidation",
"(",
"\"username\"",
")",
";",
"return",
"new",
"self",
"(",
"\"\"",
",",
"R",
"::",
"f... | return a guest user
@return \common\user\user | [
"return",
"a",
"guest",
"user"
] | 820fce6748a59e8d692bf613b4694f903d9db6c1 | https://github.com/common-libs/user/blob/820fce6748a59e8d692bf613b4694f903d9db6c1/src/user.php#L119-L124 |
11,874 | common-libs/user | src/user.php | user.setRole | public function setRole(string $role) {
$this->user->role = role::get($role);
R::store($this->user);
} | php | public function setRole(string $role) {
$this->user->role = role::get($role);
R::store($this->user);
} | [
"public",
"function",
"setRole",
"(",
"string",
"$",
"role",
")",
"{",
"$",
"this",
"->",
"user",
"->",
"role",
"=",
"role",
"::",
"get",
"(",
"$",
"role",
")",
";",
"R",
"::",
"store",
"(",
"$",
"this",
"->",
"user",
")",
";",
"}"
] | set role of user
@param string $role rolename | [
"set",
"role",
"of",
"user"
] | 820fce6748a59e8d692bf613b4694f903d9db6c1 | https://github.com/common-libs/user/blob/820fce6748a59e8d692bf613b4694f903d9db6c1/src/user.php#L140-L143 |
11,875 | quantaphp/class-names | src/BlacklistedClassNameCollection.php | BlacklistedClassNameCollection.filter | private function filter(string $class): bool
{
foreach ($this->patterns as $pattern) {
if (preg_match($pattern, $class) === 1) {
return false;
}
}
return true;
} | php | private function filter(string $class): bool
{
foreach ($this->patterns as $pattern) {
if (preg_match($pattern, $class) === 1) {
return false;
}
}
return true;
} | [
"private",
"function",
"filter",
"(",
"string",
"$",
"class",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"patterns",
"as",
"$",
"pattern",
")",
"{",
"if",
"(",
"preg_match",
"(",
"$",
"pattern",
",",
"$",
"class",
")",
"===",
"1",
")... | Return whether the given class name is not matching any pattern.
@param string $class
@return bool | [
"Return",
"whether",
"the",
"given",
"class",
"name",
"is",
"not",
"matching",
"any",
"pattern",
"."
] | 2c0aea13ff82aa70df0fe6f78247415d15a994d1 | https://github.com/quantaphp/class-names/blob/2c0aea13ff82aa70df0fe6f78247415d15a994d1/src/BlacklistedClassNameCollection.php#L50-L59 |
11,876 | dlabas/DlcBase | src/DlcBase/Code/Reflection/Closure.php | Closure.getSourceCode | public function getSourceCode($initialIdent = 4)
{
$file = explode(PHP_EOL, file_get_contents($this->getFileName()));
$funcOpenLine = $file[$this->getStartLine()-1];
$funcOpenLine = rtrim(substr($funcOpenLine, strpos($funcOpenLine, 'function')));
$funcCloseLine = $file[$this->get... | php | public function getSourceCode($initialIdent = 4)
{
$file = explode(PHP_EOL, file_get_contents($this->getFileName()));
$funcOpenLine = $file[$this->getStartLine()-1];
$funcOpenLine = rtrim(substr($funcOpenLine, strpos($funcOpenLine, 'function')));
$funcCloseLine = $file[$this->get... | [
"public",
"function",
"getSourceCode",
"(",
"$",
"initialIdent",
"=",
"4",
")",
"{",
"$",
"file",
"=",
"explode",
"(",
"PHP_EOL",
",",
"file_get_contents",
"(",
"$",
"this",
"->",
"getFileName",
"(",
")",
")",
")",
";",
"$",
"funcOpenLine",
"=",
"$",
"... | Get source code of closure
@return string | [
"Get",
"source",
"code",
"of",
"closure"
] | 0f6b1056a670c68fffa0055901e209cc45621599 | https://github.com/dlabas/DlcBase/blob/0f6b1056a670c68fffa0055901e209cc45621599/src/DlcBase/Code/Reflection/Closure.php#L16-L31 |
11,877 | dlabas/DlcBase | src/DlcBase/Code/Reflection/Closure.php | Closure.getContents | public function getContents($initialIdent = 4, $trimFirstAndLastLineBreak = true)
{
$file = explode(PHP_EOL, file_get_contents($this->getFileName()));
$startLine = $this->getStartLine();
$endLine = $this->getEndLine()-1;
$contents = PHP_EOL;
$subStrStart = false;
... | php | public function getContents($initialIdent = 4, $trimFirstAndLastLineBreak = true)
{
$file = explode(PHP_EOL, file_get_contents($this->getFileName()));
$startLine = $this->getStartLine();
$endLine = $this->getEndLine()-1;
$contents = PHP_EOL;
$subStrStart = false;
... | [
"public",
"function",
"getContents",
"(",
"$",
"initialIdent",
"=",
"4",
",",
"$",
"trimFirstAndLastLineBreak",
"=",
"true",
")",
"{",
"$",
"file",
"=",
"explode",
"(",
"PHP_EOL",
",",
"file_get_contents",
"(",
"$",
"this",
"->",
"getFileName",
"(",
")",
"... | Get contents of closure
@return string | [
"Get",
"contents",
"of",
"closure"
] | 0f6b1056a670c68fffa0055901e209cc45621599 | https://github.com/dlabas/DlcBase/blob/0f6b1056a670c68fffa0055901e209cc45621599/src/DlcBase/Code/Reflection/Closure.php#L38-L64 |
11,878 | vinala/kernel | src/Atomium/Compiler/AtomiumCompileComments.php | AtomiumCompileComments.hide | public static function hide($script, $openTag, $closeTag)
{
$data = Strings::splite($script, $openTag);
//
$output = $data[0];
//
for ($i = 1; $i < Collection::count($data); $i++) {
$output .= '';
//
$next = Strings::splite($data[$i], $clos... | php | public static function hide($script, $openTag, $closeTag)
{
$data = Strings::splite($script, $openTag);
//
$output = $data[0];
//
for ($i = 1; $i < Collection::count($data); $i++) {
$output .= '';
//
$next = Strings::splite($data[$i], $clos... | [
"public",
"static",
"function",
"hide",
"(",
"$",
"script",
",",
"$",
"openTag",
",",
"$",
"closeTag",
")",
"{",
"$",
"data",
"=",
"Strings",
"::",
"splite",
"(",
"$",
"script",
",",
"$",
"openTag",
")",
";",
"//",
"$",
"output",
"=",
"$",
"data",
... | To hide de comment that user write.
@return string | [
"To",
"hide",
"de",
"comment",
"that",
"user",
"write",
"."
] | 346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a | https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Atomium/Compiler/AtomiumCompileComments.php#L34-L56 |
11,879 | uuur86/ubdb | src/ubdb.php | ubdb.search_term | private function search_term($table, $colname, $term){
$searchio = $this->readdb( $table, $colname );
$returnrows = array();
foreach( $searchio as $drowname=>$drowval ){
if( empty($term) || count($term)<1 ){continue;}
$termcounter = $this->matches($drowval, $term);
... | php | private function search_term($table, $colname, $term){
$searchio = $this->readdb( $table, $colname );
$returnrows = array();
foreach( $searchio as $drowname=>$drowval ){
if( empty($term) || count($term)<1 ){continue;}
$termcounter = $this->matches($drowval, $term);
... | [
"private",
"function",
"search_term",
"(",
"$",
"table",
",",
"$",
"colname",
",",
"$",
"term",
")",
"{",
"$",
"searchio",
"=",
"$",
"this",
"->",
"readdb",
"(",
"$",
"table",
",",
"$",
"colname",
")",
";",
"$",
"returnrows",
"=",
"array",
"(",
")"... | Will be return as array contains row key => how many time matched | [
"Will",
"be",
"return",
"as",
"array",
"contains",
"row",
"key",
"=",
">",
"how",
"many",
"time",
"matched"
] | 4f8fd8c331422455240a882d11be812c24f3a36d | https://github.com/uuur86/ubdb/blob/4f8fd8c331422455240a882d11be812c24f3a36d/src/ubdb.php#L220-L237 |
11,880 | uuur86/ubdb | src/ubdb.php | ubdb.add | public function add($table, $rowArr){
$editId = $this->rows($table);
if($this->edit_id != null){
$editId = $this->edit_id;
}
foreach($this->cols[$table] as $colname){
$this->rows[$table][$colname][$editId] = $rowArr[$colname];
}
return $editId;
} | php | public function add($table, $rowArr){
$editId = $this->rows($table);
if($this->edit_id != null){
$editId = $this->edit_id;
}
foreach($this->cols[$table] as $colname){
$this->rows[$table][$colname][$editId] = $rowArr[$colname];
}
return $editId;
} | [
"public",
"function",
"add",
"(",
"$",
"table",
",",
"$",
"rowArr",
")",
"{",
"$",
"editId",
"=",
"$",
"this",
"->",
"rows",
"(",
"$",
"table",
")",
";",
"if",
"(",
"$",
"this",
"->",
"edit_id",
"!=",
"null",
")",
"{",
"$",
"editId",
"=",
"$",
... | Add new row | [
"Add",
"new",
"row"
] | 4f8fd8c331422455240a882d11be812c24f3a36d | https://github.com/uuur86/ubdb/blob/4f8fd8c331422455240a882d11be812c24f3a36d/src/ubdb.php#L251-L263 |
11,881 | uuur86/ubdb | src/ubdb.php | ubdb.edit | public function edit($table, $rowArr, $id){
$this->edit_id = $id;
$this->add($table, $rowArr);
} | php | public function edit($table, $rowArr, $id){
$this->edit_id = $id;
$this->add($table, $rowArr);
} | [
"public",
"function",
"edit",
"(",
"$",
"table",
",",
"$",
"rowArr",
",",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"edit_id",
"=",
"$",
"id",
";",
"$",
"this",
"->",
"add",
"(",
"$",
"table",
",",
"$",
"rowArr",
")",
";",
"}"
] | Edit to exists row | [
"Edit",
"to",
"exists",
"row"
] | 4f8fd8c331422455240a882d11be812c24f3a36d | https://github.com/uuur86/ubdb/blob/4f8fd8c331422455240a882d11be812c24f3a36d/src/ubdb.php#L267-L270 |
11,882 | uuur86/ubdb | src/ubdb.php | ubdb.save | public function save(){
foreach ($this->cols as $table => $prkey){
foreach($prkey as $prkey_){
if(strlen($prkey_)<3){continue;}
$this->writedb($table, $prkey_);
}
//more table records
$this->rows[$table]['index'] = $this->indexData[$table];... | php | public function save(){
foreach ($this->cols as $table => $prkey){
foreach($prkey as $prkey_){
if(strlen($prkey_)<3){continue;}
$this->writedb($table, $prkey_);
}
//more table records
$this->rows[$table]['index'] = $this->indexData[$table];... | [
"public",
"function",
"save",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"cols",
"as",
"$",
"table",
"=>",
"$",
"prkey",
")",
"{",
"foreach",
"(",
"$",
"prkey",
"as",
"$",
"prkey_",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"prkey_",
")",
... | running one more time. | [
"running",
"one",
"more",
"time",
"."
] | 4f8fd8c331422455240a882d11be812c24f3a36d | https://github.com/uuur86/ubdb/blob/4f8fd8c331422455240a882d11be812c24f3a36d/src/ubdb.php#L279-L301 |
11,883 | uuur86/ubdb | src/ubdb.php | ubdb.check | public function check($table, $colname, $val){
$oldvals = $this->readdb($table, $colname);
if($oldvals && is_array($oldvals)){
$oldvals = array_flip($oldvals);
}
if(isset($oldvals[$val])){
return true;
}
return false;
} | php | public function check($table, $colname, $val){
$oldvals = $this->readdb($table, $colname);
if($oldvals && is_array($oldvals)){
$oldvals = array_flip($oldvals);
}
if(isset($oldvals[$val])){
return true;
}
return false;
} | [
"public",
"function",
"check",
"(",
"$",
"table",
",",
"$",
"colname",
",",
"$",
"val",
")",
"{",
"$",
"oldvals",
"=",
"$",
"this",
"->",
"readdb",
"(",
"$",
"table",
",",
"$",
"colname",
")",
";",
"if",
"(",
"$",
"oldvals",
"&&",
"is_array",
"("... | Return as boolean | [
"Return",
"as",
"boolean"
] | 4f8fd8c331422455240a882d11be812c24f3a36d | https://github.com/uuur86/ubdb/blob/4f8fd8c331422455240a882d11be812c24f3a36d/src/ubdb.php#L328-L340 |
11,884 | gintonicweb/users | src/Controller/Api/UsersController.php | UsersController.index | public function index()
{
$this->Crud->on('beforePaginate', function (Event $event) {
$query = $this->Users->find('search', $this->request->query);
$query = $query->select(['id', 'username']);
$event->subject->query = $query;
});
$this->Crud->execute();
... | php | public function index()
{
$this->Crud->on('beforePaginate', function (Event $event) {
$query = $this->Users->find('search', $this->request->query);
$query = $query->select(['id', 'username']);
$event->subject->query = $query;
});
$this->Crud->execute();
... | [
"public",
"function",
"index",
"(",
")",
"{",
"$",
"this",
"->",
"Crud",
"->",
"on",
"(",
"'beforePaginate'",
",",
"function",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"Users",
"->",
"find",
"(",
"'search'",
",",
... | Currently used as a search function uses 'username' as the param
e.g. http://example.com/api/users.json?usernam=phil
@return void | [
"Currently",
"used",
"as",
"a",
"search",
"function",
"uses",
"username",
"as",
"the",
"param"
] | 822b5f640969020ff8165d8d376680ef33d1f9ac | https://github.com/gintonicweb/users/blob/822b5f640969020ff8165d8d376680ef33d1f9ac/src/Controller/Api/UsersController.php#L46-L54 |
11,885 | gintonicweb/users | src/Controller/Api/UsersController.php | UsersController.add | public function add()
{
$this->Crud->on('afterSave', function (Event $event) {
if ($event->subject->created) {
$token = [
'id' => $event->subject->entity->id,
'exp' => time() + 60 * 60 * 24 * 7,
];
$this->set... | php | public function add()
{
$this->Crud->on('afterSave', function (Event $event) {
if ($event->subject->created) {
$token = [
'id' => $event->subject->entity->id,
'exp' => time() + 60 * 60 * 24 * 7,
];
$this->set... | [
"public",
"function",
"add",
"(",
")",
"{",
"$",
"this",
"->",
"Crud",
"->",
"on",
"(",
"'afterSave'",
",",
"function",
"(",
"Event",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"event",
"->",
"subject",
"->",
"created",
")",
"{",
"$",
"token",
"=",
... | Regular register method now also returns a token upon registration
token expiration is set for 1 week
@return \Cake\Network\Response | [
"Regular",
"register",
"method",
"now",
"also",
"returns",
"a",
"token",
"upon",
"registration",
"token",
"expiration",
"is",
"set",
"for",
"1",
"week"
] | 822b5f640969020ff8165d8d376680ef33d1f9ac | https://github.com/gintonicweb/users/blob/822b5f640969020ff8165d8d376680ef33d1f9ac/src/Controller/Api/UsersController.php#L62-L80 |
11,886 | gintonicweb/users | src/Controller/Api/UsersController.php | UsersController.token | public function token()
{
$user = $this->Auth->identify();
if (!$user) {
throw new UnauthorizedException('Invalid username or password');
}
$token = [
'id' => $user['id'],
'exp' => time() + 60 * 60 * 24 * 7
];
$this->set([
... | php | public function token()
{
$user = $this->Auth->identify();
if (!$user) {
throw new UnauthorizedException('Invalid username or password');
}
$token = [
'id' => $user['id'],
'exp' => time() + 60 * 60 * 24 * 7
];
$this->set([
... | [
"public",
"function",
"token",
"(",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"Auth",
"->",
"identify",
"(",
")",
";",
"if",
"(",
"!",
"$",
"user",
")",
"{",
"throw",
"new",
"UnauthorizedException",
"(",
"'Invalid username or password'",
")",
";",
... | Tries to authentify user based on POST data and returns a private token
@return void | [
"Tries",
"to",
"authentify",
"user",
"based",
"on",
"POST",
"data",
"and",
"returns",
"a",
"private",
"token"
] | 822b5f640969020ff8165d8d376680ef33d1f9ac | https://github.com/gintonicweb/users/blob/822b5f640969020ff8165d8d376680ef33d1f9ac/src/Controller/Api/UsersController.php#L87-L104 |
11,887 | mlebkowski/kunstmaan-static-site-bundle | src/Service/Response/StaticFiles/MimeTypeGuesser.php | MimeTypeGuesser.guess | public function guess($path)
{
$ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
if (isset($this->extensions[$ext])) {
return $this->extensions[$ext];
}
return $this->parent->guess($path);
} | php | public function guess($path)
{
$ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
if (isset($this->extensions[$ext])) {
return $this->extensions[$ext];
}
return $this->parent->guess($path);
} | [
"public",
"function",
"guess",
"(",
"$",
"path",
")",
"{",
"$",
"ext",
"=",
"strtolower",
"(",
"pathinfo",
"(",
"$",
"path",
",",
"PATHINFO_EXTENSION",
")",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"extensions",
"[",
"$",
"ext",
"]",
"... | Guesses the mime type of the file with the given path.
@param string $path The path to the file
@return string The mime type or NULL, if none could be guessed
@throws FileNotFoundException If the file does not exist
@throws AccessDeniedException If the file could not be read | [
"Guesses",
"the",
"mime",
"type",
"of",
"the",
"file",
"with",
"the",
"given",
"path",
"."
] | 86d3b0146ef8c065379d0136864094c5f109396e | https://github.com/mlebkowski/kunstmaan-static-site-bundle/blob/86d3b0146ef8c065379d0136864094c5f109396e/src/Service/Response/StaticFiles/MimeTypeGuesser.php#L38-L47 |
11,888 | lhs168/fasim | src/Fasim/Cache/simulate/Memcached.php | Memcached.addServer | public function addServer($host, $port = 11211, $weight = 0)
{
$key = $this->getServerKey($host, $port, $weight);
if (isset($this->server[$key])) {
// Dup
$this->resultCode = Memcached::RES_FAILURE;
$this->resultMessage = 'Server duplicate.';
return fa... | php | public function addServer($host, $port = 11211, $weight = 0)
{
$key = $this->getServerKey($host, $port, $weight);
if (isset($this->server[$key])) {
// Dup
$this->resultCode = Memcached::RES_FAILURE;
$this->resultMessage = 'Server duplicate.';
return fa... | [
"public",
"function",
"addServer",
"(",
"$",
"host",
",",
"$",
"port",
"=",
"11211",
",",
"$",
"weight",
"=",
"0",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getServerKey",
"(",
"$",
"host",
",",
"$",
"port",
",",
"$",
"weight",
")",
";",
"... | Add a serer to the server pool
@param string $host
@param int $port
@param int $weight
@return boolean | [
"Add",
"a",
"serer",
"to",
"the",
"server",
"pool"
] | df31e249593380421785f0be342cfb92cbb1d1d7 | https://github.com/lhs168/fasim/blob/df31e249593380421785f0be342cfb92cbb1d1d7/src/Fasim/Cache/simulate/Memcached.php#L184-L203 |
11,889 | lhs168/fasim | src/Fasim/Cache/simulate/Memcached.php | Memcached.addServers | public function addServers($servers)
{
foreach ((array)$servers as $svr) {
$host = array_shift($svr);
$port = array_shift($svr);
if (is_null($port)) {
$port = 11211;
}
$weight = array_shift($svr);
if (is_null($weight))... | php | public function addServers($servers)
{
foreach ((array)$servers as $svr) {
$host = array_shift($svr);
$port = array_shift($svr);
if (is_null($port)) {
$port = 11211;
}
$weight = array_shift($svr);
if (is_null($weight))... | [
"public",
"function",
"addServers",
"(",
"$",
"servers",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"servers",
"as",
"$",
"svr",
")",
"{",
"$",
"host",
"=",
"array_shift",
"(",
"$",
"svr",
")",
";",
"$",
"port",
"=",
"array_shift",
"(",
"$",... | Add multiple servers to the server pool
@param array $servers
@return boolean | [
"Add",
"multiple",
"servers",
"to",
"the",
"server",
"pool"
] | df31e249593380421785f0be342cfb92cbb1d1d7 | https://github.com/lhs168/fasim/blob/df31e249593380421785f0be342cfb92cbb1d1d7/src/Fasim/Cache/simulate/Memcached.php#L212-L231 |
11,890 | lhs168/fasim | src/Fasim/Cache/simulate/Memcached.php | Memcached.connect | protected function connect()
{
$rs = false;
foreach ((array)$this->server as $svr) {
$error = 0;
$errstr = '';
$rs = @fsockopen($svr['host'], $svr['port'], $error, $errstr);
if ($rs) {
$this->socket = $rs;
} else {
... | php | protected function connect()
{
$rs = false;
foreach ((array)$this->server as $svr) {
$error = 0;
$errstr = '';
$rs = @fsockopen($svr['host'], $svr['port'], $error, $errstr);
if ($rs) {
$this->socket = $rs;
} else {
... | [
"protected",
"function",
"connect",
"(",
")",
"{",
"$",
"rs",
"=",
"false",
";",
"foreach",
"(",
"(",
"array",
")",
"$",
"this",
"->",
"server",
"as",
"$",
"svr",
")",
"{",
"$",
"error",
"=",
"0",
";",
"$",
"errstr",
"=",
"''",
";",
"$",
"rs",
... | Connect to memcached server
@return boolean | [
"Connect",
"to",
"memcached",
"server"
] | df31e249593380421785f0be342cfb92cbb1d1d7 | https://github.com/lhs168/fasim/blob/df31e249593380421785f0be342cfb92cbb1d1d7/src/Fasim/Cache/simulate/Memcached.php#L239-L273 |
11,891 | lhs168/fasim | src/Fasim/Cache/simulate/Memcached.php | Memcached.get | public function get($key, $cache_cb = null, $cas_token = null)
{
$keyString = $this->getKey($key);
$this->writeSocket("get $keyString");
$s = $this->readSocket();
if (is_null($s) || 'VALUE' != substr($s, 0, 5)) {
$this->resultCode = Memcached::RES_FAILURE;
$... | php | public function get($key, $cache_cb = null, $cas_token = null)
{
$keyString = $this->getKey($key);
$this->writeSocket("get $keyString");
$s = $this->readSocket();
if (is_null($s) || 'VALUE' != substr($s, 0, 5)) {
$this->resultCode = Memcached::RES_FAILURE;
$... | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"cache_cb",
"=",
"null",
",",
"$",
"cas_token",
"=",
"null",
")",
"{",
"$",
"keyString",
"=",
"$",
"this",
"->",
"getKey",
"(",
"$",
"key",
")",
";",
"$",
"this",
"->",
"writeSocket",
"(",
"... | Retrieve an item
@param string $key
@param callable $cache_cb Ignored
@param float $cas_token Ignored
@return mixed | [
"Retrieve",
"an",
"item"
] | df31e249593380421785f0be342cfb92cbb1d1d7 | https://github.com/lhs168/fasim/blob/df31e249593380421785f0be342cfb92cbb1d1d7/src/Fasim/Cache/simulate/Memcached.php#L310-L334 |
11,892 | lhs168/fasim | src/Fasim/Cache/simulate/Memcached.php | Memcached.getOption | public function getOption($option)
{
if (isset($this->option[$option])) {
$this->resultCode = Memcached::RES_SUCCESS;
$this->resultMessage = '';
return $this->option[$option];
} else {
$this->resultCode = Memcached::RES_FAILURE;
$this->res... | php | public function getOption($option)
{
if (isset($this->option[$option])) {
$this->resultCode = Memcached::RES_SUCCESS;
$this->resultMessage = '';
return $this->option[$option];
} else {
$this->resultCode = Memcached::RES_FAILURE;
$this->res... | [
"public",
"function",
"getOption",
"(",
"$",
"option",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"option",
"[",
"$",
"option",
"]",
")",
")",
"{",
"$",
"this",
"->",
"resultCode",
"=",
"Memcached",
"::",
"RES_SUCCESS",
";",
"$",
"this",
... | Get a memcached option value
@param int $option
@return mixed | [
"Get",
"a",
"memcached",
"option",
"value"
] | df31e249593380421785f0be342cfb92cbb1d1d7 | https://github.com/lhs168/fasim/blob/df31e249593380421785f0be342cfb92cbb1d1d7/src/Fasim/Cache/simulate/Memcached.php#L355-L367 |
11,893 | lhs168/fasim | src/Fasim/Cache/simulate/Memcached.php | Memcached.set | public function set($key, $val, $expt = 0)
{
$valueString = serialize($val);
$keyString = $this->getKey($key);
$this->writeSocket(
"set $keyString 0 $expt " . strlen($valueString)
);
$s = $this->writeSocket($valueString, true);
if ('STORED' == $s) {
... | php | public function set($key, $val, $expt = 0)
{
$valueString = serialize($val);
$keyString = $this->getKey($key);
$this->writeSocket(
"set $keyString 0 $expt " . strlen($valueString)
);
$s = $this->writeSocket($valueString, true);
if ('STORED' == $s) {
... | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"val",
",",
"$",
"expt",
"=",
"0",
")",
"{",
"$",
"valueString",
"=",
"serialize",
"(",
"$",
"val",
")",
";",
"$",
"keyString",
"=",
"$",
"this",
"->",
"getKey",
"(",
"$",
"key",
")",
";",... | Store an item
@param string $key
@param mixed $val
@param int $expt
@return boolean | [
"Store",
"an",
"item"
] | df31e249593380421785f0be342cfb92cbb1d1d7 | https://github.com/lhs168/fasim/blob/df31e249593380421785f0be342cfb92cbb1d1d7/src/Fasim/Cache/simulate/Memcached.php#L443-L463 |
11,894 | lhs168/fasim | src/Fasim/Cache/simulate/Memcached.php | Memcached.increment | public function increment($key, $offset = 1, $initial_value = 0, $expiry = 0)
{
if (($prevVal = $this->get($key))) {
if (!is_numeric($prevVal)) {
return false;
}
$newVal = $prevVal + $offset;
} else {
$newVal = $initial_value;
... | php | public function increment($key, $offset = 1, $initial_value = 0, $expiry = 0)
{
if (($prevVal = $this->get($key))) {
if (!is_numeric($prevVal)) {
return false;
}
$newVal = $prevVal + $offset;
} else {
$newVal = $initial_value;
... | [
"public",
"function",
"increment",
"(",
"$",
"key",
",",
"$",
"offset",
"=",
"1",
",",
"$",
"initial_value",
"=",
"0",
",",
"$",
"expiry",
"=",
"0",
")",
"{",
"if",
"(",
"(",
"$",
"prevVal",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"key",
")",
... | Increment numeric item's value
@param string $key The key of the item to increment.
@param int $offset The amount by which to increment the item's value.
@param int $initial_value The value to set the item to if it doesn't currently exist.
@param int $expiry The expiry time to set on t... | [
"Increment",
"numeric",
"item",
"s",
"value"
] | df31e249593380421785f0be342cfb92cbb1d1d7 | https://github.com/lhs168/fasim/blob/df31e249593380421785f0be342cfb92cbb1d1d7/src/Fasim/Cache/simulate/Memcached.php#L502-L517 |
11,895 | canis-io/yii2-canis-lib | lib/console/controllers/PhpDocController.php | PhpDocController.actionFix | public function actionFix($root = null)
{
$files = $this->findFiles($root);
$nFilesTotal = 0;
$nFilesUpdated = 0;
foreach ($files as $file) {
$contents = file_get_contents($file);
$sha = sha1($contents);
// fix line endings
$lines = p... | php | public function actionFix($root = null)
{
$files = $this->findFiles($root);
$nFilesTotal = 0;
$nFilesUpdated = 0;
foreach ($files as $file) {
$contents = file_get_contents($file);
$sha = sha1($contents);
// fix line endings
$lines = p... | [
"public",
"function",
"actionFix",
"(",
"$",
"root",
"=",
"null",
")",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"findFiles",
"(",
"$",
"root",
")",
";",
"$",
"nFilesTotal",
"=",
"0",
";",
"$",
"nFilesUpdated",
"=",
"0",
";",
"foreach",
"(",
"$",
... | Fix some issues with PHPdoc in files.
@param string $root the directory to parse files from. Defaults to YII_PATH. | [
"Fix",
"some",
"issues",
"with",
"PHPdoc",
"in",
"files",
"."
] | 97d533521f65b084dc805c5f312c364b469142d2 | https://github.com/canis-io/yii2-canis-lib/blob/97d533521f65b084dc805c5f312c364b469142d2/lib/console/controllers/PhpDocController.php#L93-L118 |
11,896 | emmanix2002/dorcas-sdk-php | src/SendsHttpRequestTrait.php | SendsHttpRequestTrait.prefillHeader | protected function prefillHeader()
{
if ($this->requiresAuthorization() && !empty($this->getAuthorizationHeader())) {
$this->headers['Authorization'] = $this->getAuthorizationHeader();
}
return $this;
} | php | protected function prefillHeader()
{
if ($this->requiresAuthorization() && !empty($this->getAuthorizationHeader())) {
$this->headers['Authorization'] = $this->getAuthorizationHeader();
}
return $this;
} | [
"protected",
"function",
"prefillHeader",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"requiresAuthorization",
"(",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"getAuthorizationHeader",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"headers",
"[",
... | Pre-fills the request header with some default values as required.
@return $this | [
"Pre",
"-",
"fills",
"the",
"request",
"header",
"with",
"some",
"default",
"values",
"as",
"required",
"."
] | 1b68df62da1ed5f993f9e2687633402b96ab7f64 | https://github.com/emmanix2002/dorcas-sdk-php/blob/1b68df62da1ed5f993f9e2687633402b96ab7f64/src/SendsHttpRequestTrait.php#L67-L73 |
11,897 | emmanix2002/dorcas-sdk-php | src/SendsHttpRequestTrait.php | SendsHttpRequestTrait.addBodyParam | public function addBodyParam(string $name, $value, bool $overwrite = false)
{
$keyExists = array_key_exists($name, $this->body);
# check if the key already exists
if ($keyExists && !$overwrite) {
return $this;
}
if (is_null($value)) {
if ($keyExists) {... | php | public function addBodyParam(string $name, $value, bool $overwrite = false)
{
$keyExists = array_key_exists($name, $this->body);
# check if the key already exists
if ($keyExists && !$overwrite) {
return $this;
}
if (is_null($value)) {
if ($keyExists) {... | [
"public",
"function",
"addBodyParam",
"(",
"string",
"$",
"name",
",",
"$",
"value",
",",
"bool",
"$",
"overwrite",
"=",
"false",
")",
"{",
"$",
"keyExists",
"=",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"body",
")",
";",
"# check ... | Adds a parameter to the body of the request.
@param string $name
@param $value
@param bool $overwrite
@return $this | [
"Adds",
"a",
"parameter",
"to",
"the",
"body",
"of",
"the",
"request",
"."
] | 1b68df62da1ed5f993f9e2687633402b96ab7f64 | https://github.com/emmanix2002/dorcas-sdk-php/blob/1b68df62da1ed5f993f9e2687633402b96ab7f64/src/SendsHttpRequestTrait.php#L96-L115 |
11,898 | emmanix2002/dorcas-sdk-php | src/SendsHttpRequestTrait.php | SendsHttpRequestTrait.addMultipartParam | public function addMultipartParam(string $name, $content, string $filename = null, bool $overwrite = false)
{
if (array_key_exists($name, $this->multipart) && !$overwrite) {
return $this;
}
$part = ['name' => $name, 'contents' => $content];
if (!empty($filename)) {
... | php | public function addMultipartParam(string $name, $content, string $filename = null, bool $overwrite = false)
{
if (array_key_exists($name, $this->multipart) && !$overwrite) {
return $this;
}
$part = ['name' => $name, 'contents' => $content];
if (!empty($filename)) {
... | [
"public",
"function",
"addMultipartParam",
"(",
"string",
"$",
"name",
",",
"$",
"content",
",",
"string",
"$",
"filename",
"=",
"null",
",",
"bool",
"$",
"overwrite",
"=",
"false",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"... | Adds some multipart data to the request body.
@param string $name
@param string|resource $content the string content for the key; or resource gotten from fopen()
@param string|null $filename
@param bool $overwrite
@return $this | [
"Adds",
"some",
"multipart",
"data",
"to",
"the",
"request",
"body",
"."
] | 1b68df62da1ed5f993f9e2687633402b96ab7f64 | https://github.com/emmanix2002/dorcas-sdk-php/blob/1b68df62da1ed5f993f9e2687633402b96ab7f64/src/SendsHttpRequestTrait.php#L127-L138 |
11,899 | emmanix2002/dorcas-sdk-php | src/SendsHttpRequestTrait.php | SendsHttpRequestTrait.send | public function send(string $method, Client $httpClient, array $path = []): DorcasResponse
{
$this->prefillHeader();
$this->prefillBody();
if (strtolower($method) !== 'get') {
# we don't validate GEt requests
$this->validate();
}
$uri = static::getRequ... | php | public function send(string $method, Client $httpClient, array $path = []): DorcasResponse
{
$this->prefillHeader();
$this->prefillBody();
if (strtolower($method) !== 'get') {
# we don't validate GEt requests
$this->validate();
}
$uri = static::getRequ... | [
"public",
"function",
"send",
"(",
"string",
"$",
"method",
",",
"Client",
"$",
"httpClient",
",",
"array",
"$",
"path",
"=",
"[",
"]",
")",
":",
"DorcasResponse",
"{",
"$",
"this",
"->",
"prefillHeader",
"(",
")",
";",
"$",
"this",
"->",
"prefillBody"... | Sends a HTTP request.
@param string $method
@param Client $httpClient
@param array $path additional components for the path; e.g.: [$id, 'prices']
@return DorcasResponse
@throws \GuzzleHttp\Exception\GuzzleException | [
"Sends",
"a",
"HTTP",
"request",
"."
] | 1b68df62da1ed5f993f9e2687633402b96ab7f64 | https://github.com/emmanix2002/dorcas-sdk-php/blob/1b68df62da1ed5f993f9e2687633402b96ab7f64/src/SendsHttpRequestTrait.php#L158-L208 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.