repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Wedeto/DB | src/Model.php | Model.destruct | public function destruct()
{
$this->_id = [];
$this->_source_db = null;
$this->_record = [];
$this->_changed = [];
return $this;
} | php | public function destruct()
{
$this->_id = [];
$this->_source_db = null;
$this->_record = [];
$this->_changed = [];
return $this;
} | [
"public",
"function",
"destruct",
"(",
")",
"{",
"$",
"this",
"->",
"_id",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"_source_db",
"=",
"null",
";",
"$",
"this",
"->",
"_record",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"_changed",
"=",
"[",
"]",
";... | Remove the data from this object, after removal
@return Wedeto\DB\Model Prvides fluent interface | [
"Remove",
"the",
"data",
"from",
"this",
"object",
"after",
"removal"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Model.php#L251-L258 | train |
Wedeto/DB | src/Model.php | Model.getField | public function getField(string $field)
{
if (isset($this->_record[$field]))
return $this->_record[$field];
return null;
} | php | public function getField(string $field)
{
if (isset($this->_record[$field]))
return $this->_record[$field];
return null;
} | [
"public",
"function",
"getField",
"(",
"string",
"$",
"field",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_record",
"[",
"$",
"field",
"]",
")",
")",
"return",
"$",
"this",
"->",
"_record",
"[",
"$",
"field",
"]",
";",
"return",
"null",... | Get the value for a field of this record.
@param string $field The name of the field to get
@return mixed The value of this field | [
"Get",
"the",
"value",
"for",
"a",
"field",
"of",
"this",
"record",
"."
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Model.php#L277-L282 | train |
Wedeto/DB | src/Model.php | Model.setField | public function setField(string $field, $value)
{
if (isset($this->_record[$field]) && $this->_record[$field] === $value)
return;
$db = $this->getDB();
$dao = $db->getDAO(static::class);
$columns = $dao->getColumns();
if (!isset($columns[$field]))
thr... | php | public function setField(string $field, $value)
{
if (isset($this->_record[$field]) && $this->_record[$field] === $value)
return;
$db = $this->getDB();
$dao = $db->getDAO(static::class);
$columns = $dao->getColumns();
if (!isset($columns[$field]))
thr... | [
"public",
"function",
"setField",
"(",
"string",
"$",
"field",
",",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_record",
"[",
"$",
"field",
"]",
")",
"&&",
"$",
"this",
"->",
"_record",
"[",
"$",
"field",
"]",
"===",
"$"... | Set a field to a new value. The value will be validated first by
calling validate.
@param string $field The field to retrieve
@param mixed $value The value to set it to.
@return Wedeto\DB\DAO Provides fluent interface. | [
"Set",
"a",
"field",
"to",
"a",
"new",
"value",
".",
"The",
"value",
"will",
"be",
"validated",
"first",
"by",
"calling",
"validate",
"."
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Model.php#L305-L332 | train |
Wedeto/DB | src/Model.php | Model.validate | public static function validate(Column $coldef, $value)
{
$field = $coldef->getName();
try
{
$valid = $coldef->validate($value);
}
catch (InvalidValueException $e)
{
$rep = WF::str($value);
throw new InvalidValueException("Field $fi... | php | public static function validate(Column $coldef, $value)
{
$field = $coldef->getName();
try
{
$valid = $coldef->validate($value);
}
catch (InvalidValueException $e)
{
$rep = WF::str($value);
throw new InvalidValueException("Field $fi... | [
"public",
"static",
"function",
"validate",
"(",
"Column",
"$",
"coldef",
",",
"$",
"value",
")",
"{",
"$",
"field",
"=",
"$",
"coldef",
"->",
"getName",
"(",
")",
";",
"try",
"{",
"$",
"valid",
"=",
"$",
"coldef",
"->",
"validate",
"(",
"$",
"valu... | Validate a value for the field before setting it. This method is called
from the setField method before updating the value. You can override
this to add validators. Be sure to call the super validator to validate
the base field to match the column definition.
@param Column $coldef The column
@param mixed $value The va... | [
"Validate",
"a",
"value",
"for",
"the",
"field",
"before",
"setting",
"it",
".",
"This",
"method",
"is",
"called",
"from",
"the",
"setField",
"method",
"before",
"updating",
"the",
"value",
".",
"You",
"can",
"override",
"this",
"to",
"add",
"validators",
... | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Model.php#L399-L413 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/stores/AbstractCacheStore.php | AbstractCacheStore.storageFormat | protected function storageFormat($key, $data, $ttl)
{
$start = time();
$expire = $start + $ttl;
return array('key' => $key, 'value' => $data, 'duration' => $ttl, 'created' => $start, 'expires' => $expire);
} | php | protected function storageFormat($key, $data, $ttl)
{
$start = time();
$expire = $start + $ttl;
return array('key' => $key, 'value' => $data, 'duration' => $ttl, 'created' => $start, 'expires' => $expire);
} | [
"protected",
"function",
"storageFormat",
"(",
"$",
"key",
",",
"$",
"data",
",",
"$",
"ttl",
")",
"{",
"$",
"start",
"=",
"time",
"(",
")",
";",
"$",
"expire",
"=",
"$",
"start",
"+",
"$",
"ttl",
";",
"return",
"array",
"(",
"'key'",
"=>",
"$",
... | Defines the array that will be used to store data.
Changing this will require updating all functions that also fetch data.
At no point after this function is called should the data be manipulated,
only inserted directly into cache.
@param string $key Key name
@param string $data Data to store
@param int $ttl Durati... | [
"Defines",
"the",
"array",
"that",
"will",
"be",
"used",
"to",
"store",
"data",
".",
"Changing",
"this",
"will",
"require",
"updating",
"all",
"functions",
"that",
"also",
"fetch",
"data",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/stores/AbstractCacheStore.php#L33-L39 | train |
brunschgi/TerrificComposerBundle | Controller/ModuleController.php | ModuleController.detailsAction | public function detailsAction(Request $request, $module, $template, $skins)
{
$fullModule = null;
try {
$moduleManager = $this->get('terrific.composer.module.manager');
$fullModule = $moduleManager->getModuleByName($module);
// prepare the parameter for module r... | php | public function detailsAction(Request $request, $module, $template, $skins)
{
$fullModule = null;
try {
$moduleManager = $this->get('terrific.composer.module.manager');
$fullModule = $moduleManager->getModuleByName($module);
// prepare the parameter for module r... | [
"public",
"function",
"detailsAction",
"(",
"Request",
"$",
"request",
",",
"$",
"module",
",",
"$",
"template",
",",
"$",
"skins",
")",
"{",
"$",
"fullModule",
"=",
"null",
";",
"try",
"{",
"$",
"moduleManager",
"=",
"$",
"this",
"->",
"get",
"(",
"... | Display the details of a terrific module.
@Route("/module/details/{module}/{template}/{skins}", defaults={"template" = null, "skins" = null}, name = "composer_module_details")
@Template() | [
"Display",
"the",
"details",
"of",
"a",
"terrific",
"module",
"."
] | 6eef4ace887c19ef166ab6654de385bc1ffbf5f1 | https://github.com/brunschgi/TerrificComposerBundle/blob/6eef4ace887c19ef166ab6654de385bc1ffbf5f1/Controller/ModuleController.php#L36-L70 | train |
brunschgi/TerrificComposerBundle | Controller/ModuleController.php | ModuleController.createAction | public function createAction(Request $request)
{
if ($this->get('session')->has('module')) {
// get the last module from the session to fill some defaults for the new one
$tmpModule = $this->get('session')->get('module');
// setup a fresh module object
$modul... | php | public function createAction(Request $request)
{
if ($this->get('session')->has('module')) {
// get the last module from the session to fill some defaults for the new one
$tmpModule = $this->get('session')->get('module');
// setup a fresh module object
$modul... | [
"public",
"function",
"createAction",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"get",
"(",
"'session'",
")",
"->",
"has",
"(",
"'module'",
")",
")",
"{",
"// get the last module from the session to fill some defaults for the new one",
... | Creates a terrific module.
@Route("/module/create", name="composer_create_module")
@Template()
@param Request $request
@return Response | [
"Creates",
"a",
"terrific",
"module",
"."
] | 6eef4ace887c19ef166ab6654de385bc1ffbf5f1 | https://github.com/brunschgi/TerrificComposerBundle/blob/6eef4ace887c19ef166ab6654de385bc1ffbf5f1/Controller/ModuleController.php#L81-L138 | train |
brunschgi/TerrificComposerBundle | Controller/ModuleController.php | ModuleController.addskinAction | public function addskinAction(Request $request)
{
// setup a fresh skin and module object
$skin = new Skin();
$module = new Module();
if ($this->get('session')->has('module')) {
// get the last module from the session to fill some additional defaults for the new skin
... | php | public function addskinAction(Request $request)
{
// setup a fresh skin and module object
$skin = new Skin();
$module = new Module();
if ($this->get('session')->has('module')) {
// get the last module from the session to fill some additional defaults for the new skin
... | [
"public",
"function",
"addskinAction",
"(",
"Request",
"$",
"request",
")",
"{",
"// setup a fresh skin and module object",
"$",
"skin",
"=",
"new",
"Skin",
"(",
")",
";",
"$",
"module",
"=",
"new",
"Module",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
... | Adds a skin to the module.
@Route("/module/addskin", name="composer_add_skin")
@Template()
@param Request $request
@return Response | [
"Adds",
"a",
"skin",
"to",
"the",
"module",
"."
] | 6eef4ace887c19ef166ab6654de385bc1ffbf5f1 | https://github.com/brunschgi/TerrificComposerBundle/blob/6eef4ace887c19ef166ab6654de385bc1ffbf5f1/Controller/ModuleController.php#L149-L196 | train |
phpffcms/ffcms-core | src/Network/Request/RouteMapFeatures.php | RouteMapFeatures.runRouteBinding | private function runRouteBinding(): void
{
// calculated depend of language
$pathway = $this->getPathInfo();
/** @var array $routing */
$routing = App::$Properties->getAll('Routing');
// try to work with static aliases
if (Any::isArray($routing) && isset($routing['Al... | php | private function runRouteBinding(): void
{
// calculated depend of language
$pathway = $this->getPathInfo();
/** @var array $routing */
$routing = App::$Properties->getAll('Routing');
// try to work with static aliases
if (Any::isArray($routing) && isset($routing['Al... | [
"private",
"function",
"runRouteBinding",
"(",
")",
":",
"void",
"{",
"// calculated depend of language",
"$",
"pathway",
"=",
"$",
"this",
"->",
"getPathInfo",
"(",
")",
";",
"/** @var array $routing */",
"$",
"routing",
"=",
"App",
"::",
"$",
"Properties",
"->... | Build static and dynamic path aliases for working set
@return void | [
"Build",
"static",
"and",
"dynamic",
"path",
"aliases",
"for",
"working",
"set"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Network/Request/RouteMapFeatures.php#L26-L54 | train |
phpffcms/ffcms-core | src/Network/Request/RouteMapFeatures.php | RouteMapFeatures.findStaticAliases | private function findStaticAliases(?array $map = null, ?string $pathway = null): ?string
{
if (!$map) {
return $pathway;
}
// current pathway is found as "old path" (or alias target). Make redirect to new pathway.
if (Arr::in($pathway, $map)) {
// find "new p... | php | private function findStaticAliases(?array $map = null, ?string $pathway = null): ?string
{
if (!$map) {
return $pathway;
}
// current pathway is found as "old path" (or alias target). Make redirect to new pathway.
if (Arr::in($pathway, $map)) {
// find "new p... | [
"private",
"function",
"findStaticAliases",
"(",
"?",
"array",
"$",
"map",
"=",
"null",
",",
"?",
"string",
"$",
"pathway",
"=",
"null",
")",
":",
"?",
"string",
"{",
"if",
"(",
"!",
"$",
"map",
")",
"{",
"return",
"$",
"pathway",
";",
"}",
"// cur... | Prepare static pathway aliasing for routing
@param array|null $map
@param string|null $pathway
@return string|null | [
"Prepare",
"static",
"pathway",
"aliasing",
"for",
"routing"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Network/Request/RouteMapFeatures.php#L62-L91 | train |
phpffcms/ffcms-core | src/Network/Request/RouteMapFeatures.php | RouteMapFeatures.findDynamicCallbacks | private function findDynamicCallbacks(array $map = null, ?string $controller = null): void
{
if (!$map) {
return;
}
// try to find global callback for this controller slug
if (array_key_exists($controller, $map)) {
$class = (string)$map[$controller];
... | php | private function findDynamicCallbacks(array $map = null, ?string $controller = null): void
{
if (!$map) {
return;
}
// try to find global callback for this controller slug
if (array_key_exists($controller, $map)) {
$class = (string)$map[$controller];
... | [
"private",
"function",
"findDynamicCallbacks",
"(",
"array",
"$",
"map",
"=",
"null",
",",
"?",
"string",
"$",
"controller",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"map",
")",
"{",
"return",
";",
"}",
"// try to find global callback for t... | Prepare dynamic callback data for routing
@param array|null $map
@param string|null $controller
@return void | [
"Prepare",
"dynamic",
"callback",
"data",
"for",
"routing"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Network/Request/RouteMapFeatures.php#L99-L112 | train |
rollerworks/search-core | SearchConditionSerializer.php | SearchConditionSerializer.serialize | public function serialize(SearchCondition $searchCondition): array
{
$setName = $searchCondition->getFieldSet()->getSetName();
return [$setName, serialize($searchCondition->getValuesGroup())];
} | php | public function serialize(SearchCondition $searchCondition): array
{
$setName = $searchCondition->getFieldSet()->getSetName();
return [$setName, serialize($searchCondition->getValuesGroup())];
} | [
"public",
"function",
"serialize",
"(",
"SearchCondition",
"$",
"searchCondition",
")",
":",
"array",
"{",
"$",
"setName",
"=",
"$",
"searchCondition",
"->",
"getFieldSet",
"(",
")",
"->",
"getSetName",
"(",
")",
";",
"return",
"[",
"$",
"setName",
",",
"s... | Serialize a SearchCondition.
The returned value is an array you can safely serialize yourself.
This is not done already because storing a serialized SearchCondition
in a php session would serialize the serialized result again.
Caution: The FieldSet must be loadable from the factory.
@return array [FieldSet-name, ser... | [
"Serialize",
"a",
"SearchCondition",
"."
] | 6b5671b8c4d6298906ded768261b0a59845140fb | https://github.com/rollerworks/search-core/blob/6b5671b8c4d6298906ded768261b0a59845140fb/SearchConditionSerializer.php#L46-L51 | train |
rollerworks/search-core | SearchConditionSerializer.php | SearchConditionSerializer.unserialize | public function unserialize(array $searchCondition): SearchCondition
{
if (2 !== \count($searchCondition) || !isset($searchCondition[0], $searchCondition[1])) {
throw new InvalidArgumentException(
'Serialized search condition must be exactly two values [FieldSet-name, serialized ... | php | public function unserialize(array $searchCondition): SearchCondition
{
if (2 !== \count($searchCondition) || !isset($searchCondition[0], $searchCondition[1])) {
throw new InvalidArgumentException(
'Serialized search condition must be exactly two values [FieldSet-name, serialized ... | [
"public",
"function",
"unserialize",
"(",
"array",
"$",
"searchCondition",
")",
":",
"SearchCondition",
"{",
"if",
"(",
"2",
"!==",
"\\",
"count",
"(",
"$",
"searchCondition",
")",
"||",
"!",
"isset",
"(",
"$",
"searchCondition",
"[",
"0",
"]",
",",
"$",... | Unserialize a serialized SearchCondition.
@param array $searchCondition [FieldSet-name, serialized ValuesGroup object]
@throws InvalidArgumentException when serialized SearchCondition is invalid
(invalid structure or failed to unserialize) | [
"Unserialize",
"a",
"serialized",
"SearchCondition",
"."
] | 6b5671b8c4d6298906ded768261b0a59845140fb | https://github.com/rollerworks/search-core/blob/6b5671b8c4d6298906ded768261b0a59845140fb/SearchConditionSerializer.php#L61-L77 | train |
OxfordInfoLabs/kinikit-core | src/Util/HTTP/URLHelper.php | URLHelper.getCurrentFullHostString | public static function getCurrentFullHostString() {
$hostString = $_SERVER["HTTPS"] ? "https" : "http";
$hostString .= "://";
$hostString .= $_SERVER["HTTP_HOST"];
$hostString .= $_SERVER["SERVER_PORT"] != 80 ? ":" . $_SERVER["SERVER_PORT"] : "";
return $hostString;
} | php | public static function getCurrentFullHostString() {
$hostString = $_SERVER["HTTPS"] ? "https" : "http";
$hostString .= "://";
$hostString .= $_SERVER["HTTP_HOST"];
$hostString .= $_SERVER["SERVER_PORT"] != 80 ? ":" . $_SERVER["SERVER_PORT"] : "";
return $hostString;
} | [
"public",
"static",
"function",
"getCurrentFullHostString",
"(",
")",
"{",
"$",
"hostString",
"=",
"$",
"_SERVER",
"[",
"\"HTTPS\"",
"]",
"?",
"\"https\"",
":",
"\"http\"",
";",
"$",
"hostString",
".=",
"\"://\"",
";",
"$",
"hostString",
".=",
"$",
"_SERVER"... | Return the current full host string for the current request including protocol and ports etc. | [
"Return",
"the",
"current",
"full",
"host",
"string",
"for",
"the",
"current",
"request",
"including",
"protocol",
"and",
"ports",
"etc",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/HTTP/URLHelper.php#L42-L52 | train |
OxfordInfoLabs/kinikit-core | src/Util/HTTP/URLHelper.php | URLHelper.getPartialURLFromSegment | public function getPartialURLFromSegment($segmentIdx) {
$partialURL = "";
for ($i = $segmentIdx; $i < sizeof($this->segments); $i++) {
$partialURL .= (($i > $segmentIdx) ? "/" : "") . $this->segments [$i];
}
return $partialURL;
} | php | public function getPartialURLFromSegment($segmentIdx) {
$partialURL = "";
for ($i = $segmentIdx; $i < sizeof($this->segments); $i++) {
$partialURL .= (($i > $segmentIdx) ? "/" : "") . $this->segments [$i];
}
return $partialURL;
} | [
"public",
"function",
"getPartialURLFromSegment",
"(",
"$",
"segmentIdx",
")",
"{",
"$",
"partialURL",
"=",
"\"\"",
";",
"for",
"(",
"$",
"i",
"=",
"$",
"segmentIdx",
";",
"$",
"i",
"<",
"sizeof",
"(",
"$",
"this",
"->",
"segments",
")",
";",
"$",
"i... | Get a partial string version of this url object starting from a particular segment
@return string | [
"Get",
"a",
"partial",
"string",
"version",
"of",
"this",
"url",
"object",
"starting",
"from",
"a",
"particular",
"segment"
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/HTTP/URLHelper.php#L86-L95 | train |
OxfordInfoLabs/kinikit-core | src/Util/HTTP/URLHelper.php | URLHelper.getQueryParametersArray | public function getQueryParametersArray() {
$queryString = $this->getQueryString();
if (strlen($queryString) == 0) return array();
$splitQuery = explode("&", substr($queryString, 1));
$returnedParams = array();
foreach ($splitQuery as $param) {
$splitParam = explode... | php | public function getQueryParametersArray() {
$queryString = $this->getQueryString();
if (strlen($queryString) == 0) return array();
$splitQuery = explode("&", substr($queryString, 1));
$returnedParams = array();
foreach ($splitQuery as $param) {
$splitParam = explode... | [
"public",
"function",
"getQueryParametersArray",
"(",
")",
"{",
"$",
"queryString",
"=",
"$",
"this",
"->",
"getQueryString",
"(",
")",
";",
"if",
"(",
"strlen",
"(",
"$",
"queryString",
")",
"==",
"0",
")",
"return",
"array",
"(",
")",
";",
"$",
"spli... | Get all query parameters contained within this URL as an associative array.
@return array | [
"Get",
"all",
"query",
"parameters",
"contained",
"within",
"this",
"URL",
"as",
"an",
"associative",
"array",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/HTTP/URLHelper.php#L165-L179 | train |
OxfordInfoLabs/kinikit-core | src/Util/HTTP/URLHelper.php | URLHelper.processURL | private function processURL($url) {
// Clean up special characters in url params
$url = str_replace("%20", " ", $url);
// Store a private copy for use later
$this->url = URLHelper::$testURL == null ? $url : URLHelper::$testURL;
// Split it on protocol first if required.
... | php | private function processURL($url) {
// Clean up special characters in url params
$url = str_replace("%20", " ", $url);
// Store a private copy for use later
$this->url = URLHelper::$testURL == null ? $url : URLHelper::$testURL;
// Split it on protocol first if required.
... | [
"private",
"function",
"processURL",
"(",
"$",
"url",
")",
"{",
"// Clean up special characters in url params",
"$",
"url",
"=",
"str_replace",
"(",
"\"%20\"",
",",
"\" \"",
",",
"$",
"url",
")",
";",
"// Store a private copy for use later",
"$",
"this",
"->",
"ur... | off query parameters too. | [
"off",
"query",
"parameters",
"too",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/HTTP/URLHelper.php#L185-L214 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Mapping/ClassMetadataFactory.php | ClassMetadataFactory.addInheritedAttributes | private function addInheritedAttributes(ClassMetadata $subClass, ClassMetadata $parentClass)
{
$propertyFactory = new PropertyMetadataFactory($subClass);
foreach ($parentClass->propertyMetadata as $attributeName => $parentMapping) {
//in case of inheritance from superclass, otherwise th... | php | private function addInheritedAttributes(ClassMetadata $subClass, ClassMetadata $parentClass)
{
$propertyFactory = new PropertyMetadataFactory($subClass);
foreach ($parentClass->propertyMetadata as $attributeName => $parentMapping) {
//in case of inheritance from superclass, otherwise th... | [
"private",
"function",
"addInheritedAttributes",
"(",
"ClassMetadata",
"$",
"subClass",
",",
"ClassMetadata",
"$",
"parentClass",
")",
"{",
"$",
"propertyFactory",
"=",
"new",
"PropertyMetadataFactory",
"(",
"$",
"subClass",
")",
";",
"foreach",
"(",
"$",
"parentC... | Adds inherited attributes to the subclass mapping.
@param ClassMetadata $subClass
@param ClassMetadata $parentClass
@throws MappingException | [
"Adds",
"inherited",
"attributes",
"to",
"the",
"subclass",
"mapping",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Mapping/ClassMetadataFactory.php#L58-L72 | train |
erenmustafaozdal/laravel-modules-base | src/Services/CollectionService.php | CollectionService.renderAncestorsAndSelf | public function renderAncestorsAndSelf($items, $glue = '/', $keys = ['name'])
{
$items = $items->map(function($item,$key) use($keys, $glue)
{
$ancSelf = $item->ancestorsAndSelf()->get();
$result = [ 'id' => $item->id];
foreach ($keys as $k) {
... | php | public function renderAncestorsAndSelf($items, $glue = '/', $keys = ['name'])
{
$items = $items->map(function($item,$key) use($keys, $glue)
{
$ancSelf = $item->ancestorsAndSelf()->get();
$result = [ 'id' => $item->id];
foreach ($keys as $k) {
... | [
"public",
"function",
"renderAncestorsAndSelf",
"(",
"$",
"items",
",",
"$",
"glue",
"=",
"'/'",
",",
"$",
"keys",
"=",
"[",
"'name'",
"]",
")",
"{",
"$",
"items",
"=",
"$",
"items",
"->",
"map",
"(",
"function",
"(",
"$",
"item",
",",
"$",
"key",
... | ancestors and self render and get
@param Collection $items
@param string $glue
@param array $keys
@return array | [
"ancestors",
"and",
"self",
"render",
"and",
"get"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Services/CollectionService.php#L30-L55 | train |
zodream/database | src/Manager.php | Manager.setConfigs | public function setConfigs(array $args) {
if (!is_array(current($args))) {
$args = [
$this->currentName => $args
];
}
foreach ($args as $key => $item) {
if (array_key_exists($key, $this->configs)) {
$this->configs[$key] = array_... | php | public function setConfigs(array $args) {
if (!is_array(current($args))) {
$args = [
$this->currentName => $args
];
}
foreach ($args as $key => $item) {
if (array_key_exists($key, $this->configs)) {
$this->configs[$key] = array_... | [
"public",
"function",
"setConfigs",
"(",
"array",
"$",
"args",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"current",
"(",
"$",
"args",
")",
")",
")",
"{",
"$",
"args",
"=",
"[",
"$",
"this",
"->",
"currentName",
"=>",
"$",
"args",
"]",
";",
"}",
... | ADD 2D ARRAY
@param array $args
@return $this | [
"ADD",
"2D",
"ARRAY"
] | 03712219c057799d07350a3a2650c55bcc92c28e | https://github.com/zodream/database/blob/03712219c057799d07350a3a2650c55bcc92c28e/src/Manager.php#L25-L39 | train |
zodream/database | src/Manager.php | Manager.getEngine | public function getEngine($name = null) {
if (is_null($name)) {
$name = $this->getCurrentName();
}
if (array_key_exists($name, $this->engines)) {
return $this->engines[$name];
}
if (!$this->hasConfig($name)) {
throw new \InvalidArgumentExceptio... | php | public function getEngine($name = null) {
if (is_null($name)) {
$name = $this->getCurrentName();
}
if (array_key_exists($name, $this->engines)) {
return $this->engines[$name];
}
if (!$this->hasConfig($name)) {
throw new \InvalidArgumentExceptio... | [
"public",
"function",
"getEngine",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"name",
")",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getCurrentName",
"(",
")",
";",
"}",
"if",
"(",
"array_key_exists",
"(",
"$",
... | GET DATABASE ENGINE
@param string $name
@return mixed
@throws \Exception | [
"GET",
"DATABASE",
"ENGINE"
] | 03712219c057799d07350a3a2650c55bcc92c28e | https://github.com/zodream/database/blob/03712219c057799d07350a3a2650c55bcc92c28e/src/Manager.php#L73-L90 | train |
pryley/castor-framework | src/Container.php | Container.make | public function make( $abstract )
{
$service = isset( $this->services[$abstract] )
? $this->services[$abstract]
: $this->addNamespace( $abstract );
if( is_callable( $service )) {
return call_user_func_array( $service, [$this] );
}
if( is_object( $service )) {
return $service;
}
return $this->... | php | public function make( $abstract )
{
$service = isset( $this->services[$abstract] )
? $this->services[$abstract]
: $this->addNamespace( $abstract );
if( is_callable( $service )) {
return call_user_func_array( $service, [$this] );
}
if( is_object( $service )) {
return $service;
}
return $this->... | [
"public",
"function",
"make",
"(",
"$",
"abstract",
")",
"{",
"$",
"service",
"=",
"isset",
"(",
"$",
"this",
"->",
"services",
"[",
"$",
"abstract",
"]",
")",
"?",
"$",
"this",
"->",
"services",
"[",
"$",
"abstract",
"]",
":",
"$",
"this",
"->",
... | Resolve the given type from the container.
Allow unbound aliases that omit the root namespace
i.e. 'Controller' translates to 'GeminiLabs\Castor\Controller'
@param mixed $abstract
@return mixed | [
"Resolve",
"the",
"given",
"type",
"from",
"the",
"container",
".",
"Allow",
"unbound",
"aliases",
"that",
"omit",
"the",
"root",
"namespace",
"i",
".",
"e",
".",
"Controller",
"translates",
"to",
"GeminiLabs",
"\\",
"Castor",
"\\",
"Controller"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Container.php#L70-L84 | train |
squareproton/Bond | src/Bond/RecordManager/Task/NormalityCollection/Persist.php | Persist.additionalSavingTasks | protected function additionalSavingTasks( Pg $pg, $simulate = false, array &$ignoreList = array(), $action = self::ACTION_OBJECT )
{
// additional saving tasks?
$repository = $this->recordManager->entityManager->getRepository( $this->object->class );
$normality = $repository->normality;
... | php | protected function additionalSavingTasks( Pg $pg, $simulate = false, array &$ignoreList = array(), $action = self::ACTION_OBJECT )
{
// additional saving tasks?
$repository = $this->recordManager->entityManager->getRepository( $this->object->class );
$normality = $repository->normality;
... | [
"protected",
"function",
"additionalSavingTasks",
"(",
"Pg",
"$",
"pg",
",",
"$",
"simulate",
"=",
"false",
",",
"array",
"&",
"$",
"ignoreList",
"=",
"array",
"(",
")",
",",
"$",
"action",
"=",
"self",
"::",
"ACTION_OBJECT",
")",
"{",
"// additional savin... | Execute additional saving tasks.
@return true | [
"Execute",
"additional",
"saving",
"tasks",
"."
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/RecordManager/Task/NormalityCollection/Persist.php#L240-L277 | train |
jabernardo/lollipop-php | Library/Text/Inflector.php | Inflector.camelize | static function camelize($str) {
// john_aldrich -> john aldrich
$str = str_replace('_', ' ', $str);
// john aldrich -> John Aldrich
$str = ucwords($str);
// John Aldrich -> JohnAldrich
$str = str_replace(' ', '', $str);
return lcfirst($str);
} | php | static function camelize($str) {
// john_aldrich -> john aldrich
$str = str_replace('_', ' ', $str);
// john aldrich -> John Aldrich
$str = ucwords($str);
// John Aldrich -> JohnAldrich
$str = str_replace(' ', '', $str);
return lcfirst($str);
} | [
"static",
"function",
"camelize",
"(",
"$",
"str",
")",
"{",
"// john_aldrich -> john aldrich",
"$",
"str",
"=",
"str_replace",
"(",
"'_'",
",",
"' '",
",",
"$",
"str",
")",
";",
"// john aldrich -> John Aldrich",
"$",
"str",
"=",
"ucwords",
"(",
"$",
"str",... | Changes word format to camelize
@param string $str String
@return string | [
"Changes",
"word",
"format",
"to",
"camelize"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/Text/Inflector.php#L26-L37 | train |
jabernardo/lollipop-php | Library/Text/Inflector.php | Inflector.studly | static function studly($str) {
// john_aldrich -> john aldrich
$str = str_replace('_', ' ', $str);
// john aldrich -> John Aldrich
$str = ucwords($str);
// John Aldrich -> JohnAldrich
$str = str_replace(' ', '', $str);
return $str;
} | php | static function studly($str) {
// john_aldrich -> john aldrich
$str = str_replace('_', ' ', $str);
// john aldrich -> John Aldrich
$str = ucwords($str);
// John Aldrich -> JohnAldrich
$str = str_replace(' ', '', $str);
return $str;
} | [
"static",
"function",
"studly",
"(",
"$",
"str",
")",
"{",
"// john_aldrich -> john aldrich",
"$",
"str",
"=",
"str_replace",
"(",
"'_'",
",",
"' '",
",",
"$",
"str",
")",
";",
"// john aldrich -> John Aldrich",
"$",
"str",
"=",
"ucwords",
"(",
"$",
"str",
... | Changes word format to studly
@param string $str String
@return string | [
"Changes",
"word",
"format",
"to",
"studly"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/Text/Inflector.php#L46-L57 | train |
skimia/AngularBundle | Components/FileGenerator/MyJsMin.php | MyJsMin.get | private function get() {
// Get next input character and advance position in file
if ($this->inPos < $this->inLength) {
$c = $this->in[$this->inPos];
++$this->inPos;
}
else {
return self::EOF;
}
// Test for non-problematic characters
if ($c === "\n" || $c === self::EOF || ord($c) >= self::ORD_s... | php | private function get() {
// Get next input character and advance position in file
if ($this->inPos < $this->inLength) {
$c = $this->in[$this->inPos];
++$this->inPos;
}
else {
return self::EOF;
}
// Test for non-problematic characters
if ($c === "\n" || $c === self::EOF || ord($c) >= self::ORD_s... | [
"private",
"function",
"get",
"(",
")",
"{",
"// Get next input character and advance position in file",
"if",
"(",
"$",
"this",
"->",
"inPos",
"<",
"$",
"this",
"->",
"inLength",
")",
"{",
"$",
"c",
"=",
"$",
"this",
"->",
"in",
"[",
"$",
"this",
"->",
... | Get the next character from the input stream.
If said character is a control character, translate it to a space or linefeed.
@return string The next character from the specified input stream.
@see $in
@see peek() | [
"Get",
"the",
"next",
"character",
"from",
"the",
"input",
"stream",
"."
] | ce12fbc03f8554a7879467e73a739ede8991ec48 | https://github.com/skimia/AngularBundle/blob/ce12fbc03f8554a7879467e73a739ede8991ec48/Components/FileGenerator/MyJsMin.php#L173-L200 | train |
skimia/AngularBundle | Components/FileGenerator/MyJsMin.php | MyJsMin.peek | private function peek()
{
return ($this->inPos < $this->inLength) ? $this->in[$this->inPos] : self::EOF;
} | php | private function peek()
{
return ($this->inPos < $this->inLength) ? $this->in[$this->inPos] : self::EOF;
} | [
"private",
"function",
"peek",
"(",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"inPos",
"<",
"$",
"this",
"->",
"inLength",
")",
"?",
"$",
"this",
"->",
"in",
"[",
"$",
"this",
"->",
"inPos",
"]",
":",
"self",
"::",
"EOF",
";",
"}"
] | Get the next character from the input stream, without gettng it.
@return string The next character from the specified input stream, without advancing the position
in the underlying file.
@see $in
@see get() | [
"Get",
"the",
"next",
"character",
"from",
"the",
"input",
"stream",
"without",
"gettng",
"it",
"."
] | ce12fbc03f8554a7879467e73a739ede8991ec48 | https://github.com/skimia/AngularBundle/blob/ce12fbc03f8554a7879467e73a739ede8991ec48/Components/FileGenerator/MyJsMin.php#L221-L224 | train |
skimia/AngularBundle | Components/FileGenerator/MyJsMin.php | MyJsMin.next | function next() {
// Get next char from input, translated if necessary
$c = $this->get();
// Check comment possibility
if ($c == '/') {
// Look ahead : a comment is two slashes or slashes followed by asterisk (to be closed)
switch ($this->peek()) {
case '/' :
// Comment is up to the end o... | php | function next() {
// Get next char from input, translated if necessary
$c = $this->get();
// Check comment possibility
if ($c == '/') {
// Look ahead : a comment is two slashes or slashes followed by asterisk (to be closed)
switch ($this->peek()) {
case '/' :
// Comment is up to the end o... | [
"function",
"next",
"(",
")",
"{",
"// Get next char from input, translated if necessary",
"$",
"c",
"=",
"$",
"this",
"->",
"get",
"(",
")",
";",
"// Check comment possibility",
"if",
"(",
"$",
"c",
"==",
"'/'",
")",
"{",
"// Look ahead : a comment is two slashes o... | Get the next character from the input stream, excluding comments.
{@link peek()} is used to see if a '/' is followed by a '*' or '/'.
Multiline comments are actually returned as a single space.
@return string The next character from the specified input stream, skipping comments.
@see $in | [
"Get",
"the",
"next",
"character",
"from",
"the",
"input",
"stream",
"excluding",
"comments",
"."
] | ce12fbc03f8554a7879467e73a739ede8991ec48 | https://github.com/skimia/AngularBundle/blob/ce12fbc03f8554a7879467e73a739ede8991ec48/Components/FileGenerator/MyJsMin.php#L244-L286 | train |
skimia/AngularBundle | Components/FileGenerator/MyJsMin.php | MyJsMin.action | function action($action) {
// Choice of possible actions
// Note the frequent fallthroughs : the actions are decrementally "long"
switch ($action) {
case self::JSMIN_ACT_FULL :
// Write A to output, then fall through
$this->put($this->theA);
case self::JSMIN_ACT_BUF : // N.B. possible fallthroug... | php | function action($action) {
// Choice of possible actions
// Note the frequent fallthroughs : the actions are decrementally "long"
switch ($action) {
case self::JSMIN_ACT_FULL :
// Write A to output, then fall through
$this->put($this->theA);
case self::JSMIN_ACT_BUF : // N.B. possible fallthroug... | [
"function",
"action",
"(",
"$",
"action",
")",
"{",
"// Choice of possible actions",
"// Note the frequent fallthroughs : the actions are decrementally \"long\"",
"switch",
"(",
"$",
"action",
")",
"{",
"case",
"self",
"::",
"JSMIN_ACT_FULL",
":",
"// Write A to output, then ... | Do something !
The action to perform is determined by the argument :
JSMin::ACT_FULL : Output A. Copy B to A. Get the next B.
JSMin::ACT_BUF : Copy B to A. Get the next B. (Delete A).
JSMin::ACT_IMM : Get the next B. (Delete B).
A string is treated as a single character. Also, regular expressions are recognized if... | [
"Do",
"something",
"!"
] | ce12fbc03f8554a7879467e73a739ede8991ec48 | https://github.com/skimia/AngularBundle/blob/ce12fbc03f8554a7879467e73a739ede8991ec48/Components/FileGenerator/MyJsMin.php#L302-L415 | train |
eliasis-framework/complement | src/Traits/ComplementHandler.php | ComplementHandler.getControllerInstance | public function getControllerInstance($class, $namespace = '')
{
if (isset($this->complement['namespaces'])) {
if (isset($this->complement['namespaces'][$namespace])) {
$namespace = $this->complement['namespaces'][$namespace];
$_class = $namespace . $class;
... | php | public function getControllerInstance($class, $namespace = '')
{
if (isset($this->complement['namespaces'])) {
if (isset($this->complement['namespaces'][$namespace])) {
$namespace = $this->complement['namespaces'][$namespace];
$_class = $namespace . $class;
... | [
"public",
"function",
"getControllerInstance",
"(",
"$",
"class",
",",
"$",
"namespace",
"=",
"''",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"complement",
"[",
"'namespaces'",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->... | Get complement controller instance.
@since 1.1.0
@param array $class → class name
@param array $namespace → namespace index
@return object|false → class instance or false | [
"Get",
"complement",
"controller",
"instance",
"."
] | d50e92cf01600ff4573bf1761c312069044748c3 | https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementHandler.php#L102-L126 | train |
eliasis-framework/complement | src/Traits/ComplementHandler.php | ComplementHandler.setComplement | private function setComplement($complement)
{
$this->getStates();
$this->setComplementParams($complement);
$state = $this->getState();
$action = $this->getAction($state);
$this->setAction($action);
$this->setState($state);
$this->getSettings();
$sta... | php | private function setComplement($complement)
{
$this->getStates();
$this->setComplementParams($complement);
$state = $this->getState();
$action = $this->getAction($state);
$this->setAction($action);
$this->setState($state);
$this->getSettings();
$sta... | [
"private",
"function",
"setComplement",
"(",
"$",
"complement",
")",
"{",
"$",
"this",
"->",
"getStates",
"(",
")",
";",
"$",
"this",
"->",
"setComplementParams",
"(",
"$",
"complement",
")",
";",
"$",
"state",
"=",
"$",
"this",
"->",
"getState",
"(",
... | Set complement.
@param string $complement → complement settings
@uses \Eliasis\Complement\Traits\ComplementState->getStates()
@uses \Eliasis\Complement\Traits\ComplementState->getState()
@uses \Eliasis\Complement\Traits\ComplementState->setState()
@uses \Eliasis\Complement\Traits\ComplementAction->getAction()
@uses \... | [
"Set",
"complement",
"."
] | d50e92cf01600ff4573bf1761c312069044748c3 | https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementHandler.php#L143-L164 | train |
eliasis-framework/complement | src/Traits/ComplementHandler.php | ComplementHandler.setComplementParams | private function setComplementParams($complement)
{
$params = array_intersect_key(
array_flip(self::$required),
$complement
);
$slug = explode('.', basename($complement['config-file']));
$default['slug'] = $slug[0];
$complementType = self::getType('st... | php | private function setComplementParams($complement)
{
$params = array_intersect_key(
array_flip(self::$required),
$complement
);
$slug = explode('.', basename($complement['config-file']));
$default['slug'] = $slug[0];
$complementType = self::getType('st... | [
"private",
"function",
"setComplementParams",
"(",
"$",
"complement",
")",
"{",
"$",
"params",
"=",
"array_intersect_key",
"(",
"array_flip",
"(",
"self",
"::",
"$",
"required",
")",
",",
"$",
"complement",
")",
";",
"$",
"slug",
"=",
"explode",
"(",
"'.'"... | Check required params and set complement params.
@param string $complement → complement settings
@uses \Eliasis\Complement\Complement->$complement
@uses \Eliasis\Complement\Traits\ComplementHandler::getType()
@uses \Eliasis\Complement\Traits\ComplementAction->$hooks
@throws ComplementException → complement configura... | [
"Check",
"required",
"params",
"and",
"set",
"complement",
"params",
"."
] | d50e92cf01600ff4573bf1761c312069044748c3 | https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementHandler.php#L177-L216 | train |
eliasis-framework/complement | src/Traits/ComplementHandler.php | ComplementHandler.getLanguage | private function getLanguage()
{
$wpLang = (function_exists('get_locale')) ? get_locale() : null;
$browserLang = null;
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$browserLang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
}
return substr($wpLang ?: $browserLang ?: 'en'... | php | private function getLanguage()
{
$wpLang = (function_exists('get_locale')) ? get_locale() : null;
$browserLang = null;
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$browserLang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
}
return substr($wpLang ?: $browserLang ?: 'en'... | [
"private",
"function",
"getLanguage",
"(",
")",
"{",
"$",
"wpLang",
"=",
"(",
"function_exists",
"(",
"'get_locale'",
")",
")",
"?",
"get_locale",
"(",
")",
":",
"null",
";",
"$",
"browserLang",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"_SERVER"... | Gets the current locale.
@uses \get_locale() → gets the current locale in WordPress | [
"Gets",
"the",
"current",
"locale",
"."
] | d50e92cf01600ff4573bf1761c312069044748c3 | https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementHandler.php#L247-L256 | train |
eliasis-framework/complement | src/Traits/ComplementHandler.php | ComplementHandler.setImage | private function setImage()
{
$slug = $this->complement['slug'];
$complementType = self::getType('strtoupper');
$complementPath = App::$complementType();
$complementUrl = $complementType . '_URL';
$complementUrl = App::$complementUrl();
$file = 'public/images/' . $s... | php | private function setImage()
{
$slug = $this->complement['slug'];
$complementType = self::getType('strtoupper');
$complementPath = App::$complementType();
$complementUrl = $complementType . '_URL';
$complementUrl = App::$complementUrl();
$file = 'public/images/' . $s... | [
"private",
"function",
"setImage",
"(",
")",
"{",
"$",
"slug",
"=",
"$",
"this",
"->",
"complement",
"[",
"'slug'",
"]",
";",
"$",
"complementType",
"=",
"self",
"::",
"getType",
"(",
"'strtoupper'",
")",
";",
"$",
"complementPath",
"=",
"App",
"::",
"... | Set image url.
@uses \Eliasis\Framework\App::COMPLEMENT()
@uses \Eliasis\Framework\App::COMPLEMENT_URL()
@uses \Eliasis\Complement\Complement->$complement
@uses \Eliasis\Complement\Traits\ComplementHandler::getType() | [
"Set",
"image",
"url",
"."
] | d50e92cf01600ff4573bf1761c312069044748c3 | https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementHandler.php#L266-L293 | train |
eliasis-framework/complement | src/Traits/ComplementHandler.php | ComplementHandler.getType | private static function getType($mode = 'strtolower', $plural = true)
{
$namespace = get_called_class();
$class = explode('\\', $namespace);
$complement = strtolower(array_pop($class) . ($plural ? 's' : ''));
switch ($mode) {
case 'ucfirst':
return ucfirs... | php | private static function getType($mode = 'strtolower', $plural = true)
{
$namespace = get_called_class();
$class = explode('\\', $namespace);
$complement = strtolower(array_pop($class) . ($plural ? 's' : ''));
switch ($mode) {
case 'ucfirst':
return ucfirs... | [
"private",
"static",
"function",
"getType",
"(",
"$",
"mode",
"=",
"'strtolower'",
",",
"$",
"plural",
"=",
"true",
")",
"{",
"$",
"namespace",
"=",
"get_called_class",
"(",
")",
";",
"$",
"class",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"namespace",
... | Get complement type.
@param string $mode → ucfirst|strtoupper|strtolower
@param bool $plural → plural|singular
@return object → complement instance | [
"Get",
"complement",
"type",
"."
] | d50e92cf01600ff4573bf1761c312069044748c3 | https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementHandler.php#L303-L317 | train |
eliasis-framework/complement | src/Traits/ComplementHandler.php | ComplementHandler.addRoutes | private function addRoutes()
{
if (class_exists($Router = 'Josantonius\Router\Router')) {
if (isset($this->complement['routes'])) {
$Router::add($this->complement['routes']);
}
}
} | php | private function addRoutes()
{
if (class_exists($Router = 'Josantonius\Router\Router')) {
if (isset($this->complement['routes'])) {
$Router::add($this->complement['routes']);
}
}
} | [
"private",
"function",
"addRoutes",
"(",
")",
"{",
"if",
"(",
"class_exists",
"(",
"$",
"Router",
"=",
"'Josantonius\\Router\\Router'",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"complement",
"[",
"'routes'",
"]",
")",
")",
"{",
"$",
"... | Add complement routes if exists.
@uses \Josantonius\Router\Router::add
@uses \Eliasis\Complement\Complement->$complement | [
"Add",
"complement",
"routes",
"if",
"exists",
"."
] | d50e92cf01600ff4573bf1761c312069044748c3 | https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementHandler.php#L325-L332 | train |
Fulfillment-dot-com/api-wrapper-php | src/Api.php | Api.refreshAccessToken | public function refreshAccessToken()
{
$newToken = $this->http->requestAccessToken();
if (!is_null($newToken))
{
$this->config->setAccessToken($newToken);
$this->http = new Request($this->guzzle, $this->config, $this->climate);
if ($this->config->shouldStoreToken())
{
file_put_contents(Helper::ge... | php | public function refreshAccessToken()
{
$newToken = $this->http->requestAccessToken();
if (!is_null($newToken))
{
$this->config->setAccessToken($newToken);
$this->http = new Request($this->guzzle, $this->config, $this->climate);
if ($this->config->shouldStoreToken())
{
file_put_contents(Helper::ge... | [
"public",
"function",
"refreshAccessToken",
"(",
")",
"{",
"$",
"newToken",
"=",
"$",
"this",
"->",
"http",
"->",
"requestAccessToken",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"newToken",
")",
")",
"{",
"$",
"this",
"->",
"config",
"->",
... | Get a new access token
@return string|null
@throws Exceptions\MissingCredentialException
@throws Exceptions\UnauthorizedMerchantException | [
"Get",
"a",
"new",
"access",
"token"
] | f4352843d060bc1b460c1283f25c210c9b94d324 | https://github.com/Fulfillment-dot-com/api-wrapper-php/blob/f4352843d060bc1b460c1283f25c210c9b94d324/src/Api.php#L208-L222 | train |
modulusphp/utility | Command.php | Command.wait | public static function wait(string $args) : ?SymfonyProcess
{
$process = new SymfonyProcess('php ' . Accessor::$appRoot . 'craftsman ' . $args);
$process->start();
$process->wait();
$process->stop();
return $process;
} | php | public static function wait(string $args) : ?SymfonyProcess
{
$process = new SymfonyProcess('php ' . Accessor::$appRoot . 'craftsman ' . $args);
$process->start();
$process->wait();
$process->stop();
return $process;
} | [
"public",
"static",
"function",
"wait",
"(",
"string",
"$",
"args",
")",
":",
"?",
"SymfonyProcess",
"{",
"$",
"process",
"=",
"new",
"SymfonyProcess",
"(",
"'php '",
".",
"Accessor",
"::",
"$",
"appRoot",
".",
"'craftsman '",
".",
"$",
"args",
")",
";",... | Run and wait
@param string $args
@return SymfonyProcess $process | [
"Run",
"and",
"wait"
] | c1e127539b13d3ec8381e41c64b881e0701807f5 | https://github.com/modulusphp/utility/blob/c1e127539b13d3ec8381e41c64b881e0701807f5/Command.php#L47-L56 | train |
brunschgi/TerrificComposerBundle | Service/ModuleManager.php | ModuleManager.createModule | public function createModule(Module $module)
{
$dst = $this->rootDir.'/../src/Terrific/Module/'.StringUtils::camelize($module->getName());
if($this->toolbarMode === ToolbarListener::DEMO) {
// prevent module creation in demo mode
throw new \Exception('This action is not supp... | php | public function createModule(Module $module)
{
$dst = $this->rootDir.'/../src/Terrific/Module/'.StringUtils::camelize($module->getName());
if($this->toolbarMode === ToolbarListener::DEMO) {
// prevent module creation in demo mode
throw new \Exception('This action is not supp... | [
"public",
"function",
"createModule",
"(",
"Module",
"$",
"module",
")",
"{",
"$",
"dst",
"=",
"$",
"this",
"->",
"rootDir",
".",
"'/../src/Terrific/Module/'",
".",
"StringUtils",
"::",
"camelize",
"(",
"$",
"module",
"->",
"getName",
"(",
")",
")",
";",
... | Creates a Terrific Module
@param Module $module The module to create | [
"Creates",
"a",
"Terrific",
"Module"
] | 6eef4ace887c19ef166ab6654de385bc1ffbf5f1 | https://github.com/brunschgi/TerrificComposerBundle/blob/6eef4ace887c19ef166ab6654de385bc1ffbf5f1/Service/ModuleManager.php#L61-L75 | train |
brunschgi/TerrificComposerBundle | Service/ModuleManager.php | ModuleManager.createSkin | public function createSkin(Skin $skin)
{
$module = new Module();
$module->setName($skin->getModule());
$module->addSkin($skin);
$dst = $this->rootDir.'/../src/Terrific/Module/'.StringUtils::camelize($module->getName());
if($this->toolbarMode === ToolbarListener::DEMO) {
... | php | public function createSkin(Skin $skin)
{
$module = new Module();
$module->setName($skin->getModule());
$module->addSkin($skin);
$dst = $this->rootDir.'/../src/Terrific/Module/'.StringUtils::camelize($module->getName());
if($this->toolbarMode === ToolbarListener::DEMO) {
... | [
"public",
"function",
"createSkin",
"(",
"Skin",
"$",
"skin",
")",
"{",
"$",
"module",
"=",
"new",
"Module",
"(",
")",
";",
"$",
"module",
"->",
"setName",
"(",
"$",
"skin",
"->",
"getModule",
"(",
")",
")",
";",
"$",
"module",
"->",
"addSkin",
"("... | Creates a Terrific Skin
@param Skin $skin The skin to create | [
"Creates",
"a",
"Terrific",
"Skin"
] | 6eef4ace887c19ef166ab6654de385bc1ffbf5f1 | https://github.com/brunschgi/TerrificComposerBundle/blob/6eef4ace887c19ef166ab6654de385bc1ffbf5f1/Service/ModuleManager.php#L82-L100 | train |
brunschgi/TerrificComposerBundle | Service/ModuleManager.php | ModuleManager.getModules | public function getModules()
{
$modules = array();
$dir = $this->rootDir.'/../src/Terrific/Module/';
$finder = new Finder();
$finder->directories()->in($dir)->depth('== 0');
foreach ($finder as $file) {
$module = $file->getFilename();
$modules[$modu... | php | public function getModules()
{
$modules = array();
$dir = $this->rootDir.'/../src/Terrific/Module/';
$finder = new Finder();
$finder->directories()->in($dir)->depth('== 0');
foreach ($finder as $file) {
$module = $file->getFilename();
$modules[$modu... | [
"public",
"function",
"getModules",
"(",
")",
"{",
"$",
"modules",
"=",
"array",
"(",
")",
";",
"$",
"dir",
"=",
"$",
"this",
"->",
"rootDir",
".",
"'/../src/Terrific/Module/'",
";",
"$",
"finder",
"=",
"new",
"Finder",
"(",
")",
";",
"$",
"finder",
... | Gets all existing Modules
@return array All existing Module instances | [
"Gets",
"all",
"existing",
"Modules"
] | 6eef4ace887c19ef166ab6654de385bc1ffbf5f1 | https://github.com/brunschgi/TerrificComposerBundle/blob/6eef4ace887c19ef166ab6654de385bc1ffbf5f1/Service/ModuleManager.php#L107-L124 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.getCount | public function getCount($where = '', $variables = null)
{
$where = $this->formatWhereClause($where);
$response = $this->driver->query("select count(*) as numberOfItems from " . $this->getTable() . ' ' . $where . ";", $variables);
if (!$response->count()) return 0;
$response = $re... | php | public function getCount($where = '', $variables = null)
{
$where = $this->formatWhereClause($where);
$response = $this->driver->query("select count(*) as numberOfItems from " . $this->getTable() . ' ' . $where . ";", $variables);
if (!$response->count()) return 0;
$response = $re... | [
"public",
"function",
"getCount",
"(",
"$",
"where",
"=",
"''",
",",
"$",
"variables",
"=",
"null",
")",
"{",
"$",
"where",
"=",
"$",
"this",
"->",
"formatWhereClause",
"(",
"$",
"where",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"driver",
... | Return the number of items available in the table
@param string $where
@param string[] $variables
@return integer | [
"Return",
"the",
"number",
"of",
"items",
"available",
"in",
"the",
"table"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L119-L130 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.formatWhereClause | protected function formatWhereClause($where)
{
if (!empty($where)) {
if (stripos($where, 'where') === false || stripos($where, 'select') !== false) {
$where = ' where ' . $where;
}
}
return $where;
} | php | protected function formatWhereClause($where)
{
if (!empty($where)) {
if (stripos($where, 'where') === false || stripos($where, 'select') !== false) {
$where = ' where ' . $where;
}
}
return $where;
} | [
"protected",
"function",
"formatWhereClause",
"(",
"$",
"where",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"where",
")",
")",
"{",
"if",
"(",
"stripos",
"(",
"$",
"where",
",",
"'where'",
")",
"===",
"false",
"||",
"stripos",
"(",
"$",
"where",
... | Some simple checks for a where clause
@param $where
@return string | [
"Some",
"simple",
"checks",
"for",
"a",
"where",
"clause"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L138-L147 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.fetchAll | public function fetchAll($page, $pagination, $where)
{
$index = ceil(($page - 1) * $pagination);
$where = $this->formatWhereClause($where);
$sql = "
select " . $this->getMappingAsSQL() . "
from " . $this->getTable() . "
" . $where . "
limit " . $index . ',' . intval($pagination... | php | public function fetchAll($page, $pagination, $where)
{
$index = ceil(($page - 1) * $pagination);
$where = $this->formatWhereClause($where);
$sql = "
select " . $this->getMappingAsSQL() . "
from " . $this->getTable() . "
" . $where . "
limit " . $index . ',' . intval($pagination... | [
"public",
"function",
"fetchAll",
"(",
"$",
"page",
",",
"$",
"pagination",
",",
"$",
"where",
")",
"{",
"$",
"index",
"=",
"ceil",
"(",
"(",
"$",
"page",
"-",
"1",
")",
"*",
"$",
"pagination",
")",
";",
"$",
"where",
"=",
"$",
"this",
"->",
"f... | Actually fetch all the items with the given params
@param $page
@param $pagination
@param $where
@return \stdClass[] | [
"Actually",
"fetch",
"all",
"the",
"items",
"with",
"the",
"given",
"params"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L171-L186 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.fetchByColumn | protected function fetchByColumn($column, $value)
{
/**
* @var \Slab\Database\Providers\BaseResponse $response
*/
$response = $this->driver->query("select " . $this->getMappingAsSQL() . " from " . $this->getTable() . " where `" . $column . "` = ? limit 1;", array($value), static::D... | php | protected function fetchByColumn($column, $value)
{
/**
* @var \Slab\Database\Providers\BaseResponse $response
*/
$response = $this->driver->query("select " . $this->getMappingAsSQL() . " from " . $this->getTable() . " where `" . $column . "` = ? limit 1;", array($value), static::D... | [
"protected",
"function",
"fetchByColumn",
"(",
"$",
"column",
",",
"$",
"value",
")",
"{",
"/**\n * @var \\Slab\\Database\\Providers\\BaseResponse $response\n */",
"$",
"response",
"=",
"$",
"this",
"->",
"driver",
"->",
"query",
"(",
"\"select \"",
".",... | Do actual mysql query by specific criteria
@param string $column
@param string $value
@return NULL|mixed | [
"Do",
"actual",
"mysql",
"query",
"by",
"specific",
"criteria"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L195-L203 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.getPrimaryKey | public function getPrimaryKey($tableAlias = '')
{
$output = '';
if (!empty($tableAlias)) {
$output .= '`' . $tableAlias . '`.';
}
$output .= '`'.static::ID_COLUMN.'`';
return $output;
} | php | public function getPrimaryKey($tableAlias = '')
{
$output = '';
if (!empty($tableAlias)) {
$output .= '`' . $tableAlias . '`.';
}
$output .= '`'.static::ID_COLUMN.'`';
return $output;
} | [
"public",
"function",
"getPrimaryKey",
"(",
"$",
"tableAlias",
"=",
"''",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"tableAlias",
")",
")",
"{",
"$",
"output",
".=",
"'`'",
".",
"$",
"tableAlias",
".",
"'`.'",
";",... | Return primary key qualified or not
@param string $tableAlias
@return string | [
"Return",
"primary",
"key",
"qualified",
"or",
"not"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L250-L261 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.getColumnsAsSQL | public function getColumnsAsSQL($tableAlias = '', $columnPrefix = '')
{
if (empty($this->mapping)) {
return '*';
}
$output = '';
foreach ($this->mapping as $column => $mappingField) {
if (!empty($output)) {
$output .= ',';
}
... | php | public function getColumnsAsSQL($tableAlias = '', $columnPrefix = '')
{
if (empty($this->mapping)) {
return '*';
}
$output = '';
foreach ($this->mapping as $column => $mappingField) {
if (!empty($output)) {
$output .= ',';
}
... | [
"public",
"function",
"getColumnsAsSQL",
"(",
"$",
"tableAlias",
"=",
"''",
",",
"$",
"columnPrefix",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"mapping",
")",
")",
"{",
"return",
"'*'",
";",
"}",
"$",
"output",
"=",
"''",
";... | Get raw columns as SQL, with some prefix options
@param string $tableAlias
@param string $columnPrefix
@return string | [
"Get",
"raw",
"columns",
"as",
"SQL",
"with",
"some",
"prefix",
"options"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L270-L294 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.resetMappingOptions | protected function resetMappingOptions()
{
$this->mappingOptions = new \stdClass();
$this->mappingOptions->destructiveMapping = false;
$this->mappingOptions->assignNonMappedColumns = true;
$this->mappingOptions->fieldPrefix = '';
$this->mappingOptions->throwOnEmptyId = false;... | php | protected function resetMappingOptions()
{
$this->mappingOptions = new \stdClass();
$this->mappingOptions->destructiveMapping = false;
$this->mappingOptions->assignNonMappedColumns = true;
$this->mappingOptions->fieldPrefix = '';
$this->mappingOptions->throwOnEmptyId = false;... | [
"protected",
"function",
"resetMappingOptions",
"(",
")",
"{",
"$",
"this",
"->",
"mappingOptions",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"this",
"->",
"mappingOptions",
"->",
"destructiveMapping",
"=",
"false",
";",
"$",
"this",
"->",
"mappingOp... | Reset mapping options | [
"Reset",
"mapping",
"options"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L299-L307 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.setDestructiveMapping | public function setDestructiveMapping($destructiveMapping)
{
if (empty($this->mappingOptions)) $this->resetMappingOptions();
$this->mappingOptions->destructiveMapping = $destructiveMapping;
return $this;
} | php | public function setDestructiveMapping($destructiveMapping)
{
if (empty($this->mappingOptions)) $this->resetMappingOptions();
$this->mappingOptions->destructiveMapping = $destructiveMapping;
return $this;
} | [
"public",
"function",
"setDestructiveMapping",
"(",
"$",
"destructiveMapping",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"mappingOptions",
")",
")",
"$",
"this",
"->",
"resetMappingOptions",
"(",
")",
";",
"$",
"this",
"->",
"mappingOptions",
"->... | Set destructive mapping option
@param $destructiveMapping
@return $this | [
"Set",
"destructive",
"mapping",
"option"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L328-L335 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.setAssignNonMappedColumns | public function setAssignNonMappedColumns($assignNonMappedColumns)
{
if (empty($this->mappingOptions)) $this->resetMappingOptions();
$this->mappingOptions->assignNonMappedColumns = $assignNonMappedColumns;
return $this;
} | php | public function setAssignNonMappedColumns($assignNonMappedColumns)
{
if (empty($this->mappingOptions)) $this->resetMappingOptions();
$this->mappingOptions->assignNonMappedColumns = $assignNonMappedColumns;
return $this;
} | [
"public",
"function",
"setAssignNonMappedColumns",
"(",
"$",
"assignNonMappedColumns",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"mappingOptions",
")",
")",
"$",
"this",
"->",
"resetMappingOptions",
"(",
")",
";",
"$",
"this",
"->",
"mappingOptions... | Set flag for assigning non-mapped columns
@param $assignNonMappedColumns
@return $this | [
"Set",
"flag",
"for",
"assigning",
"non",
"-",
"mapped",
"columns"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L343-L350 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.setFieldPrefix | public function setFieldPrefix($fieldPrefix)
{
if (empty($this->mappingOptions)) $this->resetMappingOptions();
$this->mappingOptions->fieldPrefix = $fieldPrefix;
return $this;
} | php | public function setFieldPrefix($fieldPrefix)
{
if (empty($this->mappingOptions)) $this->resetMappingOptions();
$this->mappingOptions->fieldPrefix = $fieldPrefix;
return $this;
} | [
"public",
"function",
"setFieldPrefix",
"(",
"$",
"fieldPrefix",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"mappingOptions",
")",
")",
"$",
"this",
"->",
"resetMappingOptions",
"(",
")",
";",
"$",
"this",
"->",
"mappingOptions",
"->",
"fieldPre... | Set mapping option field prefix
@param $fieldPrefix
@return $this | [
"Set",
"mapping",
"option",
"field",
"prefix"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L358-L365 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.setThrowIfEmptyId | public function setThrowIfEmptyId($throwOnEmptyId)
{
if (empty($this->mappingOptions)) $this->resetMappingOptions();
$this->mappingOptions->throwOnEmptyId = $throwOnEmptyId;
return $this;
} | php | public function setThrowIfEmptyId($throwOnEmptyId)
{
if (empty($this->mappingOptions)) $this->resetMappingOptions();
$this->mappingOptions->throwOnEmptyId = $throwOnEmptyId;
return $this;
} | [
"public",
"function",
"setThrowIfEmptyId",
"(",
"$",
"throwOnEmptyId",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"mappingOptions",
")",
")",
"$",
"this",
"->",
"resetMappingOptions",
"(",
")",
";",
"$",
"this",
"->",
"mappingOptions",
"->",
"th... | Throw an exception if the main id doesn't get mapped?
@param $throwOnEmptyId
@return $this | [
"Throw",
"an",
"exception",
"if",
"the",
"main",
"id",
"doesn",
"t",
"get",
"mapped?"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L373-L380 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.mapObject | protected function mapObject($databaseResult)
{
foreach ($databaseResult as $column => $value) {
if (!empty($this->mapping[$column])) {
list($variable, $modifier) = $this->splitVariableWithModifier($this->mapping[$column]);
$this->$variable = $this->getMappedValu... | php | protected function mapObject($databaseResult)
{
foreach ($databaseResult as $column => $value) {
if (!empty($this->mapping[$column])) {
list($variable, $modifier) = $this->splitVariableWithModifier($this->mapping[$column]);
$this->$variable = $this->getMappedValu... | [
"protected",
"function",
"mapObject",
"(",
"$",
"databaseResult",
")",
"{",
"foreach",
"(",
"$",
"databaseResult",
"as",
"$",
"column",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"mapping",
"[",
"$",
"column",
"]",
... | Map a single object to this instance
@param \stdClass $databaseResult | [
"Map",
"a",
"single",
"object",
"to",
"this",
"instance"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L387-L398 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.splitVariableWithModifier | protected function splitVariableWithModifier($column)
{
$modifier = false;
if (strpos($column, ':') !== false) {
return explode(':', $column);
}
return [$column, false];
} | php | protected function splitVariableWithModifier($column)
{
$modifier = false;
if (strpos($column, ':') !== false) {
return explode(':', $column);
}
return [$column, false];
} | [
"protected",
"function",
"splitVariableWithModifier",
"(",
"$",
"column",
")",
"{",
"$",
"modifier",
"=",
"false",
";",
"if",
"(",
"strpos",
"(",
"$",
"column",
",",
"':'",
")",
"!==",
"false",
")",
"{",
"return",
"explode",
"(",
"':'",
",",
"$",
"colu... | Splits variable with a modifier
@param string $column
@return array | [
"Splits",
"variable",
"with",
"a",
"modifier"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L454-L462 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.modifierDate | protected function modifierDate($input)
{
if (empty($input)) return NULL;
//if ($input == '0000-00-00 00:00:00') return NULL;
if ($input instanceof \DateTime) return $input;
try {
$output = new \DateTime($input);
$output->setTimeZone(new \DateTimeZone('Ameri... | php | protected function modifierDate($input)
{
if (empty($input)) return NULL;
//if ($input == '0000-00-00 00:00:00') return NULL;
if ($input instanceof \DateTime) return $input;
try {
$output = new \DateTime($input);
$output->setTimeZone(new \DateTimeZone('Ameri... | [
"protected",
"function",
"modifierDate",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"input",
")",
")",
"return",
"NULL",
";",
"//if ($input == '0000-00-00 00:00:00') return NULL;",
"if",
"(",
"$",
"input",
"instanceof",
"\\",
"DateTime",
")",
"... | Return a date time modified input
@param string $input
@return \DateTime|NULL | [
"Return",
"a",
"date",
"time",
"modified",
"input"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L493-L510 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.modifierTimezone | protected function modifierTimezone($input)
{
if ($input instanceof \DateTimeZone) return $input;
try {
$output = new \DateTimeZone($input);
return $output;
} catch (\Exception $exception) {
if (!empty($this->log)) $this->log->error("Failed to convert \\... | php | protected function modifierTimezone($input)
{
if ($input instanceof \DateTimeZone) return $input;
try {
$output = new \DateTimeZone($input);
return $output;
} catch (\Exception $exception) {
if (!empty($this->log)) $this->log->error("Failed to convert \\... | [
"protected",
"function",
"modifierTimezone",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"$",
"input",
"instanceof",
"\\",
"DateTimeZone",
")",
"return",
"$",
"input",
";",
"try",
"{",
"$",
"output",
"=",
"new",
"\\",
"DateTimeZone",
"(",
"$",
"input",
")",
... | Return a timezone modified input
@param string $input
@return \DateTimeZone|NULL | [
"Return",
"a",
"timezone",
"modified",
"input"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L518-L531 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.buildModel | public function buildModel($databaseResult = null)
{
$this->resetMappingOptions();
if (empty($databaseResult)) return;
$this->mapObject($databaseResult);
} | php | public function buildModel($databaseResult = null)
{
$this->resetMappingOptions();
if (empty($databaseResult)) return;
$this->mapObject($databaseResult);
} | [
"public",
"function",
"buildModel",
"(",
"$",
"databaseResult",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"resetMappingOptions",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"databaseResult",
")",
")",
"return",
";",
"$",
"this",
"->",
"mapObject",
"(",
... | Map the object to itself
@param \stdClass $databaseResult - The database result to map
@param bool $assignNonMappedColumns - Leave fields that aren't mapped in the output object
@param bool $destructiveMapping - Remove field from databaseResult upon mapping
@param string $fieldPrefix - An optional prefix for fields in... | [
"Map",
"the",
"object",
"to",
"itself"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L541-L548 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.performMappingOnObject | public function performMappingOnObject(DataObject $object)
{
//By default, we already have our data mapped in the object (hopefully properly)
//But we do need to convert things that may need converting
foreach ($this->mapping as $field => $variable) {
$modifier = false;
... | php | public function performMappingOnObject(DataObject $object)
{
//By default, we already have our data mapped in the object (hopefully properly)
//But we do need to convert things that may need converting
foreach ($this->mapping as $field => $variable) {
$modifier = false;
... | [
"public",
"function",
"performMappingOnObject",
"(",
"DataObject",
"$",
"object",
")",
"{",
"//By default, we already have our data mapped in the object (hopefully properly)",
"//But we do need to convert things that may need converting",
"foreach",
"(",
"$",
"this",
"->",
"mapping",... | Array walk function, overridable
The response object will automatically try to fire this when pulling a list of automapped objects.
@param DataObject $Object | [
"Array",
"walk",
"function",
"overridable"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L557-L570 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.insertObject | public function insertObject(DataObject $object, $skipID = true)
{
$data = [];
foreach ($this->mapping as $column => $local) {
if ($skipID && ($column == static::ID_COLUMN)) continue;
$modifier = false;
if (strpos($local, ':') !== false) {
list($... | php | public function insertObject(DataObject $object, $skipID = true)
{
$data = [];
foreach ($this->mapping as $column => $local) {
if ($skipID && ($column == static::ID_COLUMN)) continue;
$modifier = false;
if (strpos($local, ':') !== false) {
list($... | [
"public",
"function",
"insertObject",
"(",
"DataObject",
"$",
"object",
",",
"$",
"skipID",
"=",
"true",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"mapping",
"as",
"$",
"column",
"=>",
"$",
"local",
")",
"{",
"if... | Attempts to insert the object into the table
@param DataObject $object
@param boolean $skipID
@return bool|\Slab\Database\Providers\BaseResponse | [
"Attempts",
"to",
"insert",
"the",
"object",
"into",
"the",
"table"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L589-L634 | train |
SlabPHP/database | src/Models/MySQL/Loader.php | Loader.getUnmappedArray | public function getUnmappedArray(DataObject $object)
{
$output = [];
foreach ($this->mapping as $unmappedField => $mappedField) {
if (strpos($mappedField, ':') !== false) {
list($mappedField, $modifier) = explode(':', $mappedField);
}
$output[$un... | php | public function getUnmappedArray(DataObject $object)
{
$output = [];
foreach ($this->mapping as $unmappedField => $mappedField) {
if (strpos($mappedField, ':') !== false) {
list($mappedField, $modifier) = explode(':', $mappedField);
}
$output[$un... | [
"public",
"function",
"getUnmappedArray",
"(",
"DataObject",
"$",
"object",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"mapping",
"as",
"$",
"unmappedField",
"=>",
"$",
"mappedField",
")",
"{",
"if",
"(",
"strpos",
... | Return an array of an object as an unmapped aray, useful for dumping defaults
@return array | [
"Return",
"an",
"array",
"of",
"an",
"object",
"as",
"an",
"unmapped",
"aray",
"useful",
"for",
"dumping",
"defaults"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Loader.php#L641-L654 | train |
togucms/TemplateBundle | Loader/FilesystemLoader.php | FilesystemLoader.findFilename | public function findFilename($name) {
$logicalName = (string) $name;
if(isset($this->cache[$logicalName])) {
return $this->cache[$logicalName];
}
try {
$template = $this->parser->parse($name);
$file = $this->locator->locate($template);
} catch (\Exception $e) {
... | php | public function findFilename($name) {
$logicalName = (string) $name;
if(isset($this->cache[$logicalName])) {
return $this->cache[$logicalName];
}
try {
$template = $this->parser->parse($name);
$file = $this->locator->locate($template);
} catch (\Exception $e) {
... | [
"public",
"function",
"findFilename",
"(",
"$",
"name",
")",
"{",
"$",
"logicalName",
"=",
"(",
"string",
")",
"$",
"name",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
"$",
"logicalName",
"]",
")",
")",
"{",
"return",
"$",
"this"... | Helper function for getting a template file name.
@param string $name
@return string Template file name | [
"Helper",
"function",
"for",
"getting",
"a",
"template",
"file",
"name",
"."
] | b07d3bff948d547e95f81154503dfa3a333eef64 | https://github.com/togucms/TemplateBundle/blob/b07d3bff948d547e95f81154503dfa3a333eef64/Loader/FilesystemLoader.php#L57-L71 | train |
koolkode/security | src/Cipher/Cipher.php | Cipher.decryptMessage | public function decryptMessage($message)
{
$calgo = $this->config->getCipherAlgorithm();
$cmode = $this->config->getCipherMode();
$malgo = $this->config->getHmacAlgorithm();
$size = mcrypt_get_iv_size($calgo, $cmode);
$keySize = mcrypt_get_key_size($calgo, $cm... | php | public function decryptMessage($message)
{
$calgo = $this->config->getCipherAlgorithm();
$cmode = $this->config->getCipherMode();
$malgo = $this->config->getHmacAlgorithm();
$size = mcrypt_get_iv_size($calgo, $cmode);
$keySize = mcrypt_get_key_size($calgo, $cm... | [
"public",
"function",
"decryptMessage",
"(",
"$",
"message",
")",
"{",
"$",
"calgo",
"=",
"$",
"this",
"->",
"config",
"->",
"getCipherAlgorithm",
"(",
")",
";",
"$",
"cmode",
"=",
"$",
"this",
"->",
"config",
"->",
"getCipherMode",
"(",
")",
";",
"$",... | Decrypts a message with auhtenticity check.
@param string $message Encoded message.
@return mixed Plaintext message.
@throws IntegrityCheckFailedException | [
"Decrypts",
"a",
"message",
"with",
"auhtenticity",
"check",
"."
] | d3d8d42392f520754847d29b6df19aaa38c79e8e | https://github.com/koolkode/security/blob/d3d8d42392f520754847d29b6df19aaa38c79e8e/src/Cipher/Cipher.php#L39-L68 | train |
koolkode/security | src/Cipher/Cipher.php | Cipher.encryptMessage | public function encryptMessage($input)
{
$input = (string)$input;
$calgo = $this->config->getCipherAlgorithm();
$cmode = $this->config->getCipherMode();
$malgo = $this->config->getHmacAlgorithm();
$size = mcrypt_get_iv_size($calgo, $cmode);
... | php | public function encryptMessage($input)
{
$input = (string)$input;
$calgo = $this->config->getCipherAlgorithm();
$cmode = $this->config->getCipherMode();
$malgo = $this->config->getHmacAlgorithm();
$size = mcrypt_get_iv_size($calgo, $cmode);
... | [
"public",
"function",
"encryptMessage",
"(",
"$",
"input",
")",
"{",
"$",
"input",
"=",
"(",
"string",
")",
"$",
"input",
";",
"$",
"calgo",
"=",
"$",
"this",
"->",
"config",
"->",
"getCipherAlgorithm",
"(",
")",
";",
"$",
"cmode",
"=",
"$",
"this",
... | Encrypts the given message and adds an authenticity code.
<pre><b>CIPHERTEXT</b> := IV + ENCRYPT(CLEARTEXT, PBKDF(ENCRYPTION_KEY))
<b>MESSAGE</b> := CIPHERTEXT + HMAC(CIPHERTEXT, PBKDF(HMAC_KEY))
</pre>
@param string $input Plaintext message.
@return string Encrypted message. | [
"Encrypts",
"the",
"given",
"message",
"and",
"adds",
"an",
"authenticity",
"code",
"."
] | d3d8d42392f520754847d29b6df19aaa38c79e8e | https://github.com/koolkode/security/blob/d3d8d42392f520754847d29b6df19aaa38c79e8e/src/Cipher/Cipher.php#L80-L103 | train |
ptlis/grep-db | src/Search/Result/RowSearchResult.php | RowSearchResult.getColumnResult | public function getColumnResult(string $columnName): FieldSearchResult
{
if (!$this->hasColumnResult($columnName)) {
throw new \RuntimeException('Could not find changed column named "' . $columnName . '"');
}
return $this->fieldMatchList[$columnName];
} | php | public function getColumnResult(string $columnName): FieldSearchResult
{
if (!$this->hasColumnResult($columnName)) {
throw new \RuntimeException('Could not find changed column named "' . $columnName . '"');
}
return $this->fieldMatchList[$columnName];
} | [
"public",
"function",
"getColumnResult",
"(",
"string",
"$",
"columnName",
")",
":",
"FieldSearchResult",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasColumnResult",
"(",
"$",
"columnName",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Could... | Returns the column result matching the passed name. | [
"Returns",
"the",
"column",
"result",
"matching",
"the",
"passed",
"name",
"."
] | 7abff68982d426690d0515ccd7adc7a2e3d72a3f | https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Search/Result/RowSearchResult.php#L78-L85 | train |
prosoftSolutions/Pager | DependencyInjection/WhiteOctoberPagerfantaExtension.php | WhiteOctoberPagerfantaExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$processor = new Processor();
$config = $processor->processConfiguration($configuration, $configs);
$container->setParameter('white_october_pagerfanta.default_view', $config['de... | php | public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$processor = new Processor();
$config = $processor->processConfiguration($configuration, $configs);
$container->setParameter('white_october_pagerfanta.default_view', $config['de... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"configuration",
"=",
"new",
"Configuration",
"(",
")",
";",
"$",
"processor",
"=",
"new",
"Processor",
"(",
")",
";",
"$",
"config",
"=... | Responds to the "white_october_pagerfanta" configuration parameter.
@param array $configs
@param ContainerBuilder $container | [
"Responds",
"to",
"the",
"white_october_pagerfanta",
"configuration",
"parameter",
"."
] | 96446ee22caedc0b9bb486d9ffe7a50b6c13177f | https://github.com/prosoftSolutions/Pager/blob/96446ee22caedc0b9bb486d9ffe7a50b6c13177f/DependencyInjection/WhiteOctoberPagerfantaExtension.php#L33-L53 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Expression/Condition/Logical/Logical.php | Logical.getAttributeConditions | public function getAttributeConditions($attributeName, $unindexablePredicates = false)
{
return array_filter(
$this->parts,
function (Condition $part) use ($attributeName, $unindexablePredicates) {
if ($part instanceof self) {
return $part->getAttr... | php | public function getAttributeConditions($attributeName, $unindexablePredicates = false)
{
return array_filter(
$this->parts,
function (Condition $part) use ($attributeName, $unindexablePredicates) {
if ($part instanceof self) {
return $part->getAttr... | [
"public",
"function",
"getAttributeConditions",
"(",
"$",
"attributeName",
",",
"$",
"unindexablePredicates",
"=",
"false",
")",
"{",
"return",
"array_filter",
"(",
"$",
"this",
"->",
"parts",
",",
"function",
"(",
"Condition",
"$",
"part",
")",
"use",
"(",
... | Return all conditions of the specified type in this expression which use
the indicated attribute as an operand.
@param string $attributeName
@param bool $unindexablePredicates Whether to return only indexable predicates
(using AND) or only unindexable predicates
(using OR or NOT)
@return Condition[] | [
"Return",
"all",
"conditions",
"of",
"the",
"specified",
"type",
"in",
"this",
"expression",
"which",
"use",
"the",
"indicated",
"attribute",
"as",
"an",
"operand",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Expression/Condition/Logical/Logical.php#L43-L55 | train |
ScaraMVC/Framework | src/Scara/Foundation/Application.php | Application.boot | public function boot()
{
$this->loadConfig();
$this->registerExceptionHandler();
$this->registerProviders();
$this->registerAliases();
$this->registerScaraMasterSessionToken();
} | php | public function boot()
{
$this->loadConfig();
$this->registerExceptionHandler();
$this->registerProviders();
$this->registerAliases();
$this->registerScaraMasterSessionToken();
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"this",
"->",
"loadConfig",
"(",
")",
";",
"$",
"this",
"->",
"registerExceptionHandler",
"(",
")",
";",
"$",
"this",
"->",
"registerProviders",
"(",
")",
";",
"$",
"this",
"->",
"registerAliases",
"(",
... | Handles registering Scara's pre-execution status.
@return void | [
"Handles",
"registering",
"Scara",
"s",
"pre",
"-",
"execution",
"status",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Foundation/Application.php#L58-L65 | train |
ScaraMVC/Framework | src/Scara/Foundation/Application.php | Application.loadConfig | private function loadConfig()
{
$this->_config = new Configuration();
$this->_config->from('app');
// let's go ahead and set timezone
date_default_timezone_set($this->_config->get('timezone'));
} | php | private function loadConfig()
{
$this->_config = new Configuration();
$this->_config->from('app');
// let's go ahead and set timezone
date_default_timezone_set($this->_config->get('timezone'));
} | [
"private",
"function",
"loadConfig",
"(",
")",
"{",
"$",
"this",
"->",
"_config",
"=",
"new",
"Configuration",
"(",
")",
";",
"$",
"this",
"->",
"_config",
"->",
"from",
"(",
"'app'",
")",
";",
"// let's go ahead and set timezone",
"date_default_timezone_set",
... | Loads the application's main configuration.
@return void | [
"Loads",
"the",
"application",
"s",
"main",
"configuration",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Foundation/Application.php#L84-L91 | train |
ScaraMVC/Framework | src/Scara/Foundation/Application.php | Application.registerControllers | private function registerControllers()
{
$this->_controller = new Controller();
$this->_controller->load($this->_router,
$this->_config->get('basepath'));
} | php | private function registerControllers()
{
$this->_controller = new Controller();
$this->_controller->load($this->_router,
$this->_config->get('basepath'));
} | [
"private",
"function",
"registerControllers",
"(",
")",
"{",
"$",
"this",
"->",
"_controller",
"=",
"new",
"Controller",
"(",
")",
";",
"$",
"this",
"->",
"_controller",
"->",
"load",
"(",
"$",
"this",
"->",
"_router",
",",
"$",
"this",
"->",
"_config",
... | Responsible for registering the app controllers.
@return void | [
"Responsible",
"for",
"registering",
"the",
"app",
"controllers",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Foundation/Application.php#L143-L148 | train |
ScaraMVC/Framework | src/Scara/Foundation/Application.php | Application.registerScaraMasterSessionToken | private function registerScaraMasterSessionToken()
{
$s = SessionInitializer::init();
$h = new OpenSslHasher();
if (!$s->has('SCARA_SESSION_TOKEN')) {
$token = substr($h->tokenize($h->random_string(16), time()), 0, 16);
$session = $h->tokenize($token, hash('sha256', ... | php | private function registerScaraMasterSessionToken()
{
$s = SessionInitializer::init();
$h = new OpenSslHasher();
if (!$s->has('SCARA_SESSION_TOKEN')) {
$token = substr($h->tokenize($h->random_string(16), time()), 0, 16);
$session = $h->tokenize($token, hash('sha256', ... | [
"private",
"function",
"registerScaraMasterSessionToken",
"(",
")",
"{",
"$",
"s",
"=",
"SessionInitializer",
"::",
"init",
"(",
")",
";",
"$",
"h",
"=",
"new",
"OpenSslHasher",
"(",
")",
";",
"if",
"(",
"!",
"$",
"s",
"->",
"has",
"(",
"'SCARA_SESSION_T... | Registers Scara's master session.
@return void | [
"Registers",
"Scara",
"s",
"master",
"session",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Foundation/Application.php#L155-L166 | train |
infusephp/cron | src/Libs/Runner.php | Runner.setUp | private function setUp($class, Run $run)
{
if (!$class) {
$run->writeOutput("Missing `class` parameter on {$this->jobModel->id} job")
->setResult(Run::RESULT_FAILED);
return false;
}
if (!class_exists($class)) {
$run->writeOutput("$class ... | php | private function setUp($class, Run $run)
{
if (!$class) {
$run->writeOutput("Missing `class` parameter on {$this->jobModel->id} job")
->setResult(Run::RESULT_FAILED);
return false;
}
if (!class_exists($class)) {
$run->writeOutput("$class ... | [
"private",
"function",
"setUp",
"(",
"$",
"class",
",",
"Run",
"$",
"run",
")",
"{",
"if",
"(",
"!",
"$",
"class",
")",
"{",
"$",
"run",
"->",
"writeOutput",
"(",
"\"Missing `class` parameter on {$this->jobModel->id} job\"",
")",
"->",
"setResult",
"(",
"Run... | Sets up an invokable class for a scheduled job run.
@param string $class
@param Run $run
@return callable|false | [
"Sets",
"up",
"an",
"invokable",
"class",
"for",
"a",
"scheduled",
"job",
"run",
"."
] | 783f6078b455a48415efeba0a6ee97ab17a3a903 | https://github.com/infusephp/cron/blob/783f6078b455a48415efeba0a6ee97ab17a3a903/src/Libs/Runner.php#L135-L159 | train |
infusephp/cron | src/Libs/Runner.php | Runner.invoke | private function invoke(callable $job, Run $run)
{
try {
ob_start();
$ret = call_user_func($job, $run);
$result = Run::RESULT_SUCCEEDED;
if (false === $ret) {
$result = Run::RESULT_FAILED;
}
return $run->writeOutput(ob... | php | private function invoke(callable $job, Run $run)
{
try {
ob_start();
$ret = call_user_func($job, $run);
$result = Run::RESULT_SUCCEEDED;
if (false === $ret) {
$result = Run::RESULT_FAILED;
}
return $run->writeOutput(ob... | [
"private",
"function",
"invoke",
"(",
"callable",
"$",
"job",
",",
"Run",
"$",
"run",
")",
"{",
"try",
"{",
"ob_start",
"(",
")",
";",
"$",
"ret",
"=",
"call_user_func",
"(",
"$",
"job",
",",
"$",
"run",
")",
";",
"$",
"result",
"=",
"Run",
"::",... | Executes the actual job.
@param Run $run
@return Run | [
"Executes",
"the",
"actual",
"job",
"."
] | 783f6078b455a48415efeba0a6ee97ab17a3a903 | https://github.com/infusephp/cron/blob/783f6078b455a48415efeba0a6ee97ab17a3a903/src/Libs/Runner.php#L168-L190 | train |
infusephp/cron | src/Libs/Runner.php | Runner.saveRun | private function saveRun(Run $run)
{
$this->jobModel->last_ran = time();
$this->jobModel->last_run_succeeded = $run->succeeded();
$this->jobModel->last_run_output = $run->getOutput();
$this->jobModel->save();
} | php | private function saveRun(Run $run)
{
$this->jobModel->last_ran = time();
$this->jobModel->last_run_succeeded = $run->succeeded();
$this->jobModel->last_run_output = $run->getOutput();
$this->jobModel->save();
} | [
"private",
"function",
"saveRun",
"(",
"Run",
"$",
"run",
")",
"{",
"$",
"this",
"->",
"jobModel",
"->",
"last_ran",
"=",
"time",
"(",
")",
";",
"$",
"this",
"->",
"jobModel",
"->",
"last_run_succeeded",
"=",
"$",
"run",
"->",
"succeeded",
"(",
")",
... | Saves the run attempt.
@param Run $run | [
"Saves",
"the",
"run",
"attempt",
"."
] | 783f6078b455a48415efeba0a6ee97ab17a3a903 | https://github.com/infusephp/cron/blob/783f6078b455a48415efeba0a6ee97ab17a3a903/src/Libs/Runner.php#L197-L203 | train |
pdyn/base | ErrorHandler.php | ErrorHandler.format_backtrace | public static function format_backtrace($backtrace) {
global $CFG;
$html = '';
$i = count($backtrace);
foreach ($backtrace as $trace) {
$file = (isset($trace['file'])) ? str_replace($CFG->base_absroot, '', $trace['file']) : 'unknown';
$line = 'Line: '. ((isset($trace['line'])) ? $trace['line'] : '-');
... | php | public static function format_backtrace($backtrace) {
global $CFG;
$html = '';
$i = count($backtrace);
foreach ($backtrace as $trace) {
$file = (isset($trace['file'])) ? str_replace($CFG->base_absroot, '', $trace['file']) : 'unknown';
$line = 'Line: '. ((isset($trace['line'])) ? $trace['line'] : '-');
... | [
"public",
"static",
"function",
"format_backtrace",
"(",
"$",
"backtrace",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"html",
"=",
"''",
";",
"$",
"i",
"=",
"count",
"(",
"$",
"backtrace",
")",
";",
"foreach",
"(",
"$",
"backtrace",
"as",
"$",
"trace"... | Format a backtrace for better display.
@param array $backtrace A backtrace from debug_backtrace.
@return string Html that better displays the backtrace. | [
"Format",
"a",
"backtrace",
"for",
"better",
"display",
"."
] | 0b93961693954a6b4e1c6df7e345e5cdf07f26ff | https://github.com/pdyn/base/blob/0b93961693954a6b4e1c6df7e345e5cdf07f26ff/ErrorHandler.php#L93-L129 | train |
pdyn/base | ErrorHandler.php | ErrorHandler.error_handler | public static function error_handler($errcode, $errstr, $errfile, $errline, $errcontext) {
throw new \Exception($errstr.' in '.$errfile.' on line '.$errline, $errcode);
} | php | public static function error_handler($errcode, $errstr, $errfile, $errline, $errcontext) {
throw new \Exception($errstr.' in '.$errfile.' on line '.$errline, $errcode);
} | [
"public",
"static",
"function",
"error_handler",
"(",
"$",
"errcode",
",",
"$",
"errstr",
",",
"$",
"errfile",
",",
"$",
"errline",
",",
"$",
"errcontext",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"$",
"errstr",
".",
"' in '",
".",
"$",
"errfi... | Handle PHP errors.
@param int $errcode The error code.
@param string $errstr The error description
@param string $errfile The file the error occurred in.
@param int $errline The line the error occurred on. | [
"Handle",
"PHP",
"errors",
"."
] | 0b93961693954a6b4e1c6df7e345e5cdf07f26ff | https://github.com/pdyn/base/blob/0b93961693954a6b4e1c6df7e345e5cdf07f26ff/ErrorHandler.php#L139-L141 | train |
pdyn/base | ErrorHandler.php | ErrorHandler.write_error_html | public static function write_error_html($errtitle, $errdetails, $errcode, $backtrace = null) {
global $USR;
?>
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title><?php ec... | php | public static function write_error_html($errtitle, $errdetails, $errcode, $backtrace = null) {
global $USR;
?>
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title><?php ec... | [
"public",
"static",
"function",
"write_error_html",
"(",
"$",
"errtitle",
",",
"$",
"errdetails",
",",
"$",
"errcode",
",",
"$",
"backtrace",
"=",
"null",
")",
"{",
"global",
"$",
"USR",
";",
"?>\n\t\t<!DOCTYPE HTML>\n\t\t<html xmlns=\"http://www.w3.org/1999/xhtml\" l... | For handle-able errors, print out our custom error screen.
@param string $errtitle The title of the error.
@param string $errdetails Details of the error.
@param string $errcode (Optional) An error code.
@param string $backtrace (Optional) A backtrace. | [
"For",
"handle",
"-",
"able",
"errors",
"print",
"out",
"our",
"custom",
"error",
"screen",
"."
] | 0b93961693954a6b4e1c6df7e345e5cdf07f26ff | https://github.com/pdyn/base/blob/0b93961693954a6b4e1c6df7e345e5cdf07f26ff/ErrorHandler.php#L151-L210 | train |
mrofi/video-info | src/DailyMotion.php | DailyMotion.getDailyMotionId | public function getDailyMotionId($url)
{
if (preg_match('!^.+dailymotion\.com/(video|hub)/([^_]+)[^#]*(#video=([^_&]+))?|(dai\.ly/([^_]+))!', $url, $m)) {
if (isset($m[6])) {
return $m[6];
}
if (isset($m[4])) {
return $m[4];
}
... | php | public function getDailyMotionId($url)
{
if (preg_match('!^.+dailymotion\.com/(video|hub)/([^_]+)[^#]*(#video=([^_&]+))?|(dai\.ly/([^_]+))!', $url, $m)) {
if (isset($m[6])) {
return $m[6];
}
if (isset($m[4])) {
return $m[4];
}
... | [
"public",
"function",
"getDailyMotionId",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'!^.+dailymotion\\.com/(video|hub)/([^_]+)[^#]*(#video=([^_&]+))?|(dai\\.ly/([^_]+))!'",
",",
"$",
"url",
",",
"$",
"m",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$"... | Extracts the daily motion id from a daily motion url.
Returns false if the url is not recognized as a daily motion url. | [
"Extracts",
"the",
"daily",
"motion",
"id",
"from",
"a",
"daily",
"motion",
"url",
".",
"Returns",
"false",
"if",
"the",
"url",
"is",
"not",
"recognized",
"as",
"a",
"daily",
"motion",
"url",
"."
] | fa5b84212d04c284bb289a18c33c660881c92863 | https://github.com/mrofi/video-info/blob/fa5b84212d04c284bb289a18c33c660881c92863/src/DailyMotion.php#L40-L52 | train |
KDF5000/EasyThink | src/ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_debug.php | Smarty_Internal_Debug.display_debug | public static function display_debug($obj)
{
// prepare information of assigned variables
$ptr = self::get_debug_vars($obj);
if ($obj instanceof Smarty) {
$smarty = clone $obj;
} else {
$smarty = clone $obj->smarty;
}
$_assigned_vars = $ptr->tp... | php | public static function display_debug($obj)
{
// prepare information of assigned variables
$ptr = self::get_debug_vars($obj);
if ($obj instanceof Smarty) {
$smarty = clone $obj;
} else {
$smarty = clone $obj->smarty;
}
$_assigned_vars = $ptr->tp... | [
"public",
"static",
"function",
"display_debug",
"(",
"$",
"obj",
")",
"{",
"// prepare information of assigned variables",
"$",
"ptr",
"=",
"self",
"::",
"get_debug_vars",
"(",
"$",
"obj",
")",
";",
"if",
"(",
"$",
"obj",
"instanceof",
"Smarty",
")",
"{",
"... | Opens a window for the Smarty Debugging Consol and display the data
@param Smarty_Internal_Template|Smarty $obj object to debug | [
"Opens",
"a",
"window",
"for",
"the",
"Smarty",
"Debugging",
"Consol",
"and",
"display",
"the",
"data"
] | 86efc9c8a0d504e01e2fea55868227fdc8928841 | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_debug.php#L98-L136 | train |
juliangut/mapping | src/Driver/AbstractDriverFactory.php | AbstractDriverFactory.getDriver | public function getDriver(array $mappingSource): DriverInterface
{
if (\array_key_exists('driver', $mappingSource)) {
$driver = $mappingSource['driver'];
if (!$driver instanceof DriverInterface) {
throw new DriverException(\sprintf(
'Metadata mapp... | php | public function getDriver(array $mappingSource): DriverInterface
{
if (\array_key_exists('driver', $mappingSource)) {
$driver = $mappingSource['driver'];
if (!$driver instanceof DriverInterface) {
throw new DriverException(\sprintf(
'Metadata mapp... | [
"public",
"function",
"getDriver",
"(",
"array",
"$",
"mappingSource",
")",
":",
"DriverInterface",
"{",
"if",
"(",
"\\",
"array_key_exists",
"(",
"'driver'",
",",
"$",
"mappingSource",
")",
")",
"{",
"$",
"driver",
"=",
"$",
"mappingSource",
"[",
"'driver'"... | Get mapping driver.
@param array $mappingSource
@throws DriverException
@return DriverInterface | [
"Get",
"mapping",
"driver",
"."
] | 1830ff84c054d8e3759df170a5664a97f7070be9 | https://github.com/juliangut/mapping/blob/1830ff84c054d8e3759df170a5664a97f7070be9/src/Driver/AbstractDriverFactory.php#L32-L56 | train |
juliangut/mapping | src/Driver/AbstractDriverFactory.php | AbstractDriverFactory.getDriverImplementation | protected function getDriverImplementation(string $type, array $paths): DriverInterface
{
switch ($type) {
case DriverFactoryInterface::DRIVER_ANNOTATION:
return $this->getAnnotationDriver($paths);
case DriverFactoryInterface::DRIVER_PHP:
return $this... | php | protected function getDriverImplementation(string $type, array $paths): DriverInterface
{
switch ($type) {
case DriverFactoryInterface::DRIVER_ANNOTATION:
return $this->getAnnotationDriver($paths);
case DriverFactoryInterface::DRIVER_PHP:
return $this... | [
"protected",
"function",
"getDriverImplementation",
"(",
"string",
"$",
"type",
",",
"array",
"$",
"paths",
")",
":",
"DriverInterface",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"DriverFactoryInterface",
"::",
"DRIVER_ANNOTATION",
":",
"return",
"$",
... | Get mapping driver implementation.
@param string $type
@param array $paths
@throws DriverException
@return DriverInterface | [
"Get",
"mapping",
"driver",
"implementation",
"."
] | 1830ff84c054d8e3759df170a5664a97f7070be9 | https://github.com/juliangut/mapping/blob/1830ff84c054d8e3759df170a5664a97f7070be9/src/Driver/AbstractDriverFactory.php#L68-L90 | train |
jabernardo/lollipop-php | Library/Log.php | Log._write | private static function _write($type, $message) {
$log_path = Config::get('log.folder', LOLLIPOP_STORAGE_LOG);
$log_enable = Config::get('log.enable', true);
$log_hourly = Config::get('log.hourly', false);
if (!is_dir($log_path))
throw new \Lollipop\Exception\Runtime(... | php | private static function _write($type, $message) {
$log_path = Config::get('log.folder', LOLLIPOP_STORAGE_LOG);
$log_enable = Config::get('log.enable', true);
$log_hourly = Config::get('log.hourly', false);
if (!is_dir($log_path))
throw new \Lollipop\Exception\Runtime(... | [
"private",
"static",
"function",
"_write",
"(",
"$",
"type",
",",
"$",
"message",
")",
"{",
"$",
"log_path",
"=",
"Config",
"::",
"get",
"(",
"'log.folder'",
",",
"LOLLIPOP_STORAGE_LOG",
")",
";",
"$",
"log_enable",
"=",
"Config",
"::",
"get",
"(",
"'log... | Append to log file
@param string $message Message log
@throws \Lollipop\Exception\Runtime
@throws \Lollipop\Exception\Argument
@return bool | [
"Append",
"to",
"log",
"file"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/Log.php#L53-L81 | train |
battis/data-utilities | src/DataUtilities.php | DataUtilities.loadCsvToArray | public static function loadCsvToArray($field, $firstRowLabels = true)
{
$result = false;
if (!empty($_FILES[$field]['tmp_name'])) {
/* open the file for reading */
$csv = fopen($_FILES[$field]['tmp_name'], 'r');
$result = array();
/* treat the first r... | php | public static function loadCsvToArray($field, $firstRowLabels = true)
{
$result = false;
if (!empty($_FILES[$field]['tmp_name'])) {
/* open the file for reading */
$csv = fopen($_FILES[$field]['tmp_name'], 'r');
$result = array();
/* treat the first r... | [
"public",
"static",
"function",
"loadCsvToArray",
"(",
"$",
"field",
",",
"$",
"firstRowLabels",
"=",
"true",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"_FILES",
"[",
"$",
"field",
"]",
"[",
"'tmp_name'",
"]",
")"... | Load an uploaded CSV file into an associative array
@param string $field Field name holding the file name
@param boolean $firstRowLabels (Optional) Default `TRUE`
@return string[][]|boolean A two-dimensional array of string values, if the
`$field` contains a CSV file, `FALSE` if there is no file | [
"Load",
"an",
"uploaded",
"CSV",
"file",
"into",
"an",
"associative",
"array"
] | 81e9771db3f3cfa1a757179ad447ee40703c55a3 | https://github.com/battis/data-utilities/blob/81e9771db3f3cfa1a757179ad447ee40703c55a3/src/DataUtilities.php#L108-L142 | train |
battis/data-utilities | src/DataUtilities.php | DataUtilities.URLfromPath | public static function URLfromPath($path, array $vars = null, $basePath = false)
{
if ($vars === null) {
if (php_sapi_name() != 'cli') {
$vars = $_SERVER;
} else {
return false;
}
}
if ($basePath !== false && substr($path, ... | php | public static function URLfromPath($path, array $vars = null, $basePath = false)
{
if ($vars === null) {
if (php_sapi_name() != 'cli') {
$vars = $_SERVER;
} else {
return false;
}
}
if ($basePath !== false && substr($path, ... | [
"public",
"static",
"function",
"URLfromPath",
"(",
"$",
"path",
",",
"array",
"$",
"vars",
"=",
"null",
",",
"$",
"basePath",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"vars",
"===",
"null",
")",
"{",
"if",
"(",
"php_sapi_name",
"(",
")",
"!=",
"'cl... | Generate a URL from a path
@param string $path A valid file path
@param string[] $vars Optional (default: `$_SERVER` unless run from CLI,
in which case the method fails without this
parameter). Array must have keys `HTTPS,
SERVER_NAME, CONTEXT_PREFIX,
CONTEXT_DOCUMENT_ROOT`.
@param string|false $basePath The base path... | [
"Generate",
"a",
"URL",
"from",
"a",
"path"
] | 81e9771db3f3cfa1a757179ad447ee40703c55a3 | https://github.com/battis/data-utilities/blob/81e9771db3f3cfa1a757179ad447ee40703c55a3/src/DataUtilities.php#L193-L223 | train |
OpenConext-Attic/OpenConext-engineblock-metadata | src/MetadataRepository/CachedDoctrineMetadataRepository.php | CachedDoctrineMetadataRepository.invoke | public function invoke($name, array $args)
{
$signature = $name . ':' . serialize($args);
if (!isset($this->cache[$signature])) {
$this->cache[$signature] = call_user_func_array(array($this->repository, $name), $args);
}
return $this->cache[$signature];
} | php | public function invoke($name, array $args)
{
$signature = $name . ':' . serialize($args);
if (!isset($this->cache[$signature])) {
$this->cache[$signature] = call_user_func_array(array($this->repository, $name), $args);
}
return $this->cache[$signature];
} | [
"public",
"function",
"invoke",
"(",
"$",
"name",
",",
"array",
"$",
"args",
")",
"{",
"$",
"signature",
"=",
"$",
"name",
".",
"':'",
".",
"serialize",
"(",
"$",
"args",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
... | Read results from cache or proxy to wrapped doctrine repository.
@param string $name
@param array $args
@return mixed | [
"Read",
"results",
"from",
"cache",
"or",
"proxy",
"to",
"wrapped",
"doctrine",
"repository",
"."
] | 236e2f52ef9cf28e71404544a1c4388f63ee535d | https://github.com/OpenConext-Attic/OpenConext-engineblock-metadata/blob/236e2f52ef9cf28e71404544a1c4388f63ee535d/src/MetadataRepository/CachedDoctrineMetadataRepository.php#L66-L75 | train |
anime-db/catalog-bundle | src/Form/ViewSorter.php | ViewSorter.choice | public function choice(FormView $choice)
{
$that = $this;
if ($choice->vars['compound']) {
usort($choice->children, function (FormView $a, FormView $b) use ($that) {
return $that->compare($a->vars['label'] ?: $a->vars['value'], $b->vars['label'] ?: $b->vars['value']);
... | php | public function choice(FormView $choice)
{
$that = $this;
if ($choice->vars['compound']) {
usort($choice->children, function (FormView $a, FormView $b) use ($that) {
return $that->compare($a->vars['label'] ?: $a->vars['value'], $b->vars['label'] ?: $b->vars['value']);
... | [
"public",
"function",
"choice",
"(",
"FormView",
"$",
"choice",
")",
"{",
"$",
"that",
"=",
"$",
"this",
";",
"if",
"(",
"$",
"choice",
"->",
"vars",
"[",
"'compound'",
"]",
")",
"{",
"usort",
"(",
"$",
"choice",
"->",
"children",
",",
"function",
... | Sort choice.
@param FormView $choice | [
"Sort",
"choice",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Form/ViewSorter.php#L42-L54 | train |
ciims/ciims-modules-api | controllers/ThemeController.php | ThemeController.updateCheck | private function updateCheck($name)
{
$filePath = Yii::getPathOfAlias('base.themes').DS.$name;
$details = $this->actionDetails($name);
if (file_exists($filePath.DS.'VERSION'))
{
$version = file_get_contents($filePath.DS.'VERSION');
if ($version != $details['latest-version'])
return true;
}
else
... | php | private function updateCheck($name)
{
$filePath = Yii::getPathOfAlias('base.themes').DS.$name;
$details = $this->actionDetails($name);
if (file_exists($filePath.DS.'VERSION'))
{
$version = file_get_contents($filePath.DS.'VERSION');
if ($version != $details['latest-version'])
return true;
}
else
... | [
"private",
"function",
"updateCheck",
"(",
"$",
"name",
")",
"{",
"$",
"filePath",
"=",
"Yii",
"::",
"getPathOfAlias",
"(",
"'base.themes'",
")",
".",
"DS",
".",
"$",
"name",
";",
"$",
"details",
"=",
"$",
"this",
"->",
"actionDetails",
"(",
"$",
"name... | Checks if an update is necessary
@param string $name
@return boolean | [
"Checks",
"if",
"an",
"update",
"is",
"necessary"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/ThemeController.php#L94-L110 | train |
ciims/ciims-modules-api | controllers/ThemeController.php | ThemeController.actionUpdateCheck | public function actionUpdateCheck($name=false)
{
if ($name == false)
return false;
if (defined('CII_CONFIG'))
return $this->returnError(200, Yii::t('Api.main', 'Update is not required'), false);
if ($this->updateCheck($name))
return $this->returnError(200, Yii::t('Api.main', 'Update is available'), tr... | php | public function actionUpdateCheck($name=false)
{
if ($name == false)
return false;
if (defined('CII_CONFIG'))
return $this->returnError(200, Yii::t('Api.main', 'Update is not required'), false);
if ($this->updateCheck($name))
return $this->returnError(200, Yii::t('Api.main', 'Update is available'), tr... | [
"public",
"function",
"actionUpdateCheck",
"(",
"$",
"name",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"false",
")",
"return",
"false",
";",
"if",
"(",
"defined",
"(",
"'CII_CONFIG'",
")",
")",
"return",
"$",
"this",
"->",
"returnError",
"(... | Exposed action to check for an update
@param string $name
@return boolean | [
"Exposed",
"action",
"to",
"check",
"for",
"an",
"update"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/ThemeController.php#L117-L129 | train |
ciims/ciims-modules-api | controllers/ThemeController.php | ThemeController.actionUpdate | public function actionUpdate($name=false)
{
if ($name == false || defined('CII_CONFIG'))
return false;
// Performs an update check, and if an update is available performs the update
if ($this->updateCheck($name))
{
if (!$this->actionInstall($name))
return $this->returnError(500, Yii::t('Api.main', '... | php | public function actionUpdate($name=false)
{
if ($name == false || defined('CII_CONFIG'))
return false;
// Performs an update check, and if an update is available performs the update
if ($this->updateCheck($name))
{
if (!$this->actionInstall($name))
return $this->returnError(500, Yii::t('Api.main', '... | [
"public",
"function",
"actionUpdate",
"(",
"$",
"name",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"false",
"||",
"defined",
"(",
"'CII_CONFIG'",
")",
")",
"return",
"false",
";",
"// Performs an update check, and if an update is available performs the up... | Performs an update
@return boolean | [
"Performs",
"an",
"update"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/ThemeController.php#L135-L149 | train |
ciims/ciims-modules-api | controllers/ThemeController.php | ThemeController.actionInstall | public function actionInstall($name=false)
{
if ($name == false || defined('CII_CONFIG'))
return false;
$filePath = Yii::getPathOfAlias('base.themes').DS.$name;
$details = $this->actionDetails($name);
// If the theme is already installed, make sure it is the correct version, otherwise we'll be performin... | php | public function actionInstall($name=false)
{
if ($name == false || defined('CII_CONFIG'))
return false;
$filePath = Yii::getPathOfAlias('base.themes').DS.$name;
$details = $this->actionDetails($name);
// If the theme is already installed, make sure it is the correct version, otherwise we'll be performin... | [
"public",
"function",
"actionInstall",
"(",
"$",
"name",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"false",
"||",
"defined",
"(",
"'CII_CONFIG'",
")",
")",
"return",
"false",
";",
"$",
"filePath",
"=",
"Yii",
"::",
"getPathOfAlias",
"(",
"'... | Installs and or updates a theme using the provided name
@return boolean | [
"Installs",
"and",
"or",
"updates",
"a",
"theme",
"using",
"the",
"provided",
"name"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/ThemeController.php#L155-L235 | train |
ciims/ciims-modules-api | controllers/ThemeController.php | ThemeController.actionUninstall | public function actionUninstall($name=false)
{
if ($name == false)
return false;
if ($name == 'default')
throw new CHttpException(400, Yii::t('Api.theme', 'You cannot uninstall the default theme.'));
if (!$this->actionIsInstalled($name))
return false;
$installedThemes = $this->actionInstalled();
... | php | public function actionUninstall($name=false)
{
if ($name == false)
return false;
if ($name == 'default')
throw new CHttpException(400, Yii::t('Api.theme', 'You cannot uninstall the default theme.'));
if (!$this->actionIsInstalled($name))
return false;
$installedThemes = $this->actionInstalled();
... | [
"public",
"function",
"actionUninstall",
"(",
"$",
"name",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"false",
")",
"return",
"false",
";",
"if",
"(",
"$",
"name",
"==",
"'default'",
")",
"throw",
"new",
"CHttpException",
"(",
"400",
",",
... | Uninstalls a theme by name
@return boolean | [
"Uninstalls",
"a",
"theme",
"by",
"name"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/ThemeController.php#L241-L262 | train |
ciims/ciims-modules-api | controllers/ThemeController.php | ThemeController.actionList | public function actionList()
{
// Don't allow theme listing in CII_CONFIG
if (defined('CII_CONFIG'))
return false;
$response = Yii::app()->cache->get('CiiMS::API::Themes::Available');
if ($response === false)
{
$url = 'https://themes.ciims.io/index.json';
$curl = new \Curl\Curl;
$response = $cur... | php | public function actionList()
{
// Don't allow theme listing in CII_CONFIG
if (defined('CII_CONFIG'))
return false;
$response = Yii::app()->cache->get('CiiMS::API::Themes::Available');
if ($response === false)
{
$url = 'https://themes.ciims.io/index.json';
$curl = new \Curl\Curl;
$response = $cur... | [
"public",
"function",
"actionList",
"(",
")",
"{",
"// Don't allow theme listing in CII_CONFIG",
"if",
"(",
"defined",
"(",
"'CII_CONFIG'",
")",
")",
"return",
"false",
";",
"$",
"response",
"=",
"Yii",
"::",
"app",
"(",
")",
"->",
"cache",
"->",
"get",
"(",... | Lists ciims-themes that are available for download via
@return array | [
"Lists",
"ciims",
"-",
"themes",
"that",
"are",
"available",
"for",
"download",
"via"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/ThemeController.php#L268-L290 | train |
ciims/ciims-modules-api | controllers/ThemeController.php | ThemeController.actionDetails | public function actionDetails($name=false)
{
if ($name == false)
throw new CHttpException(400, Yii::t('Api.Theme', 'Missing theme name'));
// Fetch the data from Packagist
$data = Yii::app()->cache->get('CiiMS::API::Themes::' . $name);
if ($data === false)
{
$url = 'https://packagist.org/packages/cii... | php | public function actionDetails($name=false)
{
if ($name == false)
throw new CHttpException(400, Yii::t('Api.Theme', 'Missing theme name'));
// Fetch the data from Packagist
$data = Yii::app()->cache->get('CiiMS::API::Themes::' . $name);
if ($data === false)
{
$url = 'https://packagist.org/packages/cii... | [
"public",
"function",
"actionDetails",
"(",
"$",
"name",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"false",
")",
"throw",
"new",
"CHttpException",
"(",
"400",
",",
"Yii",
"::",
"t",
"(",
"'Api.Theme'",
",",
"'Missing theme name'",
")",
")",
... | Retrieves the details about a particular theme
@param string $name
@return array | [
"Retrieves",
"the",
"details",
"about",
"a",
"particular",
"theme"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/ThemeController.php#L297-L368 | train |
ciims/ciims-modules-api | controllers/ThemeController.php | ThemeController.actionCallbackPost | public function actionCallbackPost($theme=NULL, $method=NULL)
{
$this->callback($theme, $method, $_POST);
} | php | public function actionCallbackPost($theme=NULL, $method=NULL)
{
$this->callback($theme, $method, $_POST);
} | [
"public",
"function",
"actionCallbackPost",
"(",
"$",
"theme",
"=",
"NULL",
",",
"$",
"method",
"=",
"NULL",
")",
"{",
"$",
"this",
"->",
"callback",
"(",
"$",
"theme",
",",
"$",
"method",
",",
"$",
"_POST",
")",
";",
"}"
] | Allows themes to have their own dedicated callback resources for POST
This enables theme developers to not have to hack CiiMS Core in order to accomplish stuff
@param string $method The method of the current theme they want to call
@param string $theme The theme name
@return The output or action of the callback | [
"Allows",
"themes",
"to",
"have",
"their",
"own",
"dedicated",
"callback",
"resources",
"for",
"POST"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/ThemeController.php#L391-L394 | train |
ciims/ciims-modules-api | controllers/ThemeController.php | ThemeController.callback | private function callback($theme, $method, $data)
{
if ($theme == NULL)
throw new CHttpException(400, Yii::t('Api.Theme', 'Missing Theme'));
if ($method == NULL)
throw new CHttpException(400, Yii::t('Api.Theme', 'Method name is missing'));
Yii::import('base.themes.' . $theme . '.Theme');
$theme = new T... | php | private function callback($theme, $method, $data)
{
if ($theme == NULL)
throw new CHttpException(400, Yii::t('Api.Theme', 'Missing Theme'));
if ($method == NULL)
throw new CHttpException(400, Yii::t('Api.Theme', 'Method name is missing'));
Yii::import('base.themes.' . $theme . '.Theme');
$theme = new T... | [
"private",
"function",
"callback",
"(",
"$",
"theme",
",",
"$",
"method",
",",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"theme",
"==",
"NULL",
")",
"throw",
"new",
"CHttpException",
"(",
"400",
",",
"Yii",
"::",
"t",
"(",
"'Api.Theme'",
",",
"'Missing ... | Callback method for actionCallback and actionCallbackPost
@param string $method The method of the current theme they want to call
@param string $theme The theme name
@param array $data $_GET or $_POST
@return mixed | [
"Callback",
"method",
"for",
"actionCallback",
"and",
"actionCallbackPost"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/ThemeController.php#L404-L419 | train |
covex-nn/JooS | src/JooS/Config/Adapter/Serialized.php | Adapter_Serialized.save | public function save($name, Config $config)
{
$path = $this->_getPath($name);
$data = $config->valueOf();
file_put_contents(
$path, serialize($data)
);
return true;
} | php | public function save($name, Config $config)
{
$path = $this->_getPath($name);
$data = $config->valueOf();
file_put_contents(
$path, serialize($data)
);
return true;
} | [
"public",
"function",
"save",
"(",
"$",
"name",
",",
"Config",
"$",
"config",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"_getPath",
"(",
"$",
"name",
")",
";",
"$",
"data",
"=",
"$",
"config",
"->",
"valueOf",
"(",
")",
";",
"file_put_contents... | Save config data
@param string $name Config name
@param Config $config Config data
@return boolean | [
"Save",
"config",
"data"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Config/Adapter/Serialized.php#L71-L81 | train |
covex-nn/JooS | src/JooS/Config/Adapter/Serialized.php | Adapter_Serialized.delete | public function delete($name)
{
$path = $this->_getPath($name);
if (file_exists($path)) {
$result = @unlink($path);
} else {
$result = false;
}
return $result;
} | php | public function delete($name)
{
$path = $this->_getPath($name);
if (file_exists($path)) {
$result = @unlink($path);
} else {
$result = false;
}
return $result;
} | [
"public",
"function",
"delete",
"(",
"$",
"name",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"_getPath",
"(",
"$",
"name",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"$",
"result",
"=",
"@",
"unlink",
"(",
"$",
"pa... | Delete config data
@param string $name Config name
@return boolean | [
"Delete",
"config",
"data"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Config/Adapter/Serialized.php#L90-L101 | train |
koolkode/json | src/Json.php | Json.encode | public static function encode($data, $forceObject = false)
{
return @json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | ($forceObject ? JSON_FORCE_OBJECT : 0));
} | php | public static function encode($data, $forceObject = false)
{
return @json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | ($forceObject ? JSON_FORCE_OBJECT : 0));
} | [
"public",
"static",
"function",
"encode",
"(",
"$",
"data",
",",
"$",
"forceObject",
"=",
"false",
")",
"{",
"return",
"@",
"json_encode",
"(",
"$",
"data",
",",
"JSON_UNESCAPED_SLASHES",
"|",
"JSON_UNESCAPED_UNICODE",
"|",
"(",
"$",
"forceObject",
"?",
"JSO... | Encode the given data into a JSON string.
@param mixed $data The data to be JSON-encoded.
@param boolean $forceObject Force empty arrays to be encoded as objects?
@return string | [
"Encode",
"the",
"given",
"data",
"into",
"a",
"JSON",
"string",
"."
] | 857a6217e7e2cf4ea8270bd99d0cc35cac13dc07 | https://github.com/koolkode/json/blob/857a6217e7e2cf4ea8270bd99d0cc35cac13dc07/src/Json.php#L29-L32 | train |
koolkode/json | src/Json.php | Json.decode | public static function decode($json, $assoc = false, $maxDepth = 512)
{
$result = @json_decode($json, $assoc, $maxDepth);
if($result === NULL)
{
switch($error = json_last_error())
{
case JSON_ERROR_NONE:
return NULL;
case JSON_ERROR_CTRL_CHAR:
throw new JsonUnserializationException('An... | php | public static function decode($json, $assoc = false, $maxDepth = 512)
{
$result = @json_decode($json, $assoc, $maxDepth);
if($result === NULL)
{
switch($error = json_last_error())
{
case JSON_ERROR_NONE:
return NULL;
case JSON_ERROR_CTRL_CHAR:
throw new JsonUnserializationException('An... | [
"public",
"static",
"function",
"decode",
"(",
"$",
"json",
",",
"$",
"assoc",
"=",
"false",
",",
"$",
"maxDepth",
"=",
"512",
")",
"{",
"$",
"result",
"=",
"@",
"json_decode",
"(",
"$",
"json",
",",
"$",
"assoc",
",",
"$",
"maxDepth",
")",
";",
... | Decode the given JSON string into a PHP data structure.
@param string $json The JSON-encoded input data.
@param boolean $assoc Serialize JSON objects into PHP arrays?
@param integer $maxDepth Maximum nesting depth of JSON input.
@return mixed
@throws JsonUnserializationException When any error occurs during unseriali... | [
"Decode",
"the",
"given",
"JSON",
"string",
"into",
"a",
"PHP",
"data",
"structure",
"."
] | 857a6217e7e2cf4ea8270bd99d0cc35cac13dc07 | https://github.com/koolkode/json/blob/857a6217e7e2cf4ea8270bd99d0cc35cac13dc07/src/Json.php#L45-L67 | train |
miBadger/miBadger.Pagination | src/Pagination.php | Pagination.get | public function get($index)
{
return array_slice($this->items, $index * $this->itemsPerPage, $this->itemsPerPage);
} | php | public function get($index)
{
return array_slice($this->items, $index * $this->itemsPerPage, $this->itemsPerPage);
} | [
"public",
"function",
"get",
"(",
"$",
"index",
")",
"{",
"return",
"array_slice",
"(",
"$",
"this",
"->",
"items",
",",
"$",
"index",
"*",
"$",
"this",
"->",
"itemsPerPage",
",",
"$",
"this",
"->",
"itemsPerPage",
")",
";",
"}"
] | Returns the items on the given page number.
@param int $index
@return mixed[] the items on the given page number. | [
"Returns",
"the",
"items",
"on",
"the",
"given",
"page",
"number",
"."
] | 4c9a528a3e3ef9b16f6d1db375b17d5a9fa1c447 | https://github.com/miBadger/miBadger.Pagination/blob/4c9a528a3e3ef9b16f6d1db375b17d5a9fa1c447/src/Pagination.php#L62-L65 | train |
eureka-framework/component-http | src/Http/File.php | File.useName | public function useName($name)
{
if (empty($name)) {
throw new \Exception('Given name is empty!');
}
if (!isset($_FILES[$name])) {
throw new \Exception('Given name not exists in $_FILES var!');
}
$this->data = $_FILES[$name];
return $this;
... | php | public function useName($name)
{
if (empty($name)) {
throw new \Exception('Given name is empty!');
}
if (!isset($_FILES[$name])) {
throw new \Exception('Given name not exists in $_FILES var!');
}
$this->data = $_FILES[$name];
return $this;
... | [
"public",
"function",
"useName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Given name is empty!'",
")",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"_FILES",
"[",
"$"... | Use name as default in File's methods.
@param string $name
@return self
@throws \Exception | [
"Use",
"name",
"as",
"default",
"in",
"File",
"s",
"methods",
"."
] | 698c3b73581a9703a9c932890c57e50f8774607a | https://github.com/eureka-framework/component-http/blob/698c3b73581a9703a9c932890c57e50f8774607a/src/Http/File.php#L44-L57 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.