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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
17,400 | Kylob/Bootstrap | src/Common.php | Common.panel | public function panel($class, array $sections)
{
$html = '';
foreach ($sections as $panel => $content) {
if (!is_numeric($panel)) {
$panel = substr($panel, 0, 4);
}
switch ((string) $panel) {
case 'head':
$html .... | php | public function panel($class, array $sections)
{
$html = '';
foreach ($sections as $panel => $content) {
if (!is_numeric($panel)) {
$panel = substr($panel, 0, 4);
}
switch ((string) $panel) {
case 'head':
$html .... | [
"public",
"function",
"panel",
"(",
"$",
"class",
",",
"array",
"$",
"sections",
")",
"{",
"$",
"html",
"=",
"''",
";",
"foreach",
"(",
"$",
"sections",
"as",
"$",
"panel",
"=>",
"$",
"content",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"... | Creates a Bootstrap panel component.
@param string $class Either '**default**', '**primary**', '**success**', '**info**', '**warning**', or '**danger**'. The '**panel**' class and prefix are automatically included. You can add more classes to it if you like.
@param array $sections An ``array($panel => $content, ..... | [
"Creates",
"a",
"Bootstrap",
"panel",
"component",
"."
] | 0d7677a90656fbc461eabb5512ab16f9d5f728c6 | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L1000-L1026 |
17,401 | Kylob/Bootstrap | src/Common.php | Common.accordion | public function accordion($class, array $sections, $open = 1)
{
$html = '';
$count = 0;
$id = $this->page->id('accordion');
foreach ($sections as $head => $body) {
++$count;
$heading = $this->page->id('heading');
$collapse = $this->page->id('collap... | php | public function accordion($class, array $sections, $open = 1)
{
$html = '';
$count = 0;
$id = $this->page->id('accordion');
foreach ($sections as $head => $body) {
++$count;
$heading = $this->page->id('heading');
$collapse = $this->page->id('collap... | [
"public",
"function",
"accordion",
"(",
"$",
"class",
",",
"array",
"$",
"sections",
",",
"$",
"open",
"=",
"1",
")",
"{",
"$",
"html",
"=",
"''",
";",
"$",
"count",
"=",
"0",
";",
"$",
"id",
"=",
"$",
"this",
"->",
"page",
"->",
"id",
"(",
"... | Bootstrap accordions are basically collapsible panels. That is essentially what you are creating here.
@param string $class Either '**default**', '**primary**', '**success**', '**info**', '**warning**', or '**danger**'. These only apply to the head section, and are passed directly by us into ``$bp->panel()``.
@para... | [
"Bootstrap",
"accordions",
"are",
"basically",
"collapsible",
"panels",
".",
"That",
"is",
"essentially",
"what",
"you",
"are",
"creating",
"here",
"."
] | 0d7677a90656fbc461eabb5512ab16f9d5f728c6 | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L1139-L1177 |
17,402 | Kylob/Bootstrap | src/Common.php | Common.carousel | public function carousel(array $images, array $options = array())
{
$html = '';
$id = $this->page->id('carousel');
$options = array_merge(array(
'interval' => 5000, // ie. 5 seconds in between frame changes
'indicators' => true, // set to false if you don't want them
... | php | public function carousel(array $images, array $options = array())
{
$html = '';
$id = $this->page->id('carousel');
$options = array_merge(array(
'interval' => 5000, // ie. 5 seconds in between frame changes
'indicators' => true, // set to false if you don't want them
... | [
"public",
"function",
"carousel",
"(",
"array",
"$",
"images",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"html",
"=",
"''",
";",
"$",
"id",
"=",
"$",
"this",
"->",
"page",
"->",
"id",
"(",
"'carousel'",
")",
";",
"$",
... | Creates a Bootstrap carousel for cycling through elements. Those elements don't necessarily need to be images, but pretty much they always are.
@param array $images An ``array($image, ...)`` of images to cycle through, starting with the first (logically). To get fancy and add captions, then make this an ``array($imag... | [
"Creates",
"a",
"Bootstrap",
"carousel",
"for",
"cycling",
"through",
"elements",
".",
"Those",
"elements",
"don",
"t",
"necessarily",
"need",
"to",
"be",
"images",
"but",
"pretty",
"much",
"they",
"always",
"are",
"."
] | 0d7677a90656fbc461eabb5512ab16f9d5f728c6 | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L1205-L1264 |
17,403 | steeffeen/FancyManiaLinks | FML/Script/Features/KeyAction.php | KeyAction.setKeyName | public function setKeyName($keyName)
{
$this->keyName = (string)$keyName;
$this->keyCode = null;
$this->charPressed = null;
return $this;
} | php | public function setKeyName($keyName)
{
$this->keyName = (string)$keyName;
$this->keyCode = null;
$this->charPressed = null;
return $this;
} | [
"public",
"function",
"setKeyName",
"(",
"$",
"keyName",
")",
"{",
"$",
"this",
"->",
"keyName",
"=",
"(",
"string",
")",
"$",
"keyName",
";",
"$",
"this",
"->",
"keyCode",
"=",
"null",
";",
"$",
"this",
"->",
"charPressed",
"=",
"null",
";",
"return... | Set the key name for triggering the action
@api
@param string $keyName Key Name
@return static | [
"Set",
"the",
"key",
"name",
"for",
"triggering",
"the",
"action"
] | 227b0759306f0a3c75873ba50276e4163a93bfa6 | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/KeyAction.php#L99-L105 |
17,404 | steeffeen/FancyManiaLinks | FML/Script/Features/KeyAction.php | KeyAction.setCharPressed | public function setCharPressed($charPressed)
{
$this->keyName = null;
$this->keyCode = null;
$this->charPressed = (string)$charPressed;
return $this;
} | php | public function setCharPressed($charPressed)
{
$this->keyName = null;
$this->keyCode = null;
$this->charPressed = (string)$charPressed;
return $this;
} | [
"public",
"function",
"setCharPressed",
"(",
"$",
"charPressed",
")",
"{",
"$",
"this",
"->",
"keyName",
"=",
"null",
";",
"$",
"this",
"->",
"keyCode",
"=",
"null",
";",
"$",
"this",
"->",
"charPressed",
"=",
"(",
"string",
")",
"$",
"charPressed",
";... | Set the character to press for triggering the action
@api
@param string $charPressed Pressed character
@return static | [
"Set",
"the",
"character",
"to",
"press",
"for",
"triggering",
"the",
"action"
] | 227b0759306f0a3c75873ba50276e4163a93bfa6 | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/KeyAction.php#L151-L157 |
17,405 | parsnick/steak | src/Boot/ConfigureViewEngines.php | ConfigureViewEngines.boot | public function boot(Container $app)
{
$app->afterResolving(function (Factory $factory, $app) {
$factory->addExtension('php', 'php', function () {
return new PhpEngine();
});
$factory->addExtension('blade.php', 'blade', function () use ($app) {
... | php | public function boot(Container $app)
{
$app->afterResolving(function (Factory $factory, $app) {
$factory->addExtension('php', 'php', function () {
return new PhpEngine();
});
$factory->addExtension('blade.php', 'blade', function () use ($app) {
... | [
"public",
"function",
"boot",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"app",
"->",
"afterResolving",
"(",
"function",
"(",
"Factory",
"$",
"factory",
",",
"$",
"app",
")",
"{",
"$",
"factory",
"->",
"addExtension",
"(",
"'php'",
",",
"'php'",
",",... | Set up the various view engines.
@param Container $app | [
"Set",
"up",
"the",
"various",
"view",
"engines",
"."
] | 461869189a640938438187330f6c50aca97c5ccc | https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Boot/ConfigureViewEngines.php#L20-L41 |
17,406 | vorbind/influx-analytics | src/Analytics.php | Analytics.getData | public function getData($rp, $metric, $tags, $granularity = 'daily', $startDt = null, $endDt = '2100-12-01T00:00:00Z', $timezone = 'UTC') {
$points = [];
try {
$pointsRp = $this->mapper->getRpPoints($rp, $metric, $tags, $granularity, $startDt, $endDt, $timezone);
$poi... | php | public function getData($rp, $metric, $tags, $granularity = 'daily', $startDt = null, $endDt = '2100-12-01T00:00:00Z', $timezone = 'UTC') {
$points = [];
try {
$pointsRp = $this->mapper->getRpPoints($rp, $metric, $tags, $granularity, $startDt, $endDt, $timezone);
$poi... | [
"public",
"function",
"getData",
"(",
"$",
"rp",
",",
"$",
"metric",
",",
"$",
"tags",
",",
"$",
"granularity",
"=",
"'daily'",
",",
"$",
"startDt",
"=",
"null",
",",
"$",
"endDt",
"=",
"'2100-12-01T00:00:00Z'",
",",
"$",
"timezone",
"=",
"'UTC'",
")",... | Get analytics data in right time zone by period and granularity
@param string $rp
@param string $metric
@param array $tags
@param string $granularity
@param string $startDt
@param string $endDt
@param string $timezone
@return int
@throws AnalyticsException | [
"Get",
"analytics",
"data",
"in",
"right",
"time",
"zone",
"by",
"period",
"and",
"granularity"
] | 8c0c150351f045ccd3d57063f2b3b50a2c926e3e | https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Analytics.php#L57-L72 |
17,407 | vorbind/influx-analytics | src/Analytics.php | Analytics.getTotal | public function getTotal($rp, $metric, $tags) {
try {
$todayDt = date("Y-m-d") . "T00:00:00Z";
return $this->mapper->getRpSum('forever', $metric, $tags) +
$this->mapper->getRpSum($rp, $metric, $tags, $todayDt) +
$this->mapper->getSum(... | php | public function getTotal($rp, $metric, $tags) {
try {
$todayDt = date("Y-m-d") . "T00:00:00Z";
return $this->mapper->getRpSum('forever', $metric, $tags) +
$this->mapper->getRpSum($rp, $metric, $tags, $todayDt) +
$this->mapper->getSum(... | [
"public",
"function",
"getTotal",
"(",
"$",
"rp",
",",
"$",
"metric",
",",
"$",
"tags",
")",
"{",
"try",
"{",
"$",
"todayDt",
"=",
"date",
"(",
"\"Y-m-d\"",
")",
".",
"\"T00:00:00Z\"",
";",
"return",
"$",
"this",
"->",
"mapper",
"->",
"getRpSum",
"("... | Returns analytics total for right metric
@param string $rp
@param string $metric
@param array $tags
@return int
@throws AnalyticsException | [
"Returns",
"analytics",
"total",
"for",
"right",
"metric"
] | 8c0c150351f045ccd3d57063f2b3b50a2c926e3e | https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Analytics.php#L83-L93 |
17,408 | vorbind/influx-analytics | src/Analytics.php | Analytics.fixTimeForGranularity | private function fixTimeForGranularity($points, $granularity) {
if ($granularity != $this->mapper::GRANULARITY_DAILY) {
return $points;
}
foreach ($points as &$value) {
$date = substr($value['time'],0, 10); // get date (2017-08-29)
$offset = substr($value['tim... | php | private function fixTimeForGranularity($points, $granularity) {
if ($granularity != $this->mapper::GRANULARITY_DAILY) {
return $points;
}
foreach ($points as &$value) {
$date = substr($value['time'],0, 10); // get date (2017-08-29)
$offset = substr($value['tim... | [
"private",
"function",
"fixTimeForGranularity",
"(",
"$",
"points",
",",
"$",
"granularity",
")",
"{",
"if",
"(",
"$",
"granularity",
"!=",
"$",
"this",
"->",
"mapper",
"::",
"GRANULARITY_DAILY",
")",
"{",
"return",
"$",
"points",
";",
"}",
"foreach",
"(",... | Fix time part for non-downsampled data
@param array $points
@param string $granularity
@return array | [
"Fix",
"time",
"part",
"for",
"non",
"-",
"downsampled",
"data"
] | 8c0c150351f045ccd3d57063f2b3b50a2c926e3e | https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Analytics.php#L122-L132 |
17,409 | vorbind/influx-analytics | src/Analytics.php | Analytics.combineSumPoints | private function combineSumPoints($points1, $points2) {
$pointsCount = count($points1);
$currPoint = 0;
foreach ($points2 as $point2) {
$pointFound = false;
//leverage the fact that points are sorted and improve O(n^2)
while ($currPoint < $pointsCount) {
... | php | private function combineSumPoints($points1, $points2) {
$pointsCount = count($points1);
$currPoint = 0;
foreach ($points2 as $point2) {
$pointFound = false;
//leverage the fact that points are sorted and improve O(n^2)
while ($currPoint < $pointsCount) {
... | [
"private",
"function",
"combineSumPoints",
"(",
"$",
"points1",
",",
"$",
"points2",
")",
"{",
"$",
"pointsCount",
"=",
"count",
"(",
"$",
"points1",
")",
";",
"$",
"currPoint",
"=",
"0",
";",
"foreach",
"(",
"$",
"points2",
"as",
"$",
"point2",
")",
... | Combine downsampled and non-downsampled points
@param array $points1
@param array $points2
@return array | [
"Combine",
"downsampled",
"and",
"non",
"-",
"downsampled",
"points"
] | 8c0c150351f045ccd3d57063f2b3b50a2c926e3e | https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Analytics.php#L141-L164 |
17,410 | xinix-technology/norm | src/Norm/Filter/FilterException.php | FilterException.context | public function context($context = null)
{
if (is_null($context)) {
return $this->context;
}
$this->context = $context;
return $this;
} | php | public function context($context = null)
{
if (is_null($context)) {
return $this->context;
}
$this->context = $context;
return $this;
} | [
"public",
"function",
"context",
"(",
"$",
"context",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"context",
")",
")",
"{",
"return",
"$",
"this",
"->",
"context",
";",
"}",
"$",
"this",
"->",
"context",
"=",
"$",
"context",
";",
"return... | Set field context of exception
@param string $context The field context
@return FilterException return self object to be chained | [
"Set",
"field",
"context",
"of",
"exception"
] | c357f7d3a75d05324dd84b8f6a968a094c53d603 | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Filter/FilterException.php#L113-L122 |
17,411 | xinix-technology/norm | src/Norm/Filter/FilterException.php | FilterException.args | public function args()
{
$this->args = func_get_args();
$params = array_merge(array($this->formatMessage), $this->args);
$this->message = call_user_func_array('sprintf', $params);
return $this;
} | php | public function args()
{
$this->args = func_get_args();
$params = array_merge(array($this->formatMessage), $this->args);
$this->message = call_user_func_array('sprintf', $params);
return $this;
} | [
"public",
"function",
"args",
"(",
")",
"{",
"$",
"this",
"->",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"params",
"=",
"array_merge",
"(",
"array",
"(",
"$",
"this",
"->",
"formatMessage",
")",
",",
"$",
"this",
"->",
"args",
")",
";",
"$... | Get the arrguments passed and build message by them.
@return Norm\Filter\FilterException | [
"Get",
"the",
"arrguments",
"passed",
"and",
"build",
"message",
"by",
"them",
"."
] | c357f7d3a75d05324dd84b8f6a968a094c53d603 | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Filter/FilterException.php#L129-L137 |
17,412 | simple-php-mvc/simple-php-mvc | src/MVC/File/Explorer.php | Explorer.copy | public function copy($sourceDir, $destinyDir)
{
$dir = opendir($sourceDir);
$this->mkdir($destinyDir);
while (false !== ( $file = readdir($dir))) {
if (( $file != '.' ) && ( $file != '..' )) {
if (is_dir($sourceDir . '/' . $file)) {
$this->copy... | php | public function copy($sourceDir, $destinyDir)
{
$dir = opendir($sourceDir);
$this->mkdir($destinyDir);
while (false !== ( $file = readdir($dir))) {
if (( $file != '.' ) && ( $file != '..' )) {
if (is_dir($sourceDir . '/' . $file)) {
$this->copy... | [
"public",
"function",
"copy",
"(",
"$",
"sourceDir",
",",
"$",
"destinyDir",
")",
"{",
"$",
"dir",
"=",
"opendir",
"(",
"$",
"sourceDir",
")",
";",
"$",
"this",
"->",
"mkdir",
"(",
"$",
"destinyDir",
")",
";",
"while",
"(",
"false",
"!==",
"(",
"$"... | Copy directory to destiny directory
@param string $sourceDir
@param string $destinyDir | [
"Copy",
"directory",
"to",
"destiny",
"directory"
] | e319eb09d29afad6993acb4a7e35f32a87dd0841 | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/File/Explorer.php#L41-L55 |
17,413 | Lansoweb/LosBase | src/LosBase/Document/DocumentManagerAwareTrait.php | DocumentManagerAwareTrait.getDocumentManager | public function getDocumentManager()
{
if (null === $this->dm) {
$this->dm = $this->getServiceLocator()->get('doctrine.documentmanager.odm_default');
}
return $this->dm;
} | php | public function getDocumentManager()
{
if (null === $this->dm) {
$this->dm = $this->getServiceLocator()->get('doctrine.documentmanager.odm_default');
}
return $this->dm;
} | [
"public",
"function",
"getDocumentManager",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"dm",
")",
"{",
"$",
"this",
"->",
"dm",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"'doctrine.documentmanager.odm_default... | Retorna o DocumentManager.
@return \Doctrine\ODM\MongoDb\DocumentManager | [
"Retorna",
"o",
"DocumentManager",
"."
] | 90e18a53d29c1bd841c149dca43aa365eecc656d | https://github.com/Lansoweb/LosBase/blob/90e18a53d29c1bd841c149dca43aa365eecc656d/src/LosBase/Document/DocumentManagerAwareTrait.php#L29-L36 |
17,414 | ClanCats/Core | src/bundles/UI/HTML.php | HTML.maker | public static function maker( $param, $param2 = null )
{
if ( !is_null( $param2 ) )
{
return static::create( $param, $param2 );
}
$param = explode( ' ', $param );
$element = array_shift( $param );
return static::create( $element, implode( ' ', $param ) );
} | php | public static function maker( $param, $param2 = null )
{
if ( !is_null( $param2 ) )
{
return static::create( $param, $param2 );
}
$param = explode( ' ', $param );
$element = array_shift( $param );
return static::create( $element, implode( ' ', $param ) );
} | [
"public",
"static",
"function",
"maker",
"(",
"$",
"param",
",",
"$",
"param2",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"param2",
")",
")",
"{",
"return",
"static",
"::",
"create",
"(",
"$",
"param",
",",
"$",
"param2",
")",
"... | The maker is like a development shortcut to create
html elements on the go
If param2 is set it wil be used as the content otherwise
the the first parameter will be splittet by the first space.
@param string $param
@param string $param2 | [
"The",
"maker",
"is",
"like",
"a",
"development",
"shortcut",
"to",
"create",
"html",
"elements",
"on",
"the",
"go"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/HTML.php#L23-L35 |
17,415 | ClanCats/Core | src/bundles/UI/HTML.php | HTML.attr | public static function attr( $attr = array() ) {
$buffer = " ";
foreach( $attr as $key => $value ) {
switch( $key ) {
case 'class':
if ( is_array( $value ) ) { $value = implode( ' ', $value ); }
break;
case 'style':
if ( is_array( $value ) ) {
$style = $value; $value = "";
... | php | public static function attr( $attr = array() ) {
$buffer = " ";
foreach( $attr as $key => $value ) {
switch( $key ) {
case 'class':
if ( is_array( $value ) ) { $value = implode( ' ', $value ); }
break;
case 'style':
if ( is_array( $value ) ) {
$style = $value; $value = "";
... | [
"public",
"static",
"function",
"attr",
"(",
"$",
"attr",
"=",
"array",
"(",
")",
")",
"{",
"$",
"buffer",
"=",
"\" \"",
";",
"foreach",
"(",
"$",
"attr",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"key",
")",
"{",
"cas... | generates html attribute string
@param array $attr | [
"generates",
"html",
"attribute",
"string"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/HTML.php#L42-L66 |
17,416 | ClanCats/Core | src/bundles/UI/HTML.php | HTML.tag | public static function tag( $name, $param1 = null, $param2 = null )
{
return static::create( $name, $param1, $param2 );
} | php | public static function tag( $name, $param1 = null, $param2 = null )
{
return static::create( $name, $param1, $param2 );
} | [
"public",
"static",
"function",
"tag",
"(",
"$",
"name",
",",
"$",
"param1",
"=",
"null",
",",
"$",
"param2",
"=",
"null",
")",
"{",
"return",
"static",
"::",
"create",
"(",
"$",
"name",
",",
"$",
"param1",
",",
"$",
"param2",
")",
";",
"}"
] | generates an html tag
@param string $name
@param mixed $param1
@param mixed $param2 | [
"generates",
"an",
"html",
"tag"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/HTML.php#L75-L78 |
17,417 | ClanCats/Core | src/bundles/UI/HTML.php | HTML.add_class | public function add_class( $class ) {
if ( !isset( $this->attr['class'] ) || !is_array( $this->attr['class'] ) ) {
$this->_sanitize_class();
}
if ( strpos( $class, ' ' ) !== false ) {
$class = explode( ' ', $class );
}
if ( is_string( $class ) ) {
$class = array( $class );
}
foreach ( $class as $... | php | public function add_class( $class ) {
if ( !isset( $this->attr['class'] ) || !is_array( $this->attr['class'] ) ) {
$this->_sanitize_class();
}
if ( strpos( $class, ' ' ) !== false ) {
$class = explode( ' ', $class );
}
if ( is_string( $class ) ) {
$class = array( $class );
}
foreach ( $class as $... | [
"public",
"function",
"add_class",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"attr",
"[",
"'class'",
"]",
")",
"||",
"!",
"is_array",
"(",
"$",
"this",
"->",
"attr",
"[",
"'class'",
"]",
")",
")",
"{",
"$",
"... | add html class
@param string $class | [
"add",
"html",
"class"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/HTML.php#L95-L109 |
17,418 | ClanCats/Core | src/bundles/UI/HTML.php | HTML.remove_class | public function remove_class( $class ) {
if ( !isset( $this->attr['class'] ) || !is_array( $this->attr['class'] ) ) {
$this->_sanitize_class();
}
$this->attr['class'] = array_diff( $this->attr['class'], array( $class ) );
return $this;
} | php | public function remove_class( $class ) {
if ( !isset( $this->attr['class'] ) || !is_array( $this->attr['class'] ) ) {
$this->_sanitize_class();
}
$this->attr['class'] = array_diff( $this->attr['class'], array( $class ) );
return $this;
} | [
"public",
"function",
"remove_class",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"attr",
"[",
"'class'",
"]",
")",
"||",
"!",
"is_array",
"(",
"$",
"this",
"->",
"attr",
"[",
"'class'",
"]",
")",
")",
"{",
"$",
... | remove html class
@param string $class | [
"remove",
"html",
"class"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/HTML.php#L116-L122 |
17,419 | ClanCats/Core | src/bundles/UI/HTML.php | HTML._sanitize_class | private function _sanitize_class() {
if ( isset( $this->attr['class'] ) && is_string( $this->attr['class'] ) ) {
$this->attr['class'] = explode( ' ', $this->attr['class'] );
}
if ( !isset( $this->attr['class'] ) || !is_array( $this->attr['class'] ) ) {
$this->attr['class'] = array();
}
} | php | private function _sanitize_class() {
if ( isset( $this->attr['class'] ) && is_string( $this->attr['class'] ) ) {
$this->attr['class'] = explode( ' ', $this->attr['class'] );
}
if ( !isset( $this->attr['class'] ) || !is_array( $this->attr['class'] ) ) {
$this->attr['class'] = array();
}
} | [
"private",
"function",
"_sanitize_class",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"attr",
"[",
"'class'",
"]",
")",
"&&",
"is_string",
"(",
"$",
"this",
"->",
"attr",
"[",
"'class'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"attr",... | clean the classes attribute | [
"clean",
"the",
"classes",
"attribute"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/HTML.php#L127-L134 |
17,420 | php-rise/rise | src/Database.php | Database.getConnectionConfig | public function getConnectionConfig($name = null) {
if (is_null($name)) {
$name = $this->defaultConfigName;
}
if (isset($this->connectionConfigs[$name])) {
return $this->connectionConfigs[$name];
}
return null;
} | php | public function getConnectionConfig($name = null) {
if (is_null($name)) {
$name = $this->defaultConfigName;
}
if (isset($this->connectionConfigs[$name])) {
return $this->connectionConfigs[$name];
}
return null;
} | [
"public",
"function",
"getConnectionConfig",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"name",
")",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"defaultConfigName",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"... | Get connection config.
@param string $name
@return array|null | [
"Get",
"connection",
"config",
"."
] | cd14ef9956f1b6875b7bcd642545dcef6a9152b7 | https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Database.php#L48-L58 |
17,421 | php-rise/rise | src/Database.php | Database.getConnection | public function getConnection($name = null, $forceNew = false) {
if (!$forceNew && isset($this->connections[$name])) {
return $this->connections[$name];
}
$config = $this->getConnectionConfig($name);
if (!$config) {
return null;
}
$pdoArgs = [$config['dsn'], $config['username'], $config['password']... | php | public function getConnection($name = null, $forceNew = false) {
if (!$forceNew && isset($this->connections[$name])) {
return $this->connections[$name];
}
$config = $this->getConnectionConfig($name);
if (!$config) {
return null;
}
$pdoArgs = [$config['dsn'], $config['username'], $config['password']... | [
"public",
"function",
"getConnection",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"forceNew",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"forceNew",
"&&",
"isset",
"(",
"$",
"this",
"->",
"connections",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return... | Get a connection by name.
@param string $name Optional. Connection name.
@param bool $forceNew Optional. Create a new connection or reuse the old one if exists.
@return \PDO|null | [
"Get",
"a",
"connection",
"by",
"name",
"."
] | cd14ef9956f1b6875b7bcd642545dcef6a9152b7 | https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Database.php#L79-L101 |
17,422 | Chill-project/Main | Search/AbstractSearch.php | AbstractSearch.parseDate | public function parseDate($string)
{
try {
return new \DateTime($string);
} catch (ParsingException $ex) {
$exception = new ParsingException('The date is '
. 'not parsable', 0, $ex);
throw $exception;
}
} | php | public function parseDate($string)
{
try {
return new \DateTime($string);
} catch (ParsingException $ex) {
$exception = new ParsingException('The date is '
. 'not parsable', 0, $ex);
throw $exception;
}
} | [
"public",
"function",
"parseDate",
"(",
"$",
"string",
")",
"{",
"try",
"{",
"return",
"new",
"\\",
"DateTime",
"(",
"$",
"string",
")",
";",
"}",
"catch",
"(",
"ParsingException",
"$",
"ex",
")",
"{",
"$",
"exception",
"=",
"new",
"ParsingException",
... | parse string expected to be a date and transform to a DateTime object
@param type $string
@return \DateTime
@throws ParsingException if the date is not parseable | [
"parse",
"string",
"expected",
"to",
"be",
"a",
"date",
"and",
"transform",
"to",
"a",
"DateTime",
"object"
] | 384cb6c793072a4f1047dc5cafc2157ee2419f60 | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Search/AbstractSearch.php#L45-L55 |
17,423 | Chill-project/Main | Search/AbstractSearch.php | AbstractSearch.recomposePattern | protected function recomposePattern(array $terms, array $supportedTerms, $domain = NULL)
{
$recomposed = '';
if ($domain !== NULL)
{
$recomposed .= '@'.$domain.' ';
}
foreach ($supportedTerms as $term) {
if (array_key_exists($term, $t... | php | protected function recomposePattern(array $terms, array $supportedTerms, $domain = NULL)
{
$recomposed = '';
if ($domain !== NULL)
{
$recomposed .= '@'.$domain.' ';
}
foreach ($supportedTerms as $term) {
if (array_key_exists($term, $t... | [
"protected",
"function",
"recomposePattern",
"(",
"array",
"$",
"terms",
",",
"array",
"$",
"supportedTerms",
",",
"$",
"domain",
"=",
"NULL",
")",
"{",
"$",
"recomposed",
"=",
"''",
";",
"if",
"(",
"$",
"domain",
"!==",
"NULL",
")",
"{",
"$",
"recompo... | recompose a pattern, retaining only supported terms
the outputted string should be used to show users their search
@param array $terms
@param array $supportedTerms
@param string $domain if your domain is NULL, you should set NULL. You should set used domain instead
@return string | [
"recompose",
"a",
"pattern",
"retaining",
"only",
"supported",
"terms"
] | 384cb6c793072a4f1047dc5cafc2157ee2419f60 | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Search/AbstractSearch.php#L67-L93 |
17,424 | webforge-labs/psc-cms | lib/Psc/CMS/Item/ButtonableValueObject.php | ButtonableValueObject.copyFromButtonable | public static function copyFromButtonable(Buttonable $tabButtonable) {
$valueObject = new static();
// ugly, but fast
$valueObject->setButtonLabel($tabButtonable->getButtonLabel());
$valueObject->setFullButtonLabel($tabButtonable->getFullButtonLabel());
$valueObject->setButtonLeftIcon($tabButto... | php | public static function copyFromButtonable(Buttonable $tabButtonable) {
$valueObject = new static();
// ugly, but fast
$valueObject->setButtonLabel($tabButtonable->getButtonLabel());
$valueObject->setFullButtonLabel($tabButtonable->getFullButtonLabel());
$valueObject->setButtonLeftIcon($tabButto... | [
"public",
"static",
"function",
"copyFromButtonable",
"(",
"Buttonable",
"$",
"tabButtonable",
")",
"{",
"$",
"valueObject",
"=",
"new",
"static",
"(",
")",
";",
"// ugly, but fast",
"$",
"valueObject",
"->",
"setButtonLabel",
"(",
"$",
"tabButtonable",
"->",
"g... | Creates a copy of an Buttonable
use this to have a modified Version of the interface
@return ButtonableValueObject | [
"Creates",
"a",
"copy",
"of",
"an",
"Buttonable"
] | 467bfa2547e6b4fa487d2d7f35fa6cc618dbc763 | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Item/ButtonableValueObject.php#L25-L36 |
17,425 | terion-name/package-installer | src/Terion/PackageInstaller/PackageInstallCommand.php | PackageInstallCommand.requirePackage | protected function requirePackage(Package $package)
{
$version = $this->chooseVersion($package);
passthru(sprintf(
'composer require %s:%s',
$package->getName(),
$version
));
$this->comment('Package ' . $package->getName() . ' installed');
... | php | protected function requirePackage(Package $package)
{
$version = $this->chooseVersion($package);
passthru(sprintf(
'composer require %s:%s',
$package->getName(),
$version
));
$this->comment('Package ' . $package->getName() . ' installed');
... | [
"protected",
"function",
"requirePackage",
"(",
"Package",
"$",
"package",
")",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"chooseVersion",
"(",
"$",
"package",
")",
";",
"passthru",
"(",
"sprintf",
"(",
"'composer require %s:%s'",
",",
"$",
"package",
"->... | Installs package.
@param Package $package | [
"Installs",
"package",
"."
] | a1f53085b0b5dbbcc308476f61188103051bd201 | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/PackageInstallCommand.php#L109-L127 |
17,426 | terion-name/package-installer | src/Terion/PackageInstaller/PackageInstallCommand.php | PackageInstallCommand.searchPackage | protected function searchPackage($packageName)
{
$this->comment('Searching for package...');
$packages = $this->packagist->search($packageName);
$total = count($packages);
if ($total === 0) {
$this->comment('No packages found');
exit;
}
$this-... | php | protected function searchPackage($packageName)
{
$this->comment('Searching for package...');
$packages = $this->packagist->search($packageName);
$total = count($packages);
if ($total === 0) {
$this->comment('No packages found');
exit;
}
$this-... | [
"protected",
"function",
"searchPackage",
"(",
"$",
"packageName",
")",
"{",
"$",
"this",
"->",
"comment",
"(",
"'Searching for package...'",
")",
";",
"$",
"packages",
"=",
"$",
"this",
"->",
"packagist",
"->",
"search",
"(",
"$",
"packageName",
")",
";",
... | Perform search on packagist and ask package select.
@param $packageName | [
"Perform",
"search",
"on",
"packagist",
"and",
"ask",
"package",
"select",
"."
] | a1f53085b0b5dbbcc308476f61188103051bd201 | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/PackageInstallCommand.php#L210-L232 |
17,427 | terion-name/package-installer | src/Terion/PackageInstaller/PackageInstallCommand.php | PackageInstallCommand.choosePackage | protected function choosePackage($packages)
{
$choose = $this->ask('Select package by number [1]:', '1');
if (!is_numeric($choose) or !isset($packages[$choose - 1])) {
$this->error('Incorrect value given!');
$this->choosePackage($packages);
} else {
$index... | php | protected function choosePackage($packages)
{
$choose = $this->ask('Select package by number [1]:', '1');
if (!is_numeric($choose) or !isset($packages[$choose - 1])) {
$this->error('Incorrect value given!');
$this->choosePackage($packages);
} else {
$index... | [
"protected",
"function",
"choosePackage",
"(",
"$",
"packages",
")",
"{",
"$",
"choose",
"=",
"$",
"this",
"->",
"ask",
"(",
"'Select package by number [1]:'",
",",
"'1'",
")",
";",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"choose",
")",
"or",
"!",
"isset... | Ask package select from a list.
@param $packages | [
"Ask",
"package",
"select",
"from",
"a",
"list",
"."
] | a1f53085b0b5dbbcc308476f61188103051bd201 | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/PackageInstallCommand.php#L239-L251 |
17,428 | Ocramius/OcraDiCompiler | src/OcraDiCompiler/Generator/DiInstantiatorCompiler.php | DiInstantiatorCompiler.buildParams | protected function buildParams(array $params)
{
$normalizedParameters = array();
foreach ($params as $parameter) {
if ($parameter instanceof GeneratorInstance) {
/* @var $parameter GeneratorInstance */
$normalizedParameters[] = sprintf('$di->get(%s)', '\'... | php | protected function buildParams(array $params)
{
$normalizedParameters = array();
foreach ($params as $parameter) {
if ($parameter instanceof GeneratorInstance) {
/* @var $parameter GeneratorInstance */
$normalizedParameters[] = sprintf('$di->get(%s)', '\'... | [
"protected",
"function",
"buildParams",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"normalizedParameters",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"parameter",
")",
"{",
"if",
"(",
"$",
"parameter",
"instanceof",
"GeneratorI... | Generates parameter strings to be used as injections, replacing reference parameters with their respective
getters
@param array $params
@return array | [
"Generates",
"parameter",
"strings",
"to",
"be",
"used",
"as",
"injections",
"replacing",
"reference",
"parameters",
"with",
"their",
"respective",
"getters"
] | 667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a | https://github.com/Ocramius/OcraDiCompiler/blob/667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a/src/OcraDiCompiler/Generator/DiInstantiatorCompiler.php#L249-L263 |
17,429 | anime-db/app-bundle | src/Controller/CommandController.php | CommandController.execAction | public function execAction(Request $request)
{
ignore_user_abort(true);
set_time_limit(0);
$this->get('anime_db.command')->execute($request->get('command'), 0);
return new Response();
} | php | public function execAction(Request $request)
{
ignore_user_abort(true);
set_time_limit(0);
$this->get('anime_db.command')->execute($request->get('command'), 0);
return new Response();
} | [
"public",
"function",
"execAction",
"(",
"Request",
"$",
"request",
")",
"{",
"ignore_user_abort",
"(",
"true",
")",
";",
"set_time_limit",
"(",
"0",
")",
";",
"$",
"this",
"->",
"get",
"(",
"'anime_db.command'",
")",
"->",
"execute",
"(",
"$",
"request",
... | Execute command in background.
@param Request $request
@return Response | [
"Execute",
"command",
"in",
"background",
"."
] | ca3b342081719d41ba018792a75970cbb1f1fe22 | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Controller/CommandController.php#L24-L32 |
17,430 | CakeCMS/Core | src/ORM/Table.php | Table.beforeMarshal | public function beforeMarshal(Event $event, \ArrayObject $data, \ArrayObject $options)
{
$this->_prepareParamsData($data);
} | php | public function beforeMarshal(Event $event, \ArrayObject $data, \ArrayObject $options)
{
$this->_prepareParamsData($data);
} | [
"public",
"function",
"beforeMarshal",
"(",
"Event",
"$",
"event",
",",
"\\",
"ArrayObject",
"$",
"data",
",",
"\\",
"ArrayObject",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"_prepareParamsData",
"(",
"$",
"data",
")",
";",
"}"
] | Callback before request data is converted into entities.
@param Event $event
@param \ArrayObject $data
@param \ArrayObject $options
@return void
@SuppressWarnings("unused") | [
"Callback",
"before",
"request",
"data",
"is",
"converted",
"into",
"entities",
"."
] | f9cba7aa0043a10e5c35bd45fbad158688a09a96 | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/ORM/Table.php#L40-L43 |
17,431 | CakeCMS/Core | src/ORM/Table.php | Table._prepareParamsData | protected function _prepareParamsData(\ArrayObject $data)
{
if (isset($data['params'])) {
$params = new JSON((array) $data['params']);
$data->offsetSet('params', $params);
}
} | php | protected function _prepareParamsData(\ArrayObject $data)
{
if (isset($data['params'])) {
$params = new JSON((array) $data['params']);
$data->offsetSet('params', $params);
}
} | [
"protected",
"function",
"_prepareParamsData",
"(",
"\\",
"ArrayObject",
"$",
"data",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'params'",
"]",
")",
")",
"{",
"$",
"params",
"=",
"new",
"JSON",
"(",
"(",
"array",
")",
"$",
"data",
"[",
... | Prepare params data.
@param \ArrayObject $data
@return void | [
"Prepare",
"params",
"data",
"."
] | f9cba7aa0043a10e5c35bd45fbad158688a09a96 | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/ORM/Table.php#L51-L57 |
17,432 | thecodingmachine/service-provider-bridge-bundle | src/InteropServiceProviderBridgeBundle.php | InteropServiceProviderBridgeBundle.boot | public function boot()
{
$registryServiceName = 'service_provider_registry_'.$this->id;
$this->container->set($registryServiceName, $this->getRegistry($this->container));
} | php | public function boot()
{
$registryServiceName = 'service_provider_registry_'.$this->id;
$this->container->set($registryServiceName, $this->getRegistry($this->container));
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"registryServiceName",
"=",
"'service_provider_registry_'",
".",
"$",
"this",
"->",
"id",
";",
"$",
"this",
"->",
"container",
"->",
"set",
"(",
"$",
"registryServiceName",
",",
"$",
"this",
"->",
"getRegistr... | At boot time, let's fill the container with the registry. | [
"At",
"boot",
"time",
"let",
"s",
"fill",
"the",
"container",
"with",
"the",
"registry",
"."
] | 7ac2d64c6aa7f093ad36fb1f3a4b86b397777c99 | https://github.com/thecodingmachine/service-provider-bridge-bundle/blob/7ac2d64c6aa7f093ad36fb1f3a4b86b397777c99/src/InteropServiceProviderBridgeBundle.php#L39-L43 |
17,433 | datasift/php_webdriver | src/php/DataSift/WebDriver/WebDriverClient.php | WebDriverClient.getSessions | public function getSessions()
{
// our return value
$sessions = array();
// get a raw list of the current sessions
$result = $this->curl('GET', '/sessions');
// convert the raw list into an array of WebDriverSession objects
foreach ($result['value'] as $session) {
... | php | public function getSessions()
{
// our return value
$sessions = array();
// get a raw list of the current sessions
$result = $this->curl('GET', '/sessions');
// convert the raw list into an array of WebDriverSession objects
foreach ($result['value'] as $session) {
... | [
"public",
"function",
"getSessions",
"(",
")",
"{",
"// our return value",
"$",
"sessions",
"=",
"array",
"(",
")",
";",
"// get a raw list of the current sessions",
"$",
"result",
"=",
"$",
"this",
"->",
"curl",
"(",
"'GET'",
",",
"'/sessions'",
")",
";",
"//... | get a list of active sessions
@return array(WebDriverSession)
a list of the sessions that webdriver currently knows about | [
"get",
"a",
"list",
"of",
"active",
"sessions"
] | efca991198616b53c8f40b59ad05306e2b10e7f0 | https://github.com/datasift/php_webdriver/blob/efca991198616b53c8f40b59ad05306e2b10e7f0/src/php/DataSift/WebDriver/WebDriverClient.php#L94-L109 |
17,434 | yuncms/framework | src/filesystem/adapters/OssAdapter.php | OssAdapter.getSize | public function getSize($path)
{
$location = $this->applyPathPrefix($path);
$response = $this->ossClient->getObjectMeta($this->bucket, $location);
return [
'size' => $response['content-length']
];
} | php | public function getSize($path)
{
$location = $this->applyPathPrefix($path);
$response = $this->ossClient->getObjectMeta($this->bucket, $location);
return [
'size' => $response['content-length']
];
} | [
"public",
"function",
"getSize",
"(",
"$",
"path",
")",
"{",
"$",
"location",
"=",
"$",
"this",
"->",
"applyPathPrefix",
"(",
"$",
"path",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"ossClient",
"->",
"getObjectMeta",
"(",
"$",
"this",
"->",
... | Get the size of a file.
@param string $path
@return array|false | [
"Get",
"the",
"size",
"of",
"a",
"file",
"."
] | af42e28ea4ae15ab8eead3f6d119f93863b94154 | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/adapters/OssAdapter.php#L412-L419 |
17,435 | ClanCats/Core | src/classes/CCStr.php | CCStr.charset | public static function charset( $charset = null )
{
switch( $charset )
{
case 'pass':
case 'secure':
case 'password':
return static::SECURE;
break;
case 'key':
return static::KEY;
break;
case 'alphanum':
return static::ALPHA_NUM;
break;
case 'alpha':
return static:... | php | public static function charset( $charset = null )
{
switch( $charset )
{
case 'pass':
case 'secure':
case 'password':
return static::SECURE;
break;
case 'key':
return static::KEY;
break;
case 'alphanum':
return static::ALPHA_NUM;
break;
case 'alpha':
return static:... | [
"public",
"static",
"function",
"charset",
"(",
"$",
"charset",
"=",
"null",
")",
"{",
"switch",
"(",
"$",
"charset",
")",
"{",
"case",
"'pass'",
":",
"case",
"'secure'",
":",
"case",
"'password'",
":",
"return",
"static",
"::",
"SECURE",
";",
"break",
... | Get a charset, a string containing a set of characters.
There are some predefined charsets like:
pass
secure
password
key
alphanum
alpha
alpha_low
lowercase
alpha_up
uppercase
numeric
num
hex
bin
Everything else gets returned as its own charset.
@param string $charset use predefined charset or your own
@return str... | [
"Get",
"a",
"charset",
"a",
"string",
"containing",
"a",
"set",
"of",
"characters",
"."
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L51-L104 |
17,436 | ClanCats/Core | src/classes/CCStr.php | CCStr.random | public static function random( $length = 25, $charset = null )
{
$charset = static::charset( $charset );
$count = strlen( $charset ); $string = '';
while ( $length-- )
{
$string .= $charset[mt_rand(0, $count-1)];
}
return $string;
} | php | public static function random( $length = 25, $charset = null )
{
$charset = static::charset( $charset );
$count = strlen( $charset ); $string = '';
while ( $length-- )
{
$string .= $charset[mt_rand(0, $count-1)];
}
return $string;
} | [
"public",
"static",
"function",
"random",
"(",
"$",
"length",
"=",
"25",
",",
"$",
"charset",
"=",
"null",
")",
"{",
"$",
"charset",
"=",
"static",
"::",
"charset",
"(",
"$",
"charset",
")",
";",
"$",
"count",
"=",
"strlen",
"(",
"$",
"charset",
")... | Generate a random string with the given length and charset.
CCStr::random( 8, 'hex' ); // 56F6AE10
CCStr::random( 4, 'password' ); // ?F%7
@param int $length Default is 25
@param string $charset This parameter uses the CCStr::charset function
@return string | [
"Generate",
"a",
"random",
"string",
"with",
"the",
"given",
"length",
"and",
"charset",
"."
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L116-L128 |
17,437 | ClanCats/Core | src/classes/CCStr.php | CCStr.capture | public static function capture( $callback, $params = array() )
{
if ( is_string( $callback ) )
{
return $callback;
}
if ( !is_closure( $callback ) )
{
return "";
}
if ( !is_array( $params ) )
{
$params = array( $params );
}
ob_start();
$return = call_user_func_array( $callback, $par... | php | public static function capture( $callback, $params = array() )
{
if ( is_string( $callback ) )
{
return $callback;
}
if ( !is_closure( $callback ) )
{
return "";
}
if ( !is_array( $params ) )
{
$params = array( $params );
}
ob_start();
$return = call_user_func_array( $callback, $par... | [
"public",
"static",
"function",
"capture",
"(",
"$",
"callback",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"callback",
")",
")",
"{",
"return",
"$",
"callback",
";",
"}",
"if",
"(",
"!",
"is_closure",
"... | Try to get a string from a callback reading the output buffer
@param mixed $callback
@param array $params
@return string | [
"Try",
"to",
"get",
"a",
"string",
"from",
"a",
"callback",
"reading",
"the",
"output",
"buffer"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L137-L164 |
17,438 | ClanCats/Core | src/classes/CCStr.php | CCStr.htmlentities | public static function htmlentities( $string, $recursive = false )
{
if ( is_array( $string ) )
{
foreach( $string as $key => $item )
{
if ( $recursive )
{
if ( is_array( $item ) )
{
$string[$key] = static::htmlentities( $item, $recursive );
}
}
if ( is_string( $... | php | public static function htmlentities( $string, $recursive = false )
{
if ( is_array( $string ) )
{
foreach( $string as $key => $item )
{
if ( $recursive )
{
if ( is_array( $item ) )
{
$string[$key] = static::htmlentities( $item, $recursive );
}
}
if ( is_string( $... | [
"public",
"static",
"function",
"htmlentities",
"(",
"$",
"string",
",",
"$",
"recursive",
"=",
"false",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"string",
")",
")",
"{",
"foreach",
"(",
"$",
"string",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{... | Does the same as the PHP native htmlentities function but you can pass arrays.
@param string|array $string
@param bool $recursive
@return string|array | [
"Does",
"the",
"same",
"as",
"the",
"PHP",
"native",
"htmlentities",
"function",
"but",
"you",
"can",
"pass",
"arrays",
"."
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L173-L197 |
17,439 | ClanCats/Core | src/classes/CCStr.php | CCStr.suffix | public static function suffix( $string, $sep = '-' )
{
return substr( $string, strrpos( $string, $sep )+strlen( $sep ) );
} | php | public static function suffix( $string, $sep = '-' )
{
return substr( $string, strrpos( $string, $sep )+strlen( $sep ) );
} | [
"public",
"static",
"function",
"suffix",
"(",
"$",
"string",
",",
"$",
"sep",
"=",
"'-'",
")",
"{",
"return",
"substr",
"(",
"$",
"string",
",",
"strrpos",
"(",
"$",
"string",
",",
"$",
"sep",
")",
"+",
"strlen",
"(",
"$",
"sep",
")",
")",
";",
... | Get the last part of a string
CCStr::suffix( 'some-strange-file-name-2014' ); // 2014
CCStr::suffix( '/path/to/my/file.xml', '/' ); // file.xml
@param string $string
@param string $sep The seperator string.
@return string | [
"Get",
"the",
"last",
"part",
"of",
"a",
"string"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L209-L212 |
17,440 | ClanCats/Core | src/classes/CCStr.php | CCStr.clean_url | public static function clean_url( $string, $sep = null )
{
// basic clean
$string = strtolower( static::replace_accents( trim( $string ) ) );
// these characters get replaced with our seperator
$string = str_replace( array( ' ', '&', '\r\n', '\n', '+', ',', '.', '_' ) , '-', $string );
$string = preg_repl... | php | public static function clean_url( $string, $sep = null )
{
// basic clean
$string = strtolower( static::replace_accents( trim( $string ) ) );
// these characters get replaced with our seperator
$string = str_replace( array( ' ', '&', '\r\n', '\n', '+', ',', '.', '_' ) , '-', $string );
$string = preg_repl... | [
"public",
"static",
"function",
"clean_url",
"(",
"$",
"string",
",",
"$",
"sep",
"=",
"null",
")",
"{",
"// basic clean",
"$",
"string",
"=",
"strtolower",
"(",
"static",
"::",
"replace_accents",
"(",
"trim",
"(",
"$",
"string",
")",
")",
")",
";",
"/... | Try to form a string to url valid segment. It will remove all special characters replace
accents characters remove and replace whitespaces breaks etc..
@param string $string
@param string $sep You can define another seperator default is "-"
@return string | [
"Try",
"to",
"form",
"a",
"string",
"to",
"url",
"valid",
"segment",
".",
"It",
"will",
"remove",
"all",
"special",
"characters",
"replace",
"accents",
"characters",
"remove",
"and",
"replace",
"whitespaces",
"breaks",
"etc",
".."
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L299-L319 |
17,441 | ClanCats/Core | src/classes/CCStr.php | CCStr.replace | public static function replace( $string, $arr, $count = null )
{
return str_replace( array_keys( $arr ), array_values( $arr ), $string, $count );
} | php | public static function replace( $string, $arr, $count = null )
{
return str_replace( array_keys( $arr ), array_values( $arr ), $string, $count );
} | [
"public",
"static",
"function",
"replace",
"(",
"$",
"string",
",",
"$",
"arr",
",",
"$",
"count",
"=",
"null",
")",
"{",
"return",
"str_replace",
"(",
"array_keys",
"(",
"$",
"arr",
")",
",",
"array_values",
"(",
"$",
"arr",
")",
",",
"$",
"string",... | str_replace using key => value of an array
@param string $string
@param array $arr
@param int $count
@return string | [
"str_replace",
"using",
"key",
"=",
">",
"value",
"of",
"an",
"array"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L329-L332 |
17,442 | ClanCats/Core | src/classes/CCStr.php | CCStr.preg_replace | public static function preg_replace( $arr, $string, $count = null )
{
return preg_replace( array_keys( $arr ), array_values( $arr ), $string, $count );
} | php | public static function preg_replace( $arr, $string, $count = null )
{
return preg_replace( array_keys( $arr ), array_values( $arr ), $string, $count );
} | [
"public",
"static",
"function",
"preg_replace",
"(",
"$",
"arr",
",",
"$",
"string",
",",
"$",
"count",
"=",
"null",
")",
"{",
"return",
"preg_replace",
"(",
"array_keys",
"(",
"$",
"arr",
")",
",",
"array_values",
"(",
"$",
"arr",
")",
",",
"$",
"st... | preg replace using key => value of an array
@param string $string
@param array $arr
@param int $count
@return string | [
"preg",
"replace",
"using",
"key",
"=",
">",
"value",
"of",
"an",
"array"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L342-L345 |
17,443 | ClanCats/Core | src/classes/CCStr.php | CCStr.lower | public static function lower( $string, $encoding = null )
{
if ( is_null( $encoding ) )
{
$encoding = ClanCats::$config->charset;
}
return mb_strtolower( $string, $encoding );
} | php | public static function lower( $string, $encoding = null )
{
if ( is_null( $encoding ) )
{
$encoding = ClanCats::$config->charset;
}
return mb_strtolower( $string, $encoding );
} | [
"public",
"static",
"function",
"lower",
"(",
"$",
"string",
",",
"$",
"encoding",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"encoding",
")",
")",
"{",
"$",
"encoding",
"=",
"ClanCats",
"::",
"$",
"config",
"->",
"charset",
";",
"}",
"... | Converts an string to lowercase using the system encoding
@param string $string
@param string $encoding
@return string | [
"Converts",
"an",
"string",
"to",
"lowercase",
"using",
"the",
"system",
"encoding"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L354-L361 |
17,444 | ClanCats/Core | src/classes/CCStr.php | CCStr.upper | public static function upper( $string, $encoding = null )
{
if ( is_null( $encoding ) )
{
$encoding = ClanCats::$config->charset;
}
return mb_strtoupper( $string, $encoding );
} | php | public static function upper( $string, $encoding = null )
{
if ( is_null( $encoding ) )
{
$encoding = ClanCats::$config->charset;
}
return mb_strtoupper( $string, $encoding );
} | [
"public",
"static",
"function",
"upper",
"(",
"$",
"string",
",",
"$",
"encoding",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"encoding",
")",
")",
"{",
"$",
"encoding",
"=",
"ClanCats",
"::",
"$",
"config",
"->",
"charset",
";",
"}",
"... | Converts an string to uppercase using the system encoding
@param string $string
@param string $encoding
@return string | [
"Converts",
"an",
"string",
"to",
"uppercase",
"using",
"the",
"system",
"encoding"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L370-L377 |
17,445 | ClanCats/Core | src/classes/CCStr.php | CCStr.cut | public static function cut( $string, $key, $cut_key = true, $last = false )
{
if ( $last )
{
$pos = strrpos( $string, $key );
}
else
{
$pos = strpos( $string, $key );
}
if ( $pos === false )
{
return $string;
}
if ( !$cut_key )
{
$pos += strlen( $key );
}
return substr( $stri... | php | public static function cut( $string, $key, $cut_key = true, $last = false )
{
if ( $last )
{
$pos = strrpos( $string, $key );
}
else
{
$pos = strpos( $string, $key );
}
if ( $pos === false )
{
return $string;
}
if ( !$cut_key )
{
$pos += strlen( $key );
}
return substr( $stri... | [
"public",
"static",
"function",
"cut",
"(",
"$",
"string",
",",
"$",
"key",
",",
"$",
"cut_key",
"=",
"true",
",",
"$",
"last",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"last",
")",
"{",
"$",
"pos",
"=",
"strrpos",
"(",
"$",
"string",
",",
"$",
... | Cuts a string after another string.
CCStr::cut( 'some/path/to/user.config.xml', '.' ); // some/path/to/user
CCStr::cut( 'some/path/to/user.config.xml', '/', false ); // some/
CCStr::cut( 'some/path/to/user.config.xml', '/', true, true ); // some/path/to
@param string $string
@param string $key The string that af... | [
"Cuts",
"a",
"string",
"after",
"another",
"string",
"."
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L422-L442 |
17,446 | ClanCats/Core | src/classes/CCStr.php | CCStr.bytes | public static function bytes( $size, $round = 2 )
{
$unit = array( 'b', 'kb', 'mb', 'gb', 'tb', 'pb' );
return @round( $size / pow( 1024, ( $i = floor( log( $size, 1024 ) ) ) ), $round ).$unit[$i];
} | php | public static function bytes( $size, $round = 2 )
{
$unit = array( 'b', 'kb', 'mb', 'gb', 'tb', 'pb' );
return @round( $size / pow( 1024, ( $i = floor( log( $size, 1024 ) ) ) ), $round ).$unit[$i];
} | [
"public",
"static",
"function",
"bytes",
"(",
"$",
"size",
",",
"$",
"round",
"=",
"2",
")",
"{",
"$",
"unit",
"=",
"array",
"(",
"'b'",
",",
"'kb'",
",",
"'mb'",
",",
"'gb'",
",",
"'tb'",
",",
"'pb'",
")",
";",
"return",
"@",
"round",
"(",
"$"... | Convert bytes to a human readable format
CCStr::bytes( 39247293 ); // 37.43mb
@param int $size
@return string | [
"Convert",
"bytes",
"to",
"a",
"human",
"readable",
"format"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStr.php#L484-L488 |
17,447 | Chill-project/Main | Templating/TranslatableStringHelper.php | TranslatableStringHelper.localize | public function localize(array $translatableStrings)
{
if (NULL === $translatableStrings) {
return NULL;
}
$language = $this->requestStack->getCurrentRequest()->getLocale();
if (isset($translatableStrings[$language])) {
return $... | php | public function localize(array $translatableStrings)
{
if (NULL === $translatableStrings) {
return NULL;
}
$language = $this->requestStack->getCurrentRequest()->getLocale();
if (isset($translatableStrings[$language])) {
return $... | [
"public",
"function",
"localize",
"(",
"array",
"$",
"translatableStrings",
")",
"{",
"if",
"(",
"NULL",
"===",
"$",
"translatableStrings",
")",
"{",
"return",
"NULL",
";",
"}",
"$",
"language",
"=",
"$",
"this",
"->",
"requestStack",
"->",
"getCurrentReques... | return the string in current locale if it exists.
If it does not exists; return the name in the first language available.
Return a blank string if any strings are available.
Return NULL if $translatableString is NULL
@param array $translatableStrings
@return string | [
"return",
"the",
"string",
"in",
"current",
"locale",
"if",
"it",
"exists",
"."
] | 384cb6c793072a4f1047dc5cafc2157ee2419f60 | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Templating/TranslatableStringHelper.php#L60-L84 |
17,448 | haldayne/boost | src/MapOfNumerics.php | MapOfNumerics.increment | public function increment($key, $delta = 1)
{
if ($this->has($key)) {
$this->set(
$key,
$this->get($key) + $delta
);
} else {
$this->set($key, $delta);
}
return $this;
} | php | public function increment($key, $delta = 1)
{
if ($this->has($key)) {
$this->set(
$key,
$this->get($key) + $delta
);
} else {
$this->set($key, $delta);
}
return $this;
} | [
"public",
"function",
"increment",
"(",
"$",
"key",
",",
"$",
"delta",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"get",
"(",
"... | Increment the value stored at the given key by the given delta.
@return $this
@since 1.0.3
@api | [
"Increment",
"the",
"value",
"stored",
"at",
"the",
"given",
"key",
"by",
"the",
"given",
"delta",
"."
] | d18cc398557e23f9c316ea7fb40b90f84cc53650 | https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/MapOfNumerics.php#L134-L146 |
17,449 | spiral-modules/scaffolder | source/Scaffolder/Declarations/MigrationDeclaration.php | MigrationDeclaration.declareCreation | public function declareCreation(string $table, array $columns)
{
$source = $this->method('up')->getSource();
$source->addLine("\$this->table('{$table}')");
foreach ($columns as $name => $type) {
$source->addLine(" ->addColumn('{$name}', '{$type}')");
}
$sourc... | php | public function declareCreation(string $table, array $columns)
{
$source = $this->method('up')->getSource();
$source->addLine("\$this->table('{$table}')");
foreach ($columns as $name => $type) {
$source->addLine(" ->addColumn('{$name}', '{$type}')");
}
$sourc... | [
"public",
"function",
"declareCreation",
"(",
"string",
"$",
"table",
",",
"array",
"$",
"columns",
")",
"{",
"$",
"source",
"=",
"$",
"this",
"->",
"method",
"(",
"'up'",
")",
"->",
"getSource",
"(",
")",
";",
"$",
"source",
"->",
"addLine",
"(",
"\... | Declare table creation with specific set of columns
@param string $table
@param array $columns | [
"Declare",
"table",
"creation",
"with",
"specific",
"set",
"of",
"columns"
] | 9be9dd0da6e4b02232db24e797fe5c288afbbddf | https://github.com/spiral-modules/scaffolder/blob/9be9dd0da6e4b02232db24e797fe5c288afbbddf/source/Scaffolder/Declarations/MigrationDeclaration.php#L46-L58 |
17,450 | haldayne/boost | src/MapOfObjects.php | MapOfObjects.apply | public function apply($method, array $args = [])
{
$result = new Map;
$this->walk(function ($object, $key) use ($method, $args, $result) {
$result[$key] = call_user_func_array([$object, $method], $args);
});
return $result;
} | php | public function apply($method, array $args = [])
{
$result = new Map;
$this->walk(function ($object, $key) use ($method, $args, $result) {
$result[$key] = call_user_func_array([$object, $method], $args);
});
return $result;
} | [
"public",
"function",
"apply",
"(",
"$",
"method",
",",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"result",
"=",
"new",
"Map",
";",
"$",
"this",
"->",
"walk",
"(",
"function",
"(",
"$",
"object",
",",
"$",
"key",
")",
"use",
"(",
"$",... | Call the given method on every object in the map, and return the
results as a new map.
@param string $method The method on each contained object to call.
@param array|null $args The arguments to pass to the method.
@return \Haldayne\Boost\Map
@api | [
"Call",
"the",
"given",
"method",
"on",
"every",
"object",
"in",
"the",
"map",
"and",
"return",
"the",
"results",
"as",
"a",
"new",
"map",
"."
] | d18cc398557e23f9c316ea7fb40b90f84cc53650 | https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/MapOfObjects.php#L18-L25 |
17,451 | JoshuaEstes/FeatureToggle | src/JoshuaEstes/Component/FeatureToggle/FeatureContainer.php | FeatureContainer.addFeature | public function addFeature(FeatureInterface $feature)
{
$this->features->set($feature->getKey(), $feature);
return $this;
} | php | public function addFeature(FeatureInterface $feature)
{
$this->features->set($feature->getKey(), $feature);
return $this;
} | [
"public",
"function",
"addFeature",
"(",
"FeatureInterface",
"$",
"feature",
")",
"{",
"$",
"this",
"->",
"features",
"->",
"set",
"(",
"$",
"feature",
"->",
"getKey",
"(",
")",
",",
"$",
"feature",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add a feature to the container
@param FeatureInterface
@return FeatureBag | [
"Add",
"a",
"feature",
"to",
"the",
"container"
] | d93b95b649acce80a6395d97cd165ba733971d84 | https://github.com/JoshuaEstes/FeatureToggle/blob/d93b95b649acce80a6395d97cd165ba733971d84/src/JoshuaEstes/Component/FeatureToggle/FeatureContainer.php#L58-L63 |
17,452 | transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/UserManager.php | UserManager.assignUserToUserGroups | protected function assignUserToUserGroups(User $user, array $userGroupObjects)
{
$ezUserGroups = [];
foreach ($userGroupObjects as $userGroup) {
$userGroup = $this->userGroupManager->createOrUpdate($userGroup);
if ($userGroup instanceof UserGroupObject) {
$ezU... | php | protected function assignUserToUserGroups(User $user, array $userGroupObjects)
{
$ezUserGroups = [];
foreach ($userGroupObjects as $userGroup) {
$userGroup = $this->userGroupManager->createOrUpdate($userGroup);
if ($userGroup instanceof UserGroupObject) {
$ezU... | [
"protected",
"function",
"assignUserToUserGroups",
"(",
"User",
"$",
"user",
",",
"array",
"$",
"userGroupObjects",
")",
"{",
"$",
"ezUserGroups",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"userGroupObjects",
"as",
"$",
"userGroup",
")",
"{",
"$",
"userGroup"... | Assigns a collection of Transfer user groups from an eZ user, and returns the once who were added.
@param User $user
@param UserGroupObject[] $userGroupObjects
@return UserGroup[] | [
"Assigns",
"a",
"collection",
"of",
"Transfer",
"user",
"groups",
"from",
"an",
"eZ",
"user",
"and",
"returns",
"the",
"once",
"who",
"were",
"added",
"."
] | 1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/UserManager.php#L213-L232 |
17,453 | transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/UserManager.php | UserManager.unassignUserFromUserGroups | protected function unassignUserFromUserGroups(User $user, array $userGroups)
{
$existingUserGroups = $this->userService->loadUserGroupsOfUser($user);
foreach ($existingUserGroups as $existingUserGroup) {
if (!array_key_exists($existingUserGroup->id, $userGroups)) {
$this-... | php | protected function unassignUserFromUserGroups(User $user, array $userGroups)
{
$existingUserGroups = $this->userService->loadUserGroupsOfUser($user);
foreach ($existingUserGroups as $existingUserGroup) {
if (!array_key_exists($existingUserGroup->id, $userGroups)) {
$this-... | [
"protected",
"function",
"unassignUserFromUserGroups",
"(",
"User",
"$",
"user",
",",
"array",
"$",
"userGroups",
")",
"{",
"$",
"existingUserGroups",
"=",
"$",
"this",
"->",
"userService",
"->",
"loadUserGroupsOfUser",
"(",
"$",
"user",
")",
";",
"foreach",
"... | Unassigns a collection of eZ UserGroups from an eZ User.
@param User $user
@param UserGroup[] $userGroups | [
"Unassigns",
"a",
"collection",
"of",
"eZ",
"UserGroups",
"from",
"an",
"eZ",
"User",
"."
] | 1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/UserManager.php#L240-L248 |
17,454 | turanct/showpad-api | src/Showpad/Authentication.php | Authentication.request | public function request($method, $endpoint, array $parameters = null)
{
$url = $this->config->getEndpoint() . $endpoint;
// Client should always send OAuth2 tokens in its headers
$headers = array('Authorization' => 'Bearer ' . $this->config->getAccessToken());
return $this->client-... | php | public function request($method, $endpoint, array $parameters = null)
{
$url = $this->config->getEndpoint() . $endpoint;
// Client should always send OAuth2 tokens in its headers
$headers = array('Authorization' => 'Bearer ' . $this->config->getAccessToken());
return $this->client-... | [
"public",
"function",
"request",
"(",
"$",
"method",
",",
"$",
"endpoint",
",",
"array",
"$",
"parameters",
"=",
"null",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"config",
"->",
"getEndpoint",
"(",
")",
".",
"$",
"endpoint",
";",
"// Client should... | Send an authenticated api request
@param string $method The HTTP method
@param string $endpoint The api endpoint to send the request to
@param array $parameters The parameters for the request (assoc array)
return mixed | [
"Send",
"an",
"authenticated",
"api",
"request"
] | 6b17a2bb3609b3696529014911287688b54bea19 | https://github.com/turanct/showpad-api/blob/6b17a2bb3609b3696529014911287688b54bea19/src/Showpad/Authentication.php#L136-L144 |
17,455 | GrafiteInc/Mission-Control-Package | src/IssueService.php | IssueService.log | public function log($message, $flag)
{
$headers = [
'token' => $this->token,
];
$query = $this->processLog($message, $flag);
$response = $this->curl::post($this->missionControlUrl, $headers, $query);
if ($response->code != 200) {
$this->error('Unabl... | php | public function log($message, $flag)
{
$headers = [
'token' => $this->token,
];
$query = $this->processLog($message, $flag);
$response = $this->curl::post($this->missionControlUrl, $headers, $query);
if ($response->code != 200) {
$this->error('Unabl... | [
"public",
"function",
"log",
"(",
"$",
"message",
",",
"$",
"flag",
")",
"{",
"$",
"headers",
"=",
"[",
"'token'",
"=>",
"$",
"this",
"->",
"token",
",",
"]",
";",
"$",
"query",
"=",
"$",
"this",
"->",
"processLog",
"(",
"$",
"message",
",",
"$",... | Send the log to Mission Control
@param string $message
@param string $flag
@return bool | [
"Send",
"the",
"log",
"to",
"Mission",
"Control"
] | 4e85f0b729329783b34e35d90abba2807899ff58 | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/IssueService.php#L60-L75 |
17,456 | GrafiteInc/Mission-Control-Package | src/IssueService.php | IssueService.baseRequest | protected function baseRequest()
{
return [
'report_referer' => $this->server('HTTP_REFERER', ''),
'report_user_agent' => $this->server('HTTP_USER_AGENT', ''),
'report_host' => $this->server('HTTP_HOST', ''),
'report_server_name' => $this->server('SERVER_NAME'... | php | protected function baseRequest()
{
return [
'report_referer' => $this->server('HTTP_REFERER', ''),
'report_user_agent' => $this->server('HTTP_USER_AGENT', ''),
'report_host' => $this->server('HTTP_HOST', ''),
'report_server_name' => $this->server('SERVER_NAME'... | [
"protected",
"function",
"baseRequest",
"(",
")",
"{",
"return",
"[",
"'report_referer'",
"=>",
"$",
"this",
"->",
"server",
"(",
"'HTTP_REFERER'",
",",
"''",
")",
",",
"'report_user_agent'",
"=>",
"$",
"this",
"->",
"server",
"(",
"'HTTP_USER_AGENT'",
",",
... | Collect basic server info
@return array | [
"Collect",
"basic",
"server",
"info"
] | 4e85f0b729329783b34e35d90abba2807899ff58 | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/IssueService.php#L125-L140 |
17,457 | transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Values/ContentTypeObject.php | ContentTypeObject.addFieldDefinitionObject | public function addFieldDefinitionObject($identifier, $fieldDefinition)
{
$this->data['fields'][$identifier] = $this->convertToFieldDefintionObject($identifier, $fieldDefinition);
} | php | public function addFieldDefinitionObject($identifier, $fieldDefinition)
{
$this->data['fields'][$identifier] = $this->convertToFieldDefintionObject($identifier, $fieldDefinition);
} | [
"public",
"function",
"addFieldDefinitionObject",
"(",
"$",
"identifier",
",",
"$",
"fieldDefinition",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'fields'",
"]",
"[",
"$",
"identifier",
"]",
"=",
"$",
"this",
"->",
"convertToFieldDefintionObject",
"(",
"$",
... | Convert parameters to FieldDefinitionObject and stores it on the ContentTypeObject.
@param string $identifier
@param array|FieldDefinitionObject $fieldDefinition | [
"Convert",
"parameters",
"to",
"FieldDefinitionObject",
"and",
"stores",
"it",
"on",
"the",
"ContentTypeObject",
"."
] | 1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Values/ContentTypeObject.php#L69-L72 |
17,458 | transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Values/ContentTypeObject.php | ContentTypeObject.setMissingDefaults | private function setMissingDefaults()
{
if (!isset($this->data['contenttype_groups'])) {
$this->data['contenttype_groups'] = array('Content');
}
if ($this->notSetOrEmpty($this->data, 'names')) {
$this->data['names'] = array(
$this->data['main_language... | php | private function setMissingDefaults()
{
if (!isset($this->data['contenttype_groups'])) {
$this->data['contenttype_groups'] = array('Content');
}
if ($this->notSetOrEmpty($this->data, 'names')) {
$this->data['names'] = array(
$this->data['main_language... | [
"private",
"function",
"setMissingDefaults",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'contenttype_groups'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'contenttype_groups'",
"]",
"=",
"array",
"(",
"'Conten... | Build default values. | [
"Build",
"default",
"values",
"."
] | 1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Values/ContentTypeObject.php#L77-L94 |
17,459 | maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/Competitions.php | Competitions.removeTeam | function removeTeam($competitionId, $teamId)
{
if(!$competitionId)
{
throw new Exception('Invalid competitionId');
}
if(!$teamId)
{
throw new Exception('Invalid teamId');
}
return $this->execute('DELETE', '/competitions/%d/teams/%d/', array($competitionId, $teamId));
} | php | function removeTeam($competitionId, $teamId)
{
if(!$competitionId)
{
throw new Exception('Invalid competitionId');
}
if(!$teamId)
{
throw new Exception('Invalid teamId');
}
return $this->execute('DELETE', '/competitions/%d/teams/%d/', array($competitionId, $teamId));
} | [
"function",
"removeTeam",
"(",
"$",
"competitionId",
",",
"$",
"teamId",
")",
"{",
"if",
"(",
"!",
"$",
"competitionId",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Invalid competitionId'",
")",
";",
"}",
"if",
"(",
"!",
"$",
"teamId",
")",
"{",
"thr... | Works only during the registration phase
@param int $competitionId
@param int $teamId
@return type
@throws Exception | [
"Works",
"only",
"during",
"the",
"registration",
"phase"
] | 027a458388035fe66f2f56ff3ea1f85eff2a5a4e | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/Competitions.php#L68-L80 |
17,460 | maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/Competitions.php | Competitions.registerResults | function registerResults($competitionId, array $results)
{
if(!$competitionId)
{
throw new Exception;
}
if(!$results)
{
throw new Exception;
}
return $this->execute('POST', '/competitions/%d/results/', array($competitionId, array($results)));
} | php | function registerResults($competitionId, array $results)
{
if(!$competitionId)
{
throw new Exception;
}
if(!$results)
{
throw new Exception;
}
return $this->execute('POST', '/competitions/%d/results/', array($competitionId, array($results)));
} | [
"function",
"registerResults",
"(",
"$",
"competitionId",
",",
"array",
"$",
"results",
")",
"{",
"if",
"(",
"!",
"$",
"competitionId",
")",
"{",
"throw",
"new",
"Exception",
";",
"}",
"if",
"(",
"!",
"$",
"results",
")",
"{",
"throw",
"new",
"Exceptio... | Register final results of your competition
@param int $competitionId
@param array $results results should be an array with numeric keys from 1 to n, with the team ids as value | [
"Register",
"final",
"results",
"of",
"your",
"competition"
] | 027a458388035fe66f2f56ff3ea1f85eff2a5a4e | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/Competitions.php#L169-L180 |
17,461 | comodojo/cookies | src/Comodojo/Cookies/CookieManager.php | CookieManager.del | public function del($cookie) {
if ( empty($cookie) ) throw new CookieException("Invalid cookie object or name");
$name = ($cookie instanceof CookieInterface) ? $cookie->getName() : $cookie;
if ( $this->isRegistered($name) ) {
unset($this->cookies[$name]);
} else {
... | php | public function del($cookie) {
if ( empty($cookie) ) throw new CookieException("Invalid cookie object or name");
$name = ($cookie instanceof CookieInterface) ? $cookie->getName() : $cookie;
if ( $this->isRegistered($name) ) {
unset($this->cookies[$name]);
} else {
... | [
"public",
"function",
"del",
"(",
"$",
"cookie",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"cookie",
")",
")",
"throw",
"new",
"CookieException",
"(",
"\"Invalid cookie object or name\"",
")",
";",
"$",
"name",
"=",
"(",
"$",
"cookie",
"instanceof",
"CookieI... | Delete a cookie from the stack
@param CookieInterface|string $cookie
@return CookieManager
@throws CookieException | [
"Delete",
"a",
"cookie",
"from",
"the",
"stack"
] | a81c7dff37d52c1a75462c0ad30db75d0c3b0081 | https://github.com/comodojo/cookies/blob/a81c7dff37d52c1a75462c0ad30db75d0c3b0081/src/Comodojo/Cookies/CookieManager.php#L69-L83 |
17,462 | comodojo/cookies | src/Comodojo/Cookies/CookieManager.php | CookieManager.has | public function has($cookie) {
if ( empty($cookie) ) throw new CookieException("Invalid cookie object or name");
$name = ($cookie instanceof CookieInterface) ? $cookie->getName() : $cookie;
return array_key_exists($name, $this->cookies);
} | php | public function has($cookie) {
if ( empty($cookie) ) throw new CookieException("Invalid cookie object or name");
$name = ($cookie instanceof CookieInterface) ? $cookie->getName() : $cookie;
return array_key_exists($name, $this->cookies);
} | [
"public",
"function",
"has",
"(",
"$",
"cookie",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"cookie",
")",
")",
"throw",
"new",
"CookieException",
"(",
"\"Invalid cookie object or name\"",
")",
";",
"$",
"name",
"=",
"(",
"$",
"cookie",
"instanceof",
"CookieI... | Check if a cookie is into the stack
@param CookieInterface|string $cookie
@return CookieManager
@throws CookieException | [
"Check",
"if",
"a",
"cookie",
"is",
"into",
"the",
"stack"
] | a81c7dff37d52c1a75462c0ad30db75d0c3b0081 | https://github.com/comodojo/cookies/blob/a81c7dff37d52c1a75462c0ad30db75d0c3b0081/src/Comodojo/Cookies/CookieManager.php#L108-L116 |
17,463 | comodojo/cookies | src/Comodojo/Cookies/CookieManager.php | CookieManager.getValues | public function getValues() {
$cookies = [];
try {
foreach ( $this->cookies as $name => $cookie ) {
$cookies[$name] = $cookie->getValue();
}
} catch (CookieException $ce) {
throw $ce;
}
return $cookies... | php | public function getValues() {
$cookies = [];
try {
foreach ( $this->cookies as $name => $cookie ) {
$cookies[$name] = $cookie->getValue();
}
} catch (CookieException $ce) {
throw $ce;
}
return $cookies... | [
"public",
"function",
"getValues",
"(",
")",
"{",
"$",
"cookies",
"=",
"[",
"]",
";",
"try",
"{",
"foreach",
"(",
"$",
"this",
"->",
"cookies",
"as",
"$",
"name",
"=>",
"$",
"cookie",
")",
"{",
"$",
"cookies",
"[",
"$",
"name",
"]",
"=",
"$",
"... | Get values from all registered cookies and dump as an associative array
@return array
@throws CookieException | [
"Get",
"values",
"from",
"all",
"registered",
"cookies",
"and",
"dump",
"as",
"an",
"associative",
"array"
] | a81c7dff37d52c1a75462c0ad30db75d0c3b0081 | https://github.com/comodojo/cookies/blob/a81c7dff37d52c1a75462c0ad30db75d0c3b0081/src/Comodojo/Cookies/CookieManager.php#L168-L188 |
17,464 | comodojo/cookies | src/Comodojo/Cookies/CookieManager.php | CookieManager.save | public function save() {
try {
foreach ( $this->cookies as $c ) {
$c->save();
}
} catch (CookieException $ce) {
throw $ce;
}
return true;
} | php | public function save() {
try {
foreach ( $this->cookies as $c ) {
$c->save();
}
} catch (CookieException $ce) {
throw $ce;
}
return true;
} | [
"public",
"function",
"save",
"(",
")",
"{",
"try",
"{",
"foreach",
"(",
"$",
"this",
"->",
"cookies",
"as",
"$",
"c",
")",
"{",
"$",
"c",
"->",
"save",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"CookieException",
"$",
"ce",
")",
"{",
"throw",
"$"... | Save all registered cookies
@return CookieManager
@throws CookieException | [
"Save",
"all",
"registered",
"cookies"
] | a81c7dff37d52c1a75462c0ad30db75d0c3b0081 | https://github.com/comodojo/cookies/blob/a81c7dff37d52c1a75462c0ad30db75d0c3b0081/src/Comodojo/Cookies/CookieManager.php#L196-L214 |
17,465 | comodojo/cookies | src/Comodojo/Cookies/CookieManager.php | CookieManager.load | public function load() {
try {
foreach ( $this->cookies as $c ) {
$c->load();
}
} catch (CookieException $ce) {
throw $ce;
}
return $this;
} | php | public function load() {
try {
foreach ( $this->cookies as $c ) {
$c->load();
}
} catch (CookieException $ce) {
throw $ce;
}
return $this;
} | [
"public",
"function",
"load",
"(",
")",
"{",
"try",
"{",
"foreach",
"(",
"$",
"this",
"->",
"cookies",
"as",
"$",
"c",
")",
"{",
"$",
"c",
"->",
"load",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"CookieException",
"$",
"ce",
")",
"{",
"throw",
"$"... | Load all registered cookies
@return CookieManager
@throws CookieException | [
"Load",
"all",
"registered",
"cookies"
] | a81c7dff37d52c1a75462c0ad30db75d0c3b0081 | https://github.com/comodojo/cookies/blob/a81c7dff37d52c1a75462c0ad30db75d0c3b0081/src/Comodojo/Cookies/CookieManager.php#L222-L240 |
17,466 | nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Entry.php | Zend_Feed_Builder_Entry.addCategory | public function addCategory(array $category)
{
if (empty($category['term'])) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to define the name of the cat... | php | public function addCategory(array $category)
{
if (empty($category['term'])) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to define the name of the cat... | [
"public",
"function",
"addCategory",
"(",
"array",
"$",
"category",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"category",
"[",
"'term'",
"]",
")",
")",
"{",
"/**\n * @see Zend_Feed_Builder_Exception\n */",
"require_once",
"'Zend/Feed/Builder/Except... | Add a category to the entry
@param array $category see Zend_Feed_Builder_Entry::setCategories() for format
@return Zend_Feed_Builder_Entry
@throws Zend_Feed_Builder_Exception | [
"Add",
"a",
"category",
"to",
"the",
"entry"
] | 1c6da8c56ef717225ff904e1522aff94ed051601 | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Entry.php#L221-L239 |
17,467 | nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Entry.php | Zend_Feed_Builder_Entry.addEnclosure | public function addEnclosure($url, $type = '', $length = '')
{
if (!$this->offsetExists('enclosure')) {
$enclosure = array();
} else {
$enclosure = $this->offsetGet('enclosure');
}
$enclosure[] = array('url' => $url,
'type' => $typ... | php | public function addEnclosure($url, $type = '', $length = '')
{
if (!$this->offsetExists('enclosure')) {
$enclosure = array();
} else {
$enclosure = $this->offsetGet('enclosure');
}
$enclosure[] = array('url' => $url,
'type' => $typ... | [
"public",
"function",
"addEnclosure",
"(",
"$",
"url",
",",
"$",
"type",
"=",
"''",
",",
"$",
"length",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"offsetExists",
"(",
"'enclosure'",
")",
")",
"{",
"$",
"enclosure",
"=",
"array",
"(",
... | Add an enclosure to the entry
@param string $url
@param string $type
@param string $length
@return Zend_Feed_Builder_Entry | [
"Add",
"an",
"enclosure",
"to",
"the",
"entry"
] | 1c6da8c56ef717225ff904e1522aff94ed051601 | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Entry.php#L284-L296 |
17,468 | Double-Opt-in/php-client-api | src/Client/Commands/Responses/CommandResponse.php | CommandResponse.all | public function all()
{
$result = array();
$data = $this->data();
if ( ! is_array($data))
$data = array($data);
foreach ($data as $entry) {
$result[] = $this->resolveActionFromStdClass($entry);
}
return $result;
} | php | public function all()
{
$result = array();
$data = $this->data();
if ( ! is_array($data))
$data = array($data);
foreach ($data as $entry) {
$result[] = $this->resolveActionFromStdClass($entry);
}
return $result;
} | [
"public",
"function",
"all",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"data",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"$",
"data",
"=",
"array",
"(",
"$",
... | returns a list of all actions
@return array|Action[] | [
"returns",
"a",
"list",
"of",
"all",
"actions"
] | 2f17da58ec20a408bbd55b2cdd053bc689f995f4 | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Client/Commands/Responses/CommandResponse.php#L20-L33 |
17,469 | Double-Opt-in/php-client-api | src/Client/Commands/Responses/CommandResponse.php | CommandResponse.action | public function action()
{
$action = $this->data();
if ( ! $action instanceof stdClass)
return null;
return $this->resolveActionFromStdClass($action);
} | php | public function action()
{
$action = $this->data();
if ( ! $action instanceof stdClass)
return null;
return $this->resolveActionFromStdClass($action);
} | [
"public",
"function",
"action",
"(",
")",
"{",
"$",
"action",
"=",
"$",
"this",
"->",
"data",
"(",
")",
";",
"if",
"(",
"!",
"$",
"action",
"instanceof",
"stdClass",
")",
"return",
"null",
";",
"return",
"$",
"this",
"->",
"resolveActionFromStdClass",
... | returns the action or null
@return Action|null | [
"returns",
"the",
"action",
"or",
"null"
] | 2f17da58ec20a408bbd55b2cdd053bc689f995f4 | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Client/Commands/Responses/CommandResponse.php#L40-L48 |
17,470 | spiral-modules/auth | source/Auth/Operators/SessionOperator.php | SessionOperator.sessionSection | protected function sessionSection(Request $request): SectionInterface
{
if (empty($request->getAttribute(SessionStarter::ATTRIBUTE))) {
throw new AuthException("Unable to use authorization thought session, no session exists");
}
/** @var SessionInterface $session */
$ses... | php | protected function sessionSection(Request $request): SectionInterface
{
if (empty($request->getAttribute(SessionStarter::ATTRIBUTE))) {
throw new AuthException("Unable to use authorization thought session, no session exists");
}
/** @var SessionInterface $session */
$ses... | [
"protected",
"function",
"sessionSection",
"(",
"Request",
"$",
"request",
")",
":",
"SectionInterface",
"{",
"if",
"(",
"empty",
"(",
"$",
"request",
"->",
"getAttribute",
"(",
"SessionStarter",
"::",
"ATTRIBUTE",
")",
")",
")",
"{",
"throw",
"new",
"AuthEx... | Get session section from given request.
@param Request $request
@return SectionInterface
@throws AuthException When no session is started. | [
"Get",
"session",
"section",
"from",
"given",
"request",
"."
] | 24e2070028f7257e8192914556963a4794428a99 | https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Operators/SessionOperator.php#L121-L131 |
17,471 | yuncms/framework | src/db/ActiveRecord.php | ActiveRecord.toJson | public function toJson(array $fields = [], array $expand = [], $recursive = true)
{
return Json::encode($this->toArray($fields, $expand, $recursive));
} | php | public function toJson(array $fields = [], array $expand = [], $recursive = true)
{
return Json::encode($this->toArray($fields, $expand, $recursive));
} | [
"public",
"function",
"toJson",
"(",
"array",
"$",
"fields",
"=",
"[",
"]",
",",
"array",
"$",
"expand",
"=",
"[",
"]",
",",
"$",
"recursive",
"=",
"true",
")",
"{",
"return",
"Json",
"::",
"encode",
"(",
"$",
"this",
"->",
"toArray",
"(",
"$",
"... | Converts the model into an json.
This method will first identify which fields to be included in the resulting array by calling [[resolveFields()]].
If the model implements the [[Linkable]] interface, the resulting json will also have a `_link` element
which refers to a list of links as specified by the interface.
@pa... | [
"Converts",
"the",
"model",
"into",
"an",
"json",
"."
] | af42e28ea4ae15ab8eead3f6d119f93863b94154 | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/db/ActiveRecord.php#L49-L52 |
17,472 | ClanCats/Core | src/classes/CCConfig.php | CCConfig.create | public static function create( $name = null, $driver = 'file' )
{
if ( is_null( $name ) )
{
return new static( null, $driver );
}
if ( !isset( static::$instances[$name] ) )
{
static::$instances[$name] = new static( $name, $driver );
}
return static::$instances[$name];
} | php | public static function create( $name = null, $driver = 'file' )
{
if ( is_null( $name ) )
{
return new static( null, $driver );
}
if ( !isset( static::$instances[$name] ) )
{
static::$instances[$name] = new static( $name, $driver );
}
return static::$instances[$name];
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"driver",
"=",
"'file'",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"name",
")",
")",
"{",
"return",
"new",
"static",
"(",
"null",
",",
"$",
"driver",
")",
";",
"}"... | Create a configuration instance
@param string $name
@return CCConfig | [
"Create",
"a",
"configuration",
"instance"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCConfig.php#L28-L41 |
17,473 | ClanCats/Core | src/classes/CCConfig.php | CCConfig.driver | public function driver( $driver )
{
$driver = CCCORE_NAMESPACE.'\\'.'CCConfig_'.ucfirst( $driver );
if ( !class_exists( $driver ) )
{
throw new \InvalidArgumentException("CCConfig - Invalid driver '".$driver."'");
}
$this->_driver = new $driver;
} | php | public function driver( $driver )
{
$driver = CCCORE_NAMESPACE.'\\'.'CCConfig_'.ucfirst( $driver );
if ( !class_exists( $driver ) )
{
throw new \InvalidArgumentException("CCConfig - Invalid driver '".$driver."'");
}
$this->_driver = new $driver;
} | [
"public",
"function",
"driver",
"(",
"$",
"driver",
")",
"{",
"$",
"driver",
"=",
"CCCORE_NAMESPACE",
".",
"'\\\\'",
".",
"'CCConfig_'",
".",
"ucfirst",
"(",
"$",
"driver",
")",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"driver",
")",
")",
"{",
... | Set the configuration dirver
@param string $driver
@return void | [
"Set",
"the",
"configuration",
"dirver"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCConfig.php#L77-L87 |
17,474 | ClanCats/Core | src/classes/CCConfig.php | CCConfig.name | public function name( $name = null )
{
if ( is_null( $name ) )
{
return $this->_instance_name;
}
$this->_instance_name = $name;
} | php | public function name( $name = null )
{
if ( is_null( $name ) )
{
return $this->_instance_name;
}
$this->_instance_name = $name;
} | [
"public",
"function",
"name",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_instance_name",
";",
"}",
"$",
"this",
"->",
"_instance_name",
"=",
"$",
"name",
";",
"}"
] | Name getter and setter
@param string $name
@return string | [
"Name",
"getter",
"and",
"setter"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCConfig.php#L95-L103 |
17,475 | ClanCats/Core | src/classes/CCConfig.php | CCConfig.write | public function write( $driver = null )
{
if ( empty( $this->_instance_name ) )
{
throw new CCException("CCConfig::write - configuration name is missing.");
}
// set the dirver
if ( !is_null( $driver ) )
{
$this->driver( $driver );
}
// run write
$this->_driver->write( $this->_instance... | php | public function write( $driver = null )
{
if ( empty( $this->_instance_name ) )
{
throw new CCException("CCConfig::write - configuration name is missing.");
}
// set the dirver
if ( !is_null( $driver ) )
{
$this->driver( $driver );
}
// run write
$this->_driver->write( $this->_instance... | [
"public",
"function",
"write",
"(",
"$",
"driver",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_instance_name",
")",
")",
"{",
"throw",
"new",
"CCException",
"(",
"\"CCConfig::write - configuration name is missing.\"",
")",
";",
"}",
... | save a configuration file
this method overwrites your configuration file!!
@param string $name
@return bool | [
"save",
"a",
"configuration",
"file",
"this",
"method",
"overwrites",
"your",
"configuration",
"file!!"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCConfig.php#L124-L139 |
17,476 | ClanCats/Core | src/classes/CCConfig.php | CCConfig._delete | public function _delete()
{
if ( empty( $this->_instance_name ) )
{
throw new CCException("CCConfig::write - configuration name is missing.");
}
return $this->_driver->delete( $this->_instance_name );
} | php | public function _delete()
{
if ( empty( $this->_instance_name ) )
{
throw new CCException("CCConfig::write - configuration name is missing.");
}
return $this->_driver->delete( $this->_instance_name );
} | [
"public",
"function",
"_delete",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_instance_name",
")",
")",
"{",
"throw",
"new",
"CCException",
"(",
"\"CCConfig::write - configuration name is missing.\"",
")",
";",
"}",
"return",
"$",
"this",
"->",... | Delete the entire configuration
Attention with this one he can be evil!
@param string $name
@return void | [
"Delete",
"the",
"entire",
"configuration",
"Attention",
"with",
"this",
"one",
"he",
"can",
"be",
"evil!"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCConfig.php#L148-L156 |
17,477 | dashifen/wordpress-php7-plugin-boilerplate | src/Controller/ControllerTraits/TaxonomiesTrait.php | TaxonomiesTrait.initTaxonomiesTrait | final protected function initTaxonomiesTrait(): void {
// notice that this action is added at the 15th priority. since
// taxonomies and post types are used in conjuction with each other,
// we want to be sure that our types are registered before we start
// to link taxonomies to them. so, the PostTypesTra... | php | final protected function initTaxonomiesTrait(): void {
// notice that this action is added at the 15th priority. since
// taxonomies and post types are used in conjuction with each other,
// we want to be sure that our types are registered before we start
// to link taxonomies to them. so, the PostTypesTra... | [
"final",
"protected",
"function",
"initTaxonomiesTrait",
"(",
")",
":",
"void",
"{",
"// notice that this action is added at the 15th priority. since",
"// taxonomies and post types are used in conjuction with each other,",
"// we want to be sure that our types are registered before we start"... | Initializes this trait and registers these taxonomies using the
appropriate WordPress action hook.
@return void | [
"Initializes",
"this",
"trait",
"and",
"registers",
"these",
"taxonomies",
"using",
"the",
"appropriate",
"WordPress",
"action",
"hook",
"."
] | c7875deb403d311efca72dc3c8beb566972a56cb | https://github.com/dashifen/wordpress-php7-plugin-boilerplate/blob/c7875deb403d311efca72dc3c8beb566972a56cb/src/Controller/ControllerTraits/TaxonomiesTrait.php#L84-L98 |
17,478 | flipboxstudio/orm-manager | src/Flipbox/OrmManager/Relations/HasManyThrough.php | HasManyThrough.beforeApplyOptions | protected function beforeApplyOptions($stub)
{
$refModel = new ReflectionClass($this->model);
$refIntermeidateModel = new ReflectionClass($this->defaultOptions['intermediate_model']);
$model = $refIntermeidateModel->getShortName();
if ($refModel->getNamespaceName() !== $refIntermeidateModel->getNamespace... | php | protected function beforeApplyOptions($stub)
{
$refModel = new ReflectionClass($this->model);
$refIntermeidateModel = new ReflectionClass($this->defaultOptions['intermediate_model']);
$model = $refIntermeidateModel->getShortName();
if ($refModel->getNamespaceName() !== $refIntermeidateModel->getNamespace... | [
"protected",
"function",
"beforeApplyOptions",
"(",
"$",
"stub",
")",
"{",
"$",
"refModel",
"=",
"new",
"ReflectionClass",
"(",
"$",
"this",
"->",
"model",
")",
";",
"$",
"refIntermeidateModel",
"=",
"new",
"ReflectionClass",
"(",
"$",
"this",
"->",
"default... | replace more before apply options code
@param string $stub
@return string | [
"replace",
"more",
"before",
"apply",
"options",
"code"
] | 4288426517f53d05177b8729c4ba94c5beca9a98 | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Relations/HasManyThrough.php#L147-L159 |
17,479 | barebone-php/barebone-core | lib/Session.php | Session.instance | public static function instance()
{
if (null === self::$_instance) {
$session_factory = new SessionFactory;
$session = $session_factory->newInstance($_COOKIE);
$segment = $session->getSegment('Barebone\Session');
self::$_instance = $segment;
}
... | php | public static function instance()
{
if (null === self::$_instance) {
$session_factory = new SessionFactory;
$session = $session_factory->newInstance($_COOKIE);
$segment = $session->getSegment('Barebone\Session');
self::$_instance = $segment;
}
... | [
"public",
"static",
"function",
"instance",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"self",
"::",
"$",
"_instance",
")",
"{",
"$",
"session_factory",
"=",
"new",
"SessionFactory",
";",
"$",
"session",
"=",
"$",
"session_factory",
"->",
"newInstance",
"(",... | Instantiate Session Segment
@return Segment | [
"Instantiate",
"Session",
"Segment"
] | 7fda3a62d5fa103cdc4d2d34e1adf8f3ccbfe2bc | https://github.com/barebone-php/barebone-core/blob/7fda3a62d5fa103cdc4d2d34e1adf8f3ccbfe2bc/lib/Session.php#L46-L56 |
17,480 | CakeCMS/Core | src/Theme.php | Theme.setup | public static function setup($prefix = null)
{
$theme = self::name($prefix);
$path = self::find($theme);
if ($path !== null) {
$config = self::getData($theme, 'meta');
if ($config->get('type') == 'theme') {
return $theme;
}
}
... | php | public static function setup($prefix = null)
{
$theme = self::name($prefix);
$path = self::find($theme);
if ($path !== null) {
$config = self::getData($theme, 'meta');
if ($config->get('type') == 'theme') {
return $theme;
}
}
... | [
"public",
"static",
"function",
"setup",
"(",
"$",
"prefix",
"=",
"null",
")",
"{",
"$",
"theme",
"=",
"self",
"::",
"name",
"(",
"$",
"prefix",
")",
";",
"$",
"path",
"=",
"self",
"::",
"find",
"(",
"$",
"theme",
")",
";",
"if",
"(",
"$",
"pat... | Setup current theme.
@param null|string $prefix
@return null|string | [
"Setup",
"current",
"theme",
"."
] | f9cba7aa0043a10e5c35bd45fbad158688a09a96 | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Theme.php#L36-L49 |
17,481 | CakeCMS/Core | src/Theme.php | Theme.find | public static function find($theme)
{
$paths = App::path('Plugin');
foreach ($paths as $path) {
$path = FS::clean($path . '/', DS);
$themeFolder = $path . $theme;
if (FS::isDir($themeFolder)) {
return $themeFolder;
}
}
... | php | public static function find($theme)
{
$paths = App::path('Plugin');
foreach ($paths as $path) {
$path = FS::clean($path . '/', DS);
$themeFolder = $path . $theme;
if (FS::isDir($themeFolder)) {
return $themeFolder;
}
}
... | [
"public",
"static",
"function",
"find",
"(",
"$",
"theme",
")",
"{",
"$",
"paths",
"=",
"App",
"::",
"path",
"(",
"'Plugin'",
")",
";",
"foreach",
"(",
"$",
"paths",
"as",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"FS",
"::",
"clean",
"(",
"$",
... | Find theme plugin in path.
@param string $theme
@return null|string | [
"Find",
"theme",
"plugin",
"in",
"path",
"."
] | f9cba7aa0043a10e5c35bd45fbad158688a09a96 | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Theme.php#L68-L81 |
17,482 | PortaText/php-sdk | src/PortaText/Client/Curl.php | Curl.assertCurlResult | private function assertCurlResult($curl, $result, $descriptor)
{
if ($result === false) {
$error = curl_error($curl);
@curl_close($curl);
throw new RequestError($error, $descriptor);
}
@curl_close($curl);
return $result;
} | php | private function assertCurlResult($curl, $result, $descriptor)
{
if ($result === false) {
$error = curl_error($curl);
@curl_close($curl);
throw new RequestError($error, $descriptor);
}
@curl_close($curl);
return $result;
} | [
"private",
"function",
"assertCurlResult",
"(",
"$",
"curl",
",",
"$",
"result",
",",
"$",
"descriptor",
")",
"{",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
"$",
"error",
"=",
"curl_error",
"(",
"$",
"curl",
")",
";",
"@",
"curl_close",
"("... | Asserts that the curl result was successful.
@param resource $curl The curl resource.
@param mixed $result The result.
@param PortaText\Command\Descriptor $descriptor Command descriptor.
@return mixed
@throws PortaText\Exception\RequestError | [
"Asserts",
"that",
"the",
"curl",
"result",
"was",
"successful",
"."
] | dbe04ef043db5b251953f9de57aa4d0f1785dfcc | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Client/Curl.php#L119-L128 |
17,483 | PortaText/php-sdk | src/PortaText/Client/Curl.php | Curl.parseHeader | private function parseHeader($header)
{
list($key, $value) = explode(": ", trim($header), 2);
return array(strtolower($key), $value);
} | php | private function parseHeader($header)
{
list($key, $value) = explode(": ", trim($header), 2);
return array(strtolower($key), $value);
} | [
"private",
"function",
"parseHeader",
"(",
"$",
"header",
")",
"{",
"list",
"(",
"$",
"key",
",",
"$",
"value",
")",
"=",
"explode",
"(",
"\": \"",
",",
"trim",
"(",
"$",
"header",
")",
",",
"2",
")",
";",
"return",
"array",
"(",
"strtolower",
"(",... | Parses an HTTP header line.
@param string $header The HTTP header line.
@return array | [
"Parses",
"an",
"HTTP",
"header",
"line",
"."
] | dbe04ef043db5b251953f9de57aa4d0f1785dfcc | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Client/Curl.php#L149-L153 |
17,484 | PortaText/php-sdk | src/PortaText/Client/Curl.php | Curl.openFile | private function openFile($file, $mode)
{
$handle = @fopen($file, $mode);
if ($handle === false) {
throw new \InvalidArgumentException("Could not open $file");
}
return $handle;
} | php | private function openFile($file, $mode)
{
$handle = @fopen($file, $mode);
if ($handle === false) {
throw new \InvalidArgumentException("Could not open $file");
}
return $handle;
} | [
"private",
"function",
"openFile",
"(",
"$",
"file",
",",
"$",
"mode",
")",
"{",
"$",
"handle",
"=",
"@",
"fopen",
"(",
"$",
"file",
",",
"$",
"mode",
")",
";",
"if",
"(",
"$",
"handle",
"===",
"false",
")",
"{",
"throw",
"new",
"\\",
"InvalidArg... | Opens a file and returns a file handle.
@param string $file The filename.
@param string $mode The mode.
@return resource|false | [
"Opens",
"a",
"file",
"and",
"returns",
"a",
"file",
"handle",
"."
] | dbe04ef043db5b251953f9de57aa4d0f1785dfcc | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Client/Curl.php#L163-L170 |
17,485 | simple-php-mvc/simple-php-mvc | src/MVC/Application/Container.php | Container.getRoute | public function getRoute($name)
{
if (!isset($this->routes[$name])) {
throw new \LogicException(sprintf('Route "%s" not found.', $name));
}
return $this->routes[$name];
} | php | public function getRoute($name)
{
if (!isset($this->routes[$name])) {
throw new \LogicException(sprintf('Route "%s" not found.', $name));
}
return $this->routes[$name];
} | [
"public",
"function",
"getRoute",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"routes",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'Route \"%s\" not found.'",
","... | Get Route from name
@param string $name
@return Route
@throws \LogicException | [
"Get",
"Route",
"from",
"name"
] | e319eb09d29afad6993acb4a7e35f32a87dd0841 | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Application/Container.php#L266-L273 |
17,486 | simple-php-mvc/simple-php-mvc | src/MVC/Application/Container.php | Container.getSetting | public function getSetting($name)
{
if (!isset($this->settings[$name])) {
throw new \LogicException(sprintf('The setting "%s" don\'t exists.', $name));
}
return $this->settings[$name];
} | php | public function getSetting($name)
{
if (!isset($this->settings[$name])) {
throw new \LogicException(sprintf('The setting "%s" don\'t exists.', $name));
}
return $this->settings[$name];
} | [
"public",
"function",
"getSetting",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"settings",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'The setting \"%s\" don\\'t e... | Set setting from name
@param string $name
@return mixed
@throws \LogicException | [
"Set",
"setting",
"from",
"name"
] | e319eb09d29afad6993acb4a7e35f32a87dd0841 | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Application/Container.php#L292-L298 |
17,487 | Articus/DataTransfer | src/Articus/DataTransfer/Metadata/Reader/Annotation.php | Annotation.getMetadata | public function getMetadata($className, $subset)
{
$classMetadataCacheKey = $this->getClassMetadataCacheKey($className);
$classMetadata = $this->cacheStorage->getItem($classMetadataCacheKey);
if ($classMetadata === null)
{
$classMetadata = $this->readClassMetadata($className);
$this->cacheStorage->addIte... | php | public function getMetadata($className, $subset)
{
$classMetadataCacheKey = $this->getClassMetadataCacheKey($className);
$classMetadata = $this->cacheStorage->getItem($classMetadataCacheKey);
if ($classMetadata === null)
{
$classMetadata = $this->readClassMetadata($className);
$this->cacheStorage->addIte... | [
"public",
"function",
"getMetadata",
"(",
"$",
"className",
",",
"$",
"subset",
")",
"{",
"$",
"classMetadataCacheKey",
"=",
"$",
"this",
"->",
"getClassMetadataCacheKey",
"(",
"$",
"className",
")",
";",
"$",
"classMetadata",
"=",
"$",
"this",
"->",
"cacheS... | Returns metadata for specified subset of class fields
@param string $className
@param string $subset
@return DT\Metadata | [
"Returns",
"metadata",
"for",
"specified",
"subset",
"of",
"class",
"fields"
] | c119666fa042f7e9f311c3bc1e9a1d0468b9992d | https://github.com/Articus/DataTransfer/blob/c119666fa042f7e9f311c3bc1e9a1d0468b9992d/src/Articus/DataTransfer/Metadata/Reader/Annotation.php#L30-L53 |
17,488 | Articus/DataTransfer | src/Articus/DataTransfer/Metadata/Reader/Annotation.php | Annotation.readPropertyAnnotations | protected static function readPropertyAnnotations(\ReflectionProperty &$property, AnnotationReader &$reader)
{
$dataMap = [];
$strategyMap = [];
$validatorsMap = [];
foreach ($reader->getPropertyAnnotations($property) as $annotation)
{
switch (true)
{
case ($annotation instanceof DT\Annotation\Data... | php | protected static function readPropertyAnnotations(\ReflectionProperty &$property, AnnotationReader &$reader)
{
$dataMap = [];
$strategyMap = [];
$validatorsMap = [];
foreach ($reader->getPropertyAnnotations($property) as $annotation)
{
switch (true)
{
case ($annotation instanceof DT\Annotation\Data... | [
"protected",
"static",
"function",
"readPropertyAnnotations",
"(",
"\\",
"ReflectionProperty",
"&",
"$",
"property",
",",
"AnnotationReader",
"&",
"$",
"reader",
")",
"{",
"$",
"dataMap",
"=",
"[",
"]",
";",
"$",
"strategyMap",
"=",
"[",
"]",
";",
"$",
"va... | Reads and groups up annotations for specified property
@param \ReflectionProperty $property
@param AnnotationReader $reader
@return \Generator | [
"Reads",
"and",
"groups",
"up",
"annotations",
"for",
"specified",
"property"
] | c119666fa042f7e9f311c3bc1e9a1d0468b9992d | https://github.com/Articus/DataTransfer/blob/c119666fa042f7e9f311c3bc1e9a1d0468b9992d/src/Articus/DataTransfer/Metadata/Reader/Annotation.php#L158-L184 |
17,489 | Articus/DataTransfer | src/Articus/DataTransfer/Metadata/Reader/Annotation.php | Annotation.isValidGetter | protected static function isValidGetter(\ReflectionClass &$reflection, $name)
{
if (!$reflection->hasMethod($name))
{
throw new \LogicException(
sprintf('Invalid metadata for %s: no getter %s.', $reflection->getName(), $name)
);
}
$getter = $reflection->getMethod($name);
if (!$getter->isPublic())
... | php | protected static function isValidGetter(\ReflectionClass &$reflection, $name)
{
if (!$reflection->hasMethod($name))
{
throw new \LogicException(
sprintf('Invalid metadata for %s: no getter %s.', $reflection->getName(), $name)
);
}
$getter = $reflection->getMethod($name);
if (!$getter->isPublic())
... | [
"protected",
"static",
"function",
"isValidGetter",
"(",
"\\",
"ReflectionClass",
"&",
"$",
"reflection",
",",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"reflection",
"->",
"hasMethod",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicExcep... | Validates if class has valid getter method with specified name
@param \ReflectionClass $reflection
@param string $name
@return bool | [
"Validates",
"if",
"class",
"has",
"valid",
"getter",
"method",
"with",
"specified",
"name"
] | c119666fa042f7e9f311c3bc1e9a1d0468b9992d | https://github.com/Articus/DataTransfer/blob/c119666fa042f7e9f311c3bc1e9a1d0468b9992d/src/Articus/DataTransfer/Metadata/Reader/Annotation.php#L192-L214 |
17,490 | Articus/DataTransfer | src/Articus/DataTransfer/Metadata/Reader/Annotation.php | Annotation.isValidSetter | protected static function isValidSetter(\ReflectionClass &$reflection, $name)
{
if (!$reflection->hasMethod($name))
{
throw new \LogicException(
sprintf('Invalid metadata for %s: no setter %s.', $reflection->getName(), $name)
);
}
$setter = $reflection->getMethod($name);
if (!$setter->isPublic())
... | php | protected static function isValidSetter(\ReflectionClass &$reflection, $name)
{
if (!$reflection->hasMethod($name))
{
throw new \LogicException(
sprintf('Invalid metadata for %s: no setter %s.', $reflection->getName(), $name)
);
}
$setter = $reflection->getMethod($name);
if (!$setter->isPublic())
... | [
"protected",
"static",
"function",
"isValidSetter",
"(",
"\\",
"ReflectionClass",
"&",
"$",
"reflection",
",",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"reflection",
"->",
"hasMethod",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicExcep... | Validates if class has valid setter method with specified name
@param \ReflectionClass $reflection
@param string $name
@return bool | [
"Validates",
"if",
"class",
"has",
"valid",
"setter",
"method",
"with",
"specified",
"name"
] | c119666fa042f7e9f311c3bc1e9a1d0468b9992d | https://github.com/Articus/DataTransfer/blob/c119666fa042f7e9f311c3bc1e9a1d0468b9992d/src/Articus/DataTransfer/Metadata/Reader/Annotation.php#L222-L250 |
17,491 | Articus/DataTransfer | src/Articus/DataTransfer/Validator.php | Validator.validate | public function validate(array $array)
{
$messages = [];
foreach ($this->metadata->fields as $field)
{
$value = array_key_exists($field, $array)? $array[$field] : null;
if (!(($value === null) && $this->metadata->nullables[$field]))
{
$validator = $this->getValidator($field);
if (!$validator->is... | php | public function validate(array $array)
{
$messages = [];
foreach ($this->metadata->fields as $field)
{
$value = array_key_exists($field, $array)? $array[$field] : null;
if (!(($value === null) && $this->metadata->nullables[$field]))
{
$validator = $this->getValidator($field);
if (!$validator->is... | [
"public",
"function",
"validate",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"messages",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"metadata",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"value",
"=",
"array_key_exists",
"(",
"$",... | Validates associative array according metadata
@param array $array
@return array | [
"Validates",
"associative",
"array",
"according",
"metadata"
] | c119666fa042f7e9f311c3bc1e9a1d0468b9992d | https://github.com/Articus/DataTransfer/blob/c119666fa042f7e9f311c3bc1e9a1d0468b9992d/src/Articus/DataTransfer/Validator.php#L70-L91 |
17,492 | Articus/DataTransfer | src/Articus/DataTransfer/Validator.php | Validator.getValidator | protected function getValidator($field)
{
$result = null;
if (isset($this->validators[$field]))
{
$result = $this->validators[$field];
}
else
{
$result = new ValidatorChain();
$result->setPluginManager($this->validatorPluginManager);
if (isset($this->metadata->validators[$field]))
{
fore... | php | protected function getValidator($field)
{
$result = null;
if (isset($this->validators[$field]))
{
$result = $this->validators[$field];
}
else
{
$result = new ValidatorChain();
$result->setPluginManager($this->validatorPluginManager);
if (isset($this->metadata->validators[$field]))
{
fore... | [
"protected",
"function",
"getValidator",
"(",
"$",
"field",
")",
"{",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"validators",
"[",
"$",
"field",
"]",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"validato... | Builds validator chain for specified field according metadata
@param string $field
@return ValidatorInterface | [
"Builds",
"validator",
"chain",
"for",
"specified",
"field",
"according",
"metadata"
] | c119666fa042f7e9f311c3bc1e9a1d0468b9992d | https://github.com/Articus/DataTransfer/blob/c119666fa042f7e9f311c3bc1e9a1d0468b9992d/src/Articus/DataTransfer/Validator.php#L98-L124 |
17,493 | periaptio/empress-generator | src/Generators/ControllerGenerator.php | ControllerGenerator.getTemplatePath | public function getTemplatePath()
{
// get template filename
$useRepositoryLayer = config('generator.use_repository_layer', true);
$useServiceLayer = config('generator.use_service_layer', true);
if ($useServiceLayer && $useRepositoryLayer) {
$templateFilename = 'Controlle... | php | public function getTemplatePath()
{
// get template filename
$useRepositoryLayer = config('generator.use_repository_layer', true);
$useServiceLayer = config('generator.use_service_layer', true);
if ($useServiceLayer && $useRepositoryLayer) {
$templateFilename = 'Controlle... | [
"public",
"function",
"getTemplatePath",
"(",
")",
"{",
"// get template filename",
"$",
"useRepositoryLayer",
"=",
"config",
"(",
"'generator.use_repository_layer'",
",",
"true",
")",
";",
"$",
"useServiceLayer",
"=",
"config",
"(",
"'generator.use_service_layer'",
","... | Get the template path for generate
@return string | [
"Get",
"the",
"template",
"path",
"for",
"generate"
] | 749fb4b12755819e9c97377ebfb446ee0822168a | https://github.com/periaptio/empress-generator/blob/749fb4b12755819e9c97377ebfb446ee0822168a/src/Generators/ControllerGenerator.php#L22-L35 |
17,494 | ConnectHolland/tulip-api-client | src/ResponseParser.php | ResponseParser.getResponseCode | public function getResponseCode()
{
$code = 0;
$dom = $this->getDOMDocument();
$xpath = new DOMXPath($dom);
if (($codeAttribute = $xpath->query('/response/@code')->item(0)) instanceof DOMAttr) {
$code = intval($codeAttribute->nodeValue);
}
return $code;
... | php | public function getResponseCode()
{
$code = 0;
$dom = $this->getDOMDocument();
$xpath = new DOMXPath($dom);
if (($codeAttribute = $xpath->query('/response/@code')->item(0)) instanceof DOMAttr) {
$code = intval($codeAttribute->nodeValue);
}
return $code;
... | [
"public",
"function",
"getResponseCode",
"(",
")",
"{",
"$",
"code",
"=",
"0",
";",
"$",
"dom",
"=",
"$",
"this",
"->",
"getDOMDocument",
"(",
")",
";",
"$",
"xpath",
"=",
"new",
"DOMXPath",
"(",
"$",
"dom",
")",
";",
"if",
"(",
"(",
"$",
"codeAt... | Returns the response code from the API.
@param ResponseInterface $response
@return int | [
"Returns",
"the",
"response",
"code",
"from",
"the",
"API",
"."
] | 641325e2d57c1c272ede7fd8b47d4f2b67b73507 | https://github.com/ConnectHolland/tulip-api-client/blob/641325e2d57c1c272ede7fd8b47d4f2b67b73507/src/ResponseParser.php#L49-L60 |
17,495 | ConnectHolland/tulip-api-client | src/ResponseParser.php | ResponseParser.getErrorMessage | public function getErrorMessage()
{
$errorMessage = '';
$dom = $this->getDOMDocument();
$xpath = new DOMXPath($dom);
if (($errorNode = $xpath->query('/response/error')->item(0)) instanceof DOMNode) {
$errorMessage = $errorNode->nodeValue;
}
return $error... | php | public function getErrorMessage()
{
$errorMessage = '';
$dom = $this->getDOMDocument();
$xpath = new DOMXPath($dom);
if (($errorNode = $xpath->query('/response/error')->item(0)) instanceof DOMNode) {
$errorMessage = $errorNode->nodeValue;
}
return $error... | [
"public",
"function",
"getErrorMessage",
"(",
")",
"{",
"$",
"errorMessage",
"=",
"''",
";",
"$",
"dom",
"=",
"$",
"this",
"->",
"getDOMDocument",
"(",
")",
";",
"$",
"xpath",
"=",
"new",
"DOMXPath",
"(",
"$",
"dom",
")",
";",
"if",
"(",
"(",
"$",
... | Returns the error message from the Tulip API.
@return string | [
"Returns",
"the",
"error",
"message",
"from",
"the",
"Tulip",
"API",
"."
] | 641325e2d57c1c272ede7fd8b47d4f2b67b73507 | https://github.com/ConnectHolland/tulip-api-client/blob/641325e2d57c1c272ede7fd8b47d4f2b67b73507/src/ResponseParser.php#L67-L78 |
17,496 | ConnectHolland/tulip-api-client | src/ResponseParser.php | ResponseParser.getDOMDocument | public function getDOMDocument()
{
if ($this->domDocument instanceof DOMDocument === false) {
$this->domDocument = new DOMDocument('1.0', 'UTF-8');
libxml_clear_errors();
$previousSetting = libxml_use_internal_errors(true);
@$this->domDocument->loadXML($this... | php | public function getDOMDocument()
{
if ($this->domDocument instanceof DOMDocument === false) {
$this->domDocument = new DOMDocument('1.0', 'UTF-8');
libxml_clear_errors();
$previousSetting = libxml_use_internal_errors(true);
@$this->domDocument->loadXML($this... | [
"public",
"function",
"getDOMDocument",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"domDocument",
"instanceof",
"DOMDocument",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"domDocument",
"=",
"new",
"DOMDocument",
"(",
"'1.0'",
",",
"'UTF-8'",
")",
";",
... | Returns the response body as DOMDocument instance.
@return DOMDocument | [
"Returns",
"the",
"response",
"body",
"as",
"DOMDocument",
"instance",
"."
] | 641325e2d57c1c272ede7fd8b47d4f2b67b73507 | https://github.com/ConnectHolland/tulip-api-client/blob/641325e2d57c1c272ede7fd8b47d4f2b67b73507/src/ResponseParser.php#L85-L100 |
17,497 | guillaumebarranco/twitter-api-php-symfony | TwitterAPIExchange.php | TwitterAPIExchange.buildAuthorizationHeader | private function buildAuthorizationHeader($oauth)
{
$return = 'Authorization: OAuth ';
$values = array();
foreach($oauth as $key => $value)
{
$values[] = "$key=\"" . rawurlencode($value) . "\"";
}
$return .= implode(', ', $values);
... | php | private function buildAuthorizationHeader($oauth)
{
$return = 'Authorization: OAuth ';
$values = array();
foreach($oauth as $key => $value)
{
$values[] = "$key=\"" . rawurlencode($value) . "\"";
}
$return .= implode(', ', $values);
... | [
"private",
"function",
"buildAuthorizationHeader",
"(",
"$",
"oauth",
")",
"{",
"$",
"return",
"=",
"'Authorization: OAuth '",
";",
"$",
"values",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"oauth",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
... | Private method to generate authorization header used by cURL
@param array $oauth Array of oauth data generated by buildOauth()
@return string $return Header used by cURL for request | [
"Private",
"method",
"to",
"generate",
"authorization",
"header",
"used",
"by",
"cURL"
] | 34f3d21b2a96b9090b74f7ec14443b085283375e | https://github.com/guillaumebarranco/twitter-api-php-symfony/blob/34f3d21b2a96b9090b74f7ec14443b085283375e/TwitterAPIExchange.php#L252-L264 |
17,498 | discordier/justtextwidgets | src/Widgets/JustATextOption.php | JustATextOption.checkOptGroup | private function checkOptGroup($options, $class, $style)
{
foreach ($options as $option) {
// If it is an option group, handle it.
if (!isset($option['value'])) {
$result = $this->checkOptGroup($option, $class, $style);
if ($result) {
... | php | private function checkOptGroup($options, $class, $style)
{
foreach ($options as $option) {
// If it is an option group, handle it.
if (!isset($option['value'])) {
$result = $this->checkOptGroup($option, $class, $style);
if ($result) {
... | [
"private",
"function",
"checkOptGroup",
"(",
"$",
"options",
",",
"$",
"class",
",",
"$",
"style",
")",
"{",
"foreach",
"(",
"$",
"options",
"as",
"$",
"option",
")",
"{",
"// If it is an option group, handle it.",
"if",
"(",
"!",
"isset",
"(",
"$",
"optio... | Scan an option group for the selected option.
@param array $options The option array.
@param string $class The html class to use.
@param string $style The html style to use.
@return null|string | [
"Scan",
"an",
"option",
"group",
"for",
"the",
"selected",
"option",
"."
] | 585f20eec05d592bb13281ca8ef0972e956d3f06 | https://github.com/discordier/justtextwidgets/blob/585f20eec05d592bb13281ca8ef0972e956d3f06/src/Widgets/JustATextOption.php#L99-L126 |
17,499 | aedart/laravel-helpers | src/Traits/Auth/AuthManagerTrait.php | AuthManagerTrait.getAuthManager | public function getAuthManager(): ?AuthManager
{
if (!$this->hasAuthManager()) {
$this->setAuthManager($this->getDefaultAuthManager());
}
return $this->authManager;
} | php | public function getAuthManager(): ?AuthManager
{
if (!$this->hasAuthManager()) {
$this->setAuthManager($this->getDefaultAuthManager());
}
return $this->authManager;
} | [
"public",
"function",
"getAuthManager",
"(",
")",
":",
"?",
"AuthManager",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasAuthManager",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setAuthManager",
"(",
"$",
"this",
"->",
"getDefaultAuthManager",
"(",
")",
")",
... | Get auth manager
If no auth manager has been set, this method will
set and return a default auth manager, if any such
value is available
@see getDefaultAuthManager()
@return AuthManager|null auth manager or null if none auth manager has been set | [
"Get",
"auth",
"manager"
] | 8b81a2d6658f3f8cb62b6be2c34773aaa2df219a | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Auth/AuthManagerTrait.php#L53-L59 |
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.