id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
204,900 | alphacomm/alpharpc | src/AlphaRPC/Client/Client.php | Client.sendExecuteRequest | protected function sendExecuteRequest($manager, Request $request, $cache = null)
{
$serialized = $this->serializeParams($request->getParams());
$msg = new ExecuteRequest($cache, $request->getFunction(), $serialized);
$socket = $this->getSocket($manager);
$stream = $socket->getStream... | php | protected function sendExecuteRequest($manager, Request $request, $cache = null)
{
$serialized = $this->serializeParams($request->getParams());
$msg = new ExecuteRequest($cache, $request->getFunction(), $serialized);
$socket = $this->getSocket($manager);
$stream = $socket->getStream... | [
"protected",
"function",
"sendExecuteRequest",
"(",
"$",
"manager",
",",
"Request",
"$",
"request",
",",
"$",
"cache",
"=",
"null",
")",
"{",
"$",
"serialized",
"=",
"$",
"this",
"->",
"serializeParams",
"(",
"$",
"request",
"->",
"getParams",
"(",
")",
... | Send a request to the ClientHandler.
@param string $manager
@param Request $request
@param string $cache
@return ExecuteResponse
@throws TimeoutException
@throws InvalidResponseException | [
"Send",
"a",
"request",
"to",
"the",
"ClientHandler",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/Client.php#L354-L382 |
204,901 | alphacomm/alpharpc | src/AlphaRPC/Client/Client.php | Client.fetchResponse | public function fetchResponse(Request $request, $waitForResult = true)
{
if ($request->hasResponse()) {
return $request->getResponse();
}
$timer = $this->getFetchTimer($waitForResult);
$req = new FetchRequest($request->getRequestId(), $waitForResult);
do {
... | php | public function fetchResponse(Request $request, $waitForResult = true)
{
if ($request->hasResponse()) {
return $request->getResponse();
}
$timer = $this->getFetchTimer($waitForResult);
$req = new FetchRequest($request->getRequestId(), $waitForResult);
do {
... | [
"public",
"function",
"fetchResponse",
"(",
"Request",
"$",
"request",
",",
"$",
"waitForResult",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"hasResponse",
"(",
")",
")",
"{",
"return",
"$",
"request",
"->",
"getResponse",
"(",
")",
";",
"... | Fetches the response for a request.
Throws a RuntimeException if there is no response (yet) and the timeout
is reached.
@param \AlphaRPC\Client\Request $request
@param boolean $waitForResult
@return mixed
@throws \RuntimeException | [
"Fetches",
"the",
"response",
"for",
"a",
"request",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/Client.php#L396-L417 |
204,902 | alphacomm/alpharpc | src/AlphaRPC/Client/Client.php | Client.getManagerForRequest | private function getManagerForRequest(Request $request)
{
if (!$request->getManager()) {
$request->setManager($this->managerList->get());
}
return $request->getManager();
} | php | private function getManagerForRequest(Request $request)
{
if (!$request->getManager()) {
$request->setManager($this->managerList->get());
}
return $request->getManager();
} | [
"private",
"function",
"getManagerForRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"->",
"getManager",
"(",
")",
")",
"{",
"$",
"request",
"->",
"setManager",
"(",
"$",
"this",
"->",
"managerList",
"->",
"get",
"(",
... | Returns a manager for the Request.
It prefers the manager that is already set, but if it is
not, then it adds a random manager from the manager list.
@param Request $request
@return string | [
"Returns",
"a",
"manager",
"for",
"the",
"Request",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/Client.php#L534-L541 |
204,903 | rackberg/para | src/Plugin/PluginManager.php | PluginManager.decodeLockFile | private function decodeLockFile(): array
{
$data = [];
$encoder = $this->jsonEncoderFactory->getEncoder();
if (file_exists($this->rootDirectory . 'composer.lock')) {
$data = $encoder->decode(
file_get_contents($this->rootDirectory.'composer.lock'),
... | php | private function decodeLockFile(): array
{
$data = [];
$encoder = $this->jsonEncoderFactory->getEncoder();
if (file_exists($this->rootDirectory . 'composer.lock')) {
$data = $encoder->decode(
file_get_contents($this->rootDirectory.'composer.lock'),
... | [
"private",
"function",
"decodeLockFile",
"(",
")",
":",
"array",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"encoder",
"=",
"$",
"this",
"->",
"jsonEncoderFactory",
"->",
"getEncoder",
"(",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
... | Returns the decoded lock file data.
@return array | [
"Returns",
"the",
"decoded",
"lock",
"file",
"data",
"."
] | e0ef1356ed2979670eb7c670d88921406cade46e | https://github.com/rackberg/para/blob/e0ef1356ed2979670eb7c670d88921406cade46e/src/Plugin/PluginManager.php#L206-L219 |
204,904 | yii2lab/yii2-rbac | src/domain/services/RuleService.php | RuleService.executeRule | public function executeRule($user, $item, $params)
{
if ($item->ruleName === null) {
return true;
}
$rule = $this->domain->rule->getRule($item->ruleName);
if ($rule instanceof Rule) {
return $rule->execute($user, $item, $params);
}
throw new InvalidConfigException("Rule not found: {$item->ruleName... | php | public function executeRule($user, $item, $params)
{
if ($item->ruleName === null) {
return true;
}
$rule = $this->domain->rule->getRule($item->ruleName);
if ($rule instanceof Rule) {
return $rule->execute($user, $item, $params);
}
throw new InvalidConfigException("Rule not found: {$item->ruleName... | [
"public",
"function",
"executeRule",
"(",
"$",
"user",
",",
"$",
"item",
",",
"$",
"params",
")",
"{",
"if",
"(",
"$",
"item",
"->",
"ruleName",
"===",
"null",
")",
"{",
"return",
"true",
";",
"}",
"$",
"rule",
"=",
"$",
"this",
"->",
"domain",
"... | Executes the rule associated with the specified auth item.
If the item does not specify a rule, this method will return true. Otherwise, it will
return the value of [[Rule::execute()]].
@param string|int $user the user ID. This should be either an integer or a string representing
the unique identifier of a user. See ... | [
"Executes",
"the",
"rule",
"associated",
"with",
"the",
"specified",
"auth",
"item",
"."
] | e72ac0359af660690c161451f864208b2d20919d | https://github.com/yii2lab/yii2-rbac/blob/e72ac0359af660690c161451f864208b2d20919d/src/domain/services/RuleService.php#L84-L95 |
204,905 | gplcart/base | handlers/Install.php | Install.install | public function install(array $data, $db)
{
$this->db = $db;
$this->data = $data;
$this->data['step'] = 0;
if (GC_CLI) {
$this->installCli();
return array();
}
return $this->installHttp();
} | php | public function install(array $data, $db)
{
$this->db = $db;
$this->data = $data;
$this->data['step'] = 0;
if (GC_CLI) {
$this->installCli();
return array();
}
return $this->installHttp();
} | [
"public",
"function",
"install",
"(",
"array",
"$",
"data",
",",
"$",
"db",
")",
"{",
"$",
"this",
"->",
"db",
"=",
"$",
"db",
";",
"$",
"this",
"->",
"data",
"=",
"$",
"data",
";",
"$",
"this",
"->",
"data",
"[",
"'step'",
"]",
"=",
"0",
";"... | Performs initial system installation. Step 0
@param array $data
@param \gplcart\core\Database $db
@return array | [
"Performs",
"initial",
"system",
"installation",
".",
"Step",
"0"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L54-L66 |
204,906 | gplcart/base | handlers/Install.php | Install.installHttp | protected function installHttp()
{
$result = array(
'message' => '',
'severity' => 'success',
'redirect' => 'install/' . ($this->data['step'] + 1)
);
try {
$this->start();
$this->process();
} catch (Exception $ex) {
... | php | protected function installHttp()
{
$result = array(
'message' => '',
'severity' => 'success',
'redirect' => 'install/' . ($this->data['step'] + 1)
);
try {
$this->start();
$this->process();
} catch (Exception $ex) {
... | [
"protected",
"function",
"installHttp",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
"'message'",
"=>",
"''",
",",
"'severity'",
"=>",
"'success'",
",",
"'redirect'",
"=>",
"'install/'",
".",
"(",
"$",
"this",
"->",
"data",
"[",
"'step'",
"]",
"+",
... | Performs installation via classic web UI
@return array | [
"Performs",
"installation",
"via",
"classic",
"web",
"UI"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L72-L94 |
204,907 | gplcart/base | handlers/Install.php | Install.installCli | protected function installCli()
{
try {
$this->process();
$this->installCliStep1();
$this->installCliStep2();
$this->installCliStep3();
$this->cli->line($this->getSuccessMessage());
} catch (Exception $ex) {
$this->cli->error($e... | php | protected function installCli()
{
try {
$this->process();
$this->installCliStep1();
$this->installCliStep2();
$this->installCliStep3();
$this->cli->line($this->getSuccessMessage());
} catch (Exception $ex) {
$this->cli->error($e... | [
"protected",
"function",
"installCli",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"process",
"(",
")",
";",
"$",
"this",
"->",
"installCliStep1",
"(",
")",
";",
"$",
"this",
"->",
"installCliStep2",
"(",
")",
";",
"$",
"this",
"->",
"installCliStep3... | Install in CLI mode | [
"Install",
"in",
"CLI",
"mode"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L99-L110 |
204,908 | gplcart/base | handlers/Install.php | Install.installCliStep1 | protected function installCliStep1()
{
$this->data['step'] = 1;
$this->setCliMessage('Configuring modules...');
$result = $this->installModules($this->data, $this->db);
if ($result['severity'] !== 'success') {
throw new UnexpectedValueException($result['message']);
... | php | protected function installCliStep1()
{
$this->data['step'] = 1;
$this->setCliMessage('Configuring modules...');
$result = $this->installModules($this->data, $this->db);
if ($result['severity'] !== 'success') {
throw new UnexpectedValueException($result['message']);
... | [
"protected",
"function",
"installCliStep1",
"(",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'step'",
"]",
"=",
"1",
";",
"$",
"this",
"->",
"setCliMessage",
"(",
"'Configuring modules...'",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"installModules",... | Process step 1 in CLI mode
@throws UnexpectedValueException | [
"Process",
"step",
"1",
"in",
"CLI",
"mode"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L116-L125 |
204,909 | gplcart/base | handlers/Install.php | Install.installCliStep2 | protected function installCliStep2()
{
$title = $this->translation->text('Please select a demo content package (enter a number)');
$this->data['demo_handler_id'] = $this->cli->menu($this->getDemoOptions(), '', $title);
if (!empty($this->data['demo_handler_id'])) {
$this->data['... | php | protected function installCliStep2()
{
$title = $this->translation->text('Please select a demo content package (enter a number)');
$this->data['demo_handler_id'] = $this->cli->menu($this->getDemoOptions(), '', $title);
if (!empty($this->data['demo_handler_id'])) {
$this->data['... | [
"protected",
"function",
"installCliStep2",
"(",
")",
"{",
"$",
"title",
"=",
"$",
"this",
"->",
"translation",
"->",
"text",
"(",
"'Please select a demo content package (enter a number)'",
")",
";",
"$",
"this",
"->",
"data",
"[",
"'demo_handler_id'",
"]",
"=",
... | Process step 2 in CLI mode
@throws UnexpectedValueException | [
"Process",
"step",
"2",
"in",
"CLI",
"mode"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L131-L148 |
204,910 | gplcart/base | handlers/Install.php | Install.installCliStep3 | protected function installCliStep3()
{
$this->data['step'] = 3;
$result = $this->installFinish($this->data, $this->db);
if ($result['severity'] !== 'success') {
throw new UnexpectedValueException($result['message']);
}
} | php | protected function installCliStep3()
{
$this->data['step'] = 3;
$result = $this->installFinish($this->data, $this->db);
if ($result['severity'] !== 'success') {
throw new UnexpectedValueException($result['message']);
}
} | [
"protected",
"function",
"installCliStep3",
"(",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'step'",
"]",
"=",
"3",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"installFinish",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"this",
"->",
"db",
")",
";",... | Precess step 3 in CLI mode
@throws UnexpectedValueException | [
"Precess",
"step",
"3",
"in",
"CLI",
"mode"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L154-L162 |
204,911 | gplcart/base | handlers/Install.php | Install.installModules | public function installModules(array $data, $db)
{
$this->db = $db;
$this->data = $data;
try {
$this->install_model->installModules();
$this->configureModules();
return array(
'message' => '',
'severity' => 'success',
... | php | public function installModules(array $data, $db)
{
$this->db = $db;
$this->data = $data;
try {
$this->install_model->installModules();
$this->configureModules();
return array(
'message' => '',
'severity' => 'success',
... | [
"public",
"function",
"installModules",
"(",
"array",
"$",
"data",
",",
"$",
"db",
")",
"{",
"$",
"this",
"->",
"db",
"=",
"$",
"db",
";",
"$",
"this",
"->",
"data",
"=",
"$",
"data",
";",
"try",
"{",
"$",
"this",
"->",
"install_model",
"->",
"in... | Installs required modules. Step 1
@param array $data
@param \gplcart\core\Database $db
@return array | [
"Installs",
"required",
"modules",
".",
"Step",
"1"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L170-L196 |
204,912 | gplcart/base | handlers/Install.php | Install.installDemo | public function installDemo(array $data, $db)
{
set_time_limit(0);
$this->db = $db;
$this->data = $data;
$success_result = array(
'message' => '',
'severity' => 'success',
'redirect' => 'install/' . ($this->data['step'] + 1)
);
i... | php | public function installDemo(array $data, $db)
{
set_time_limit(0);
$this->db = $db;
$this->data = $data;
$success_result = array(
'message' => '',
'severity' => 'success',
'redirect' => 'install/' . ($this->data['step'] + 1)
);
i... | [
"public",
"function",
"installDemo",
"(",
"array",
"$",
"data",
",",
"$",
"db",
")",
"{",
"set_time_limit",
"(",
"0",
")",
";",
"$",
"this",
"->",
"db",
"=",
"$",
"db",
";",
"$",
"this",
"->",
"data",
"=",
"$",
"data",
";",
"$",
"success_result",
... | Install a demo-content. Step 2
@param array $data
@param \gplcart\core\Database $db
@return array | [
"Install",
"a",
"demo",
"-",
"content",
".",
"Step",
"2"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L204-L228 |
204,913 | gplcart/base | handlers/Install.php | Install.installFinish | public function installFinish(array $data, $db)
{
$this->db = $db;
$this->data = $data;
$result = $this->finish();
$errors = $this->getContextErrors();
if (empty($errors)) {
if ($this->getContext('demo_handler_id')) {
$store_id = $this->getContex... | php | public function installFinish(array $data, $db)
{
$this->db = $db;
$this->data = $data;
$result = $this->finish();
$errors = $this->getContextErrors();
if (empty($errors)) {
if ($this->getContext('demo_handler_id')) {
$store_id = $this->getContex... | [
"public",
"function",
"installFinish",
"(",
"array",
"$",
"data",
",",
"$",
"db",
")",
"{",
"$",
"this",
"->",
"db",
"=",
"$",
"db",
";",
"$",
"this",
"->",
"data",
"=",
"$",
"data",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"finish",
"(",
")... | Performs final tasks. Step 3
@param array $data
@param \gplcart\core\Database $db
@return array | [
"Performs",
"final",
"tasks",
".",
"Step",
"3"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L236-L255 |
204,914 | gplcart/base | handlers/Install.php | Install.getDemoOptions | protected function getDemoOptions()
{
$options = array('' => $this->translation->text('No demo'));
foreach ($this->install_model->getDemoHandlers() as $id => $handler) {
$options[$id] = $handler['title'];
}
return $options;
} | php | protected function getDemoOptions()
{
$options = array('' => $this->translation->text('No demo'));
foreach ($this->install_model->getDemoHandlers() as $id => $handler) {
$options[$id] = $handler['title'];
}
return $options;
} | [
"protected",
"function",
"getDemoOptions",
"(",
")",
"{",
"$",
"options",
"=",
"array",
"(",
"''",
"=>",
"$",
"this",
"->",
"translation",
"->",
"text",
"(",
"'No demo'",
")",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"install_model",
"->",
"getDemoHa... | Returns an array of demo content options
@return array | [
"Returns",
"an",
"array",
"of",
"demo",
"content",
"options"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L261-L270 |
204,915 | gplcart/base | handlers/Install.php | Install.configureModuleDevice | protected function configureModuleDevice()
{
$store_id = $this->getContext('store_id');
$settings = array();
$settings['theme'][$store_id]['mobile'] = 'mobile';
$settings['theme'][$store_id]['tablet'] = 'mobile';
$this->module->setSettings('device', $settings);
} | php | protected function configureModuleDevice()
{
$store_id = $this->getContext('store_id');
$settings = array();
$settings['theme'][$store_id]['mobile'] = 'mobile';
$settings['theme'][$store_id]['tablet'] = 'mobile';
$this->module->setSettings('device', $settings);
} | [
"protected",
"function",
"configureModuleDevice",
"(",
")",
"{",
"$",
"store_id",
"=",
"$",
"this",
"->",
"getContext",
"(",
"'store_id'",
")",
";",
"$",
"settings",
"=",
"array",
"(",
")",
";",
"$",
"settings",
"[",
"'theme'",
"]",
"[",
"$",
"store_id",... | Configure Device module settings | [
"Configure",
"Device",
"module",
"settings"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L284-L293 |
204,916 | gplcart/base | handlers/Install.php | Install.configureModuleGaReport | protected function configureModuleGaReport()
{
$info = $this->module->getInfo('ga_report');
$info['settings']['dashboard'] = array(
'visit_date',
'pageview_date',
'content_statistic',
'top_pages',
'source',
'keyword',
... | php | protected function configureModuleGaReport()
{
$info = $this->module->getInfo('ga_report');
$info['settings']['dashboard'] = array(
'visit_date',
'pageview_date',
'content_statistic',
'top_pages',
'source',
'keyword',
... | [
"protected",
"function",
"configureModuleGaReport",
"(",
")",
"{",
"$",
"info",
"=",
"$",
"this",
"->",
"module",
"->",
"getInfo",
"(",
"'ga_report'",
")",
";",
"$",
"info",
"[",
"'settings'",
"]",
"[",
"'dashboard'",
"]",
"=",
"array",
"(",
"'visit_date'"... | Configure Google Analytics Report module settings | [
"Configure",
"Google",
"Analytics",
"Report",
"module",
"settings"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L298-L313 |
204,917 | dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.initialize | public function initialize($url, $reset = true)
{
if ((bool)$reset)
$this->reset();
$this->currentRequestUrl = $url;
$this->state = self::STATE_INITIALIZED;
return $this;
} | php | public function initialize($url, $reset = true)
{
if ((bool)$reset)
$this->reset();
$this->currentRequestUrl = $url;
$this->state = self::STATE_INITIALIZED;
return $this;
} | [
"public",
"function",
"initialize",
"(",
"$",
"url",
",",
"$",
"reset",
"=",
"true",
")",
"{",
"if",
"(",
"(",
"bool",
")",
"$",
"reset",
")",
"$",
"this",
"->",
"reset",
"(",
")",
";",
"$",
"this",
"->",
"currentRequestUrl",
"=",
"$",
"url",
";"... | Create a new CURL resource
@param string $url
@param bool $reset
@return $this | [
"Create",
"a",
"new",
"CURL",
"resource"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L82-L92 |
204,918 | dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.setRequestHeader | public function setRequestHeader($name, $value)
{
if (!is_string($name))
throw new \InvalidArgumentException('Argument 1 expected to be string, '.gettype($name).' seen.');
if (!is_string($value))
throw new \InvalidArgumentException('Argument 2 expected to be string, '.gettyp... | php | public function setRequestHeader($name, $value)
{
if (!is_string($name))
throw new \InvalidArgumentException('Argument 1 expected to be string, '.gettype($name).' seen.');
if (!is_string($value))
throw new \InvalidArgumentException('Argument 2 expected to be string, '.gettyp... | [
"public",
"function",
"setRequestHeader",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Argument 1 expected to be string, '",
".",
"gettype",
"("... | Add a header string to the request
@param string $name
@param string $value
@throws \RuntimeException
@throws \InvalidArgumentException
@return $this | [
"Add",
"a",
"header",
"string",
"to",
"the",
"request"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L111-L125 |
204,919 | dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.setCurlOpt | public function setCurlOpt($opt, $val)
{
if (!is_int($opt))
{
throw new \InvalidArgumentException(sprintf(
'%s::setCurlOpt - Argument 1 expected to be integer, %s seen.',
get_class($this),
gettype($opt)
));
}
$t... | php | public function setCurlOpt($opt, $val)
{
if (!is_int($opt))
{
throw new \InvalidArgumentException(sprintf(
'%s::setCurlOpt - Argument 1 expected to be integer, %s seen.',
get_class($this),
gettype($opt)
));
}
$t... | [
"public",
"function",
"setCurlOpt",
"(",
"$",
"opt",
",",
"$",
"val",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"opt",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'%s::setCurlOpt - Argument 1 expected to be intege... | Set CURL option
@link http://www.php.net/manual/en/function.curl-setopt.php
@param int $opt curl option
@param mixed $val curl option value
@throws \InvalidArgumentException
@return $this | [
"Set",
"CURL",
"option"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L189-L202 |
204,920 | dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.close | public function close()
{
if ('resource' === gettype($this->ch))
curl_close($this->ch);
$this->state = self::STATE_CLOSED;
return $this;
} | php | public function close()
{
if ('resource' === gettype($this->ch))
curl_close($this->ch);
$this->state = self::STATE_CLOSED;
return $this;
} | [
"public",
"function",
"close",
"(",
")",
"{",
"if",
"(",
"'resource'",
"===",
"gettype",
"(",
"$",
"this",
"->",
"ch",
")",
")",
"curl_close",
"(",
"$",
"this",
"->",
"ch",
")",
";",
"$",
"this",
"->",
"state",
"=",
"self",
"::",
"STATE_CLOSED",
";... | Close the curl resource, if exists | [
"Close",
"the",
"curl",
"resource",
"if",
"exists"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L249-L257 |
204,921 | dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.reset | public function reset()
{
$this->close();
$this->curlOpts = array();
$this->requestHeaders = array();
$this->currentRequestUrl = null;
$this->state = self::STATE_NEW;
return $this;
} | php | public function reset()
{
$this->close();
$this->curlOpts = array();
$this->requestHeaders = array();
$this->currentRequestUrl = null;
$this->state = self::STATE_NEW;
return $this;
} | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"close",
"(",
")",
";",
"$",
"this",
"->",
"curlOpts",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"requestHeaders",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"currentReques... | Reset to new state
@return $this | [
"Reset",
"to",
"new",
"state"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L264-L274 |
204,922 | dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.curlOptSet | public function curlOptSet($opt)
{
return isset($this->curlOpts[$opt]) || array_key_exists($opt, $this->curlOpts);
} | php | public function curlOptSet($opt)
{
return isset($this->curlOpts[$opt]) || array_key_exists($opt, $this->curlOpts);
} | [
"public",
"function",
"curlOptSet",
"(",
"$",
"opt",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"curlOpts",
"[",
"$",
"opt",
"]",
")",
"||",
"array_key_exists",
"(",
"$",
"opt",
",",
"$",
"this",
"->",
"curlOpts",
")",
";",
"}"
] | Returns true if passed in curl option has a value
@param int $opt
@return bool | [
"Returns",
"true",
"if",
"passed",
"in",
"curl",
"option",
"has",
"a",
"value"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L282-L285 |
204,923 | dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.execute | public function execute($resetAfterExecution = false)
{
$this->buildRequest();
$response = new CurlPlusResponse(
curl_exec($this->ch),
curl_getinfo($this->ch),
curl_error($this->ch),
$this->getCurlOpts()
);
if ($resetAfterExecution)
... | php | public function execute($resetAfterExecution = false)
{
$this->buildRequest();
$response = new CurlPlusResponse(
curl_exec($this->ch),
curl_getinfo($this->ch),
curl_error($this->ch),
$this->getCurlOpts()
);
if ($resetAfterExecution)
... | [
"public",
"function",
"execute",
"(",
"$",
"resetAfterExecution",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"buildRequest",
"(",
")",
";",
"$",
"response",
"=",
"new",
"CurlPlusResponse",
"(",
"curl_exec",
"(",
"$",
"this",
"->",
"ch",
")",
",",
"curl_g... | Execute CURL command
@param bool $resetAfterExecution
@throws \RuntimeException
@return \DCarbone\CurlPlus\CurlPlusResponse | [
"Execute",
"CURL",
"command"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L308-L323 |
204,924 | dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.buildRequest | protected function buildRequest()
{
if (self::STATE_NEW === $this->state)
{
throw new \RuntimeException(sprintf(
'%s::execute - Could not execute request, curl has not been initialized.',
get_class($this)
));
}
if (self::STATE_... | php | protected function buildRequest()
{
if (self::STATE_NEW === $this->state)
{
throw new \RuntimeException(sprintf(
'%s::execute - Could not execute request, curl has not been initialized.',
get_class($this)
));
}
if (self::STATE_... | [
"protected",
"function",
"buildRequest",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"STATE_NEW",
"===",
"$",
"this",
"->",
"state",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"sprintf",
"(",
"'%s::execute - Could not execute request, curl has not been ini... | Attempts to set up the client for a request, throws an exception if it cannot | [
"Attempts",
"to",
"set",
"up",
"the",
"client",
"for",
"a",
"request",
"throws",
"an",
"exception",
"if",
"it",
"cannot"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L328-L383 |
204,925 | crisu83/yii-consoletools | helpers/ConfigHelper.php | ConfigHelper.merge | public static function merge(array $array)
{
$result = array();
foreach ($array as $config) {
if (is_string($config)) {
if (!file_exists($config)) {
continue;
}
$config = require($config);
}
if (!... | php | public static function merge(array $array)
{
$result = array();
foreach ($array as $config) {
if (is_string($config)) {
if (!file_exists($config)) {
continue;
}
$config = require($config);
}
if (!... | [
"public",
"static",
"function",
"merge",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"config",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"config",
")",
")",
"{",
"if... | Merges the given configurations into a single configuration array.
@param array $array the configurations to merge.
@return array the merged configuration. | [
"Merges",
"the",
"given",
"configurations",
"into",
"a",
"single",
"configuration",
"array",
"."
] | 53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc | https://github.com/crisu83/yii-consoletools/blob/53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc/helpers/ConfigHelper.php#L20-L36 |
204,926 | znframework/package-helpers | Debugger.php | Debugger.parent | public function parent(Int $index = 1) : stdClass
{
return $this->_layer($this->debug, $index, $index + 1);
} | php | public function parent(Int $index = 1) : stdClass
{
return $this->_layer($this->debug, $index, $index + 1);
} | [
"public",
"function",
"parent",
"(",
"Int",
"$",
"index",
"=",
"1",
")",
":",
"stdClass",
"{",
"return",
"$",
"this",
"->",
"_layer",
"(",
"$",
"this",
"->",
"debug",
",",
"$",
"index",
",",
"$",
"index",
"+",
"1",
")",
";",
"}"
] | Parent Debug Data
@param int $index = 1
@return object | [
"Parent",
"Debug",
"Data"
] | c78502263cdda5c14626a1abf7fc7e02dd2bd57d | https://github.com/znframework/package-helpers/blob/c78502263cdda5c14626a1abf7fc7e02dd2bd57d/Debugger.php#L52-L55 |
204,927 | crisu83/yii-consoletools | commands/MysqldumpCommand.php | MysqldumpCommand.resolveDumpPath | protected function resolveDumpPath()
{
$path = $this->basePath . '/' . $this->dumpPath;
$this->ensureDirectory($path);
return realpath($path) . '/' . $this->dumpFile;
} | php | protected function resolveDumpPath()
{
$path = $this->basePath . '/' . $this->dumpPath;
$this->ensureDirectory($path);
return realpath($path) . '/' . $this->dumpFile;
} | [
"protected",
"function",
"resolveDumpPath",
"(",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"basePath",
".",
"'/'",
".",
"$",
"this",
"->",
"dumpPath",
";",
"$",
"this",
"->",
"ensureDirectory",
"(",
"$",
"path",
")",
";",
"return",
"realpath",
"("... | Returns the path to the dump-file.
@return string the path. | [
"Returns",
"the",
"path",
"to",
"the",
"dump",
"-",
"file",
"."
] | 53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc | https://github.com/crisu83/yii-consoletools/blob/53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc/commands/MysqldumpCommand.php#L135-L140 |
204,928 | crisu83/yii-consoletools | commands/MysqldumpCommand.php | MysqldumpCommand.normalizeOptions | protected function normalizeOptions($options)
{
$result = array();
foreach ($options as $name => $value) {
$result[] = "--$name=\"$value\"";
}
return implode(' ', $result);
} | php | protected function normalizeOptions($options)
{
$result = array();
foreach ($options as $name => $value) {
$result[] = "--$name=\"$value\"";
}
return implode(' ', $result);
} | [
"protected",
"function",
"normalizeOptions",
"(",
"$",
"options",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"options",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"result",
"[",
"]",
"=",
"\"--$name=\\\"$value... | Normalizes the given options to a string
@param array $options the options.
@return string the options. | [
"Normalizes",
"the",
"given",
"options",
"to",
"a",
"string"
] | 53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc | https://github.com/crisu83/yii-consoletools/blob/53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc/commands/MysqldumpCommand.php#L147-L154 |
204,929 | crisu83/yii-consoletools | commands/MysqldumpCommand.php | MysqldumpCommand.getDb | protected function getDb()
{
if (isset($this->_db)) {
return $this->_db;
} else {
if (($db = Yii::app()->getComponent($this->connectionID)) === null) {
throw new CException(sprintf(
'Failed to get database connection. Component %s not found... | php | protected function getDb()
{
if (isset($this->_db)) {
return $this->_db;
} else {
if (($db = Yii::app()->getComponent($this->connectionID)) === null) {
throw new CException(sprintf(
'Failed to get database connection. Component %s not found... | [
"protected",
"function",
"getDb",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_db",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_db",
";",
"}",
"else",
"{",
"if",
"(",
"(",
"$",
"db",
"=",
"Yii",
"::",
"app",
"(",
")",
"->",
... | Returns the database connection component.
@return CDbConnection the component.
@throws CException if the component is not found. | [
"Returns",
"the",
"database",
"connection",
"component",
"."
] | 53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc | https://github.com/crisu83/yii-consoletools/blob/53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc/commands/MysqldumpCommand.php#L161-L174 |
204,930 | andyburton/Sonic-Framework | src/Model.php | Model.get | public function get ($name)
{
// If the attribute doesn't exists
if (!$this->attributeExists ($name))
{
throw new Exception (get_called_class () . '->' . $name . ' attribute does not exist!');
}
// If attribute getter isn't set or is disabled
if (!$this->attributeGet ($name))
{
throw ne... | php | public function get ($name)
{
// If the attribute doesn't exists
if (!$this->attributeExists ($name))
{
throw new Exception (get_called_class () . '->' . $name . ' attribute does not exist!');
}
// If attribute getter isn't set or is disabled
if (!$this->attributeGet ($name))
{
throw ne... | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"// If the attribute doesn't exists",
"if",
"(",
"!",
"$",
"this",
"->",
"attributeExists",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"get_called_class",
"(",
")",
".",
"'->'... | Return an attribute value if allowed by attribute getter
@param string $name Attribute name
@throws Exception
@return mixed | [
"Return",
"an",
"attribute",
"value",
"if",
"allowed",
"by",
"attribute",
"getter"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L328-L370 |
204,931 | andyburton/Sonic-Framework | src/Model.php | Model.set | public function set ($name, $val, $validate = TRUE)
{
// If the attribute doesn't exists
if (!$this->attributeExists ($name))
{
throw new Exception (get_called_class () . '->' . $name . ' attribute does not exist!');
}
// If attribute setter isn't set or is disabled
if (!$this->attributeSet ... | php | public function set ($name, $val, $validate = TRUE)
{
// If the attribute doesn't exists
if (!$this->attributeExists ($name))
{
throw new Exception (get_called_class () . '->' . $name . ' attribute does not exist!');
}
// If attribute setter isn't set or is disabled
if (!$this->attributeSet ... | [
"public",
"function",
"set",
"(",
"$",
"name",
",",
"$",
"val",
",",
"$",
"validate",
"=",
"TRUE",
")",
"{",
"// If the attribute doesn't exists",
"if",
"(",
"!",
"$",
"this",
"->",
"attributeExists",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"E... | Set an attribute value if allowed by attribute setter
@param string $name Attribute name
@param mixed $val Attribute value
@param boolean $validate Whether to validate the value
@throws Exception|Parser\Exception
@return void | [
"Set",
"an",
"attribute",
"value",
"if",
"allowed",
"by",
"attribute",
"setter"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L382-L418 |
204,932 | andyburton/Sonic-Framework | src/Model.php | Model.reset | public function reset ($name)
{
// If the attribute doesn't exists
if (!$this->attributeExists ($name))
{
throw new Exception (get_called_class () . '->' . $name . ' attribute does not exist!');
}
// If attribute reset is disabled
if (!$this->attributeReset ($name))
{
throw new Exceptio... | php | public function reset ($name)
{
// If the attribute doesn't exists
if (!$this->attributeExists ($name))
{
throw new Exception (get_called_class () . '->' . $name . ' attribute does not exist!');
}
// If attribute reset is disabled
if (!$this->attributeReset ($name))
{
throw new Exceptio... | [
"public",
"function",
"reset",
"(",
"$",
"name",
")",
"{",
"// If the attribute doesn't exists",
"if",
"(",
"!",
"$",
"this",
"->",
"attributeExists",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"get_called_class",
"(",
")",
".",
"'-... | Reset an attribute value to its default
@param string $name Attribute name
@throws Exception
@return void | [
"Reset",
"an",
"attribute",
"value",
"to",
"its",
"default"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L522-L553 |
204,933 | andyburton/Sonic-Framework | src/Model.php | Model.resetPK | public function resetPK ($val = FALSE)
{
if ($val === FALSE)
{
$this->reset (static::$pk);
}
else
{
$this->attributeValues[static::$pk] = $val;
}
} | php | public function resetPK ($val = FALSE)
{
if ($val === FALSE)
{
$this->reset (static::$pk);
}
else
{
$this->attributeValues[static::$pk] = $val;
}
} | [
"public",
"function",
"resetPK",
"(",
"$",
"val",
"=",
"FALSE",
")",
"{",
"if",
"(",
"$",
"val",
"===",
"FALSE",
")",
"{",
"$",
"this",
"->",
"reset",
"(",
"static",
"::",
"$",
"pk",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"attributeValues... | Reset the primary key to default or set to a specific value
@param mixed $val Value | [
"Reset",
"the",
"primary",
"key",
"to",
"default",
"or",
"set",
"to",
"a",
"specific",
"value"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L561-L573 |
204,934 | andyburton/Sonic-Framework | src/Model.php | Model.cast | public function cast ($name, $val)
{
// Ignore if value is null
if (is_null ($val))
{
return $val;
}
// Cast value based upon attribute datatype
switch (@static::$attributes[$name]['type'])
{
case self::TYPE_INT:
$val = (int)$val;
break;
case self::TYPE_STRING:
$v... | php | public function cast ($name, $val)
{
// Ignore if value is null
if (is_null ($val))
{
return $val;
}
// Cast value based upon attribute datatype
switch (@static::$attributes[$name]['type'])
{
case self::TYPE_INT:
$val = (int)$val;
break;
case self::TYPE_STRING:
$v... | [
"public",
"function",
"cast",
"(",
"$",
"name",
",",
"$",
"val",
")",
"{",
"// Ignore if value is null",
"if",
"(",
"is_null",
"(",
"$",
"val",
")",
")",
"{",
"return",
"$",
"val",
";",
"}",
"// Cast value based upon attribute datatype",
"switch",
"(",
"@",
... | Cast a value for an attribute datatype
@param string $name Attribute name
@param mixed $val Value to cast
@return mixed | [
"Cast",
"a",
"value",
"for",
"an",
"attribute",
"datatype"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L583-L624 |
204,935 | andyburton/Sonic-Framework | src/Model.php | Model.create | public function create ($exclude = array (), &$db = FALSE)
{
// Get columns and values
$create = $this->createColumnsAndValues ($exclude);
// Get database master for write
if ($db === FALSE)
{
$db =& $this->getDbMaster ();
}
// Prepare query
$query = $db->prepare ('
INSERT INTO `... | php | public function create ($exclude = array (), &$db = FALSE)
{
// Get columns and values
$create = $this->createColumnsAndValues ($exclude);
// Get database master for write
if ($db === FALSE)
{
$db =& $this->getDbMaster ();
}
// Prepare query
$query = $db->prepare ('
INSERT INTO `... | [
"public",
"function",
"create",
"(",
"$",
"exclude",
"=",
"array",
"(",
")",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Get columns and values",
"$",
"create",
"=",
"$",
"this",
"->",
"createColumnsAndValues",
"(",
"$",
"exclude",
")",
";",
"// Get... | Create object in the database
@param array $exclude Attributes not to set
@param \PDO $db Database connection to use, default to master resource
@return boolean | [
"Create",
"object",
"in",
"the",
"database"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L634-L686 |
204,936 | andyburton/Sonic-Framework | src/Model.php | Model.createOrUpdate | public function createOrUpdate ($update, $exclude = array (), &$db = FALSE)
{
// Get columns and values
$create = $this->createColumnsAndValues ($exclude);
// Generate update values
$updateVals = NULL;
foreach ($update as $column => $value)
{
// Add column
$updateVals .= ', `'... | php | public function createOrUpdate ($update, $exclude = array (), &$db = FALSE)
{
// Get columns and values
$create = $this->createColumnsAndValues ($exclude);
// Generate update values
$updateVals = NULL;
foreach ($update as $column => $value)
{
// Add column
$updateVals .= ', `'... | [
"public",
"function",
"createOrUpdate",
"(",
"$",
"update",
",",
"$",
"exclude",
"=",
"array",
"(",
")",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Get columns and values",
"$",
"create",
"=",
"$",
"this",
"->",
"createColumnsAndValues",
"(",
"$",
... | Create or update an object in the database if it already exists
@param array $update Values to update
@param array $exclude Attributes not to set in create
@param \PDO $db Database connection to use, default to master resource
@return boolean | [
"Create",
"or",
"update",
"an",
"object",
"in",
"the",
"database",
"if",
"it",
"already",
"exists"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L697-L776 |
204,937 | andyburton/Sonic-Framework | src/Model.php | Model.createColumnsAndValues | private function createColumnsAndValues (&$exclude)
{
// If there is no primary key value exclude it (i.e assume auto increment)
if (!$this->attributeHasValue (static::$pk))
{
$exclude[] = static::$pk;
}
// Set column and value variables
$columns = NULL;
$values = NULL;
// Loop through... | php | private function createColumnsAndValues (&$exclude)
{
// If there is no primary key value exclude it (i.e assume auto increment)
if (!$this->attributeHasValue (static::$pk))
{
$exclude[] = static::$pk;
}
// Set column and value variables
$columns = NULL;
$values = NULL;
// Loop through... | [
"private",
"function",
"createColumnsAndValues",
"(",
"&",
"$",
"exclude",
")",
"{",
"// If there is no primary key value exclude it (i.e assume auto increment)",
"if",
"(",
"!",
"$",
"this",
"->",
"attributeHasValue",
"(",
"static",
"::",
"$",
"pk",
")",
")",
"{",
... | Generate create query columns and values
@param array $exclude Attribute exclusion array
@return array ('columns', 'values') | [
"Generate",
"create",
"query",
"columns",
"and",
"values"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L785-L859 |
204,938 | andyburton/Sonic-Framework | src/Model.php | Model.transformValue | private function transformValue ($name, $attribute, &$exclude)
{
// If an attribute can accept NULL and it's value is '' then NULL will be set
$value = $this->iget ($name);
if (is_null ($value) || (isset ($attribute['null']) && $attribute['null'] && $value === ''))
{
$this->iset ($name, NULL);
$valu... | php | private function transformValue ($name, $attribute, &$exclude)
{
// If an attribute can accept NULL and it's value is '' then NULL will be set
$value = $this->iget ($name);
if (is_null ($value) || (isset ($attribute['null']) && $attribute['null'] && $value === ''))
{
$this->iset ($name, NULL);
$valu... | [
"private",
"function",
"transformValue",
"(",
"$",
"name",
",",
"$",
"attribute",
",",
"&",
"$",
"exclude",
")",
"{",
"// If an attribute can accept NULL and it's value is '' then NULL will be set",
"$",
"value",
"=",
"$",
"this",
"->",
"iget",
"(",
"$",
"name",
"... | Apply any attribute value transformations for SQL query
@param string $name Attribute name
@param array $attribute Attribute property array
@param array $exclude Attribute exclusion array
@return mixed | [
"Apply",
"any",
"attribute",
"value",
"transformations",
"for",
"SQL",
"query"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L870-L916 |
204,939 | andyburton/Sonic-Framework | src/Model.php | Model.bindAttributes | private function bindAttributes (&$query, $exclude = array ())
{
// Loop through attributes
foreach (array_keys (static::$attributes) as $name)
{
// If we're excluding the attribute then move on
if (in_array ($name, $exclude))
{
continue;
}
// Bind paramater
$query->bi... | php | private function bindAttributes (&$query, $exclude = array ())
{
// Loop through attributes
foreach (array_keys (static::$attributes) as $name)
{
// If we're excluding the attribute then move on
if (in_array ($name, $exclude))
{
continue;
}
// Bind paramater
$query->bi... | [
"private",
"function",
"bindAttributes",
"(",
"&",
"$",
"query",
",",
"$",
"exclude",
"=",
"array",
"(",
")",
")",
"{",
"// Loop through attributes",
"foreach",
"(",
"array_keys",
"(",
"static",
"::",
"$",
"attributes",
")",
"as",
"$",
"name",
")",
"{",
... | Bind object attribute values to the query
@param \PDOStatement $query Query object to bind values to
@param array $exclude Attributes to exclude
@return void | [
"Bind",
"object",
"attribute",
"values",
"to",
"the",
"query"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L926-L947 |
204,940 | andyburton/Sonic-Framework | src/Model.php | Model.executeCreateUpdateQuery | private function executeCreateUpdateQuery (&$query)
{
// Execute
try
{
$query->execute ();
return TRUE;
}
catch (\PDOException $e)
{
// Catch some errors
switch ($e->getCode ())
{
// Duplicate Key
case 23000:
// Get attribute name and set error
i... | php | private function executeCreateUpdateQuery (&$query)
{
// Execute
try
{
$query->execute ();
return TRUE;
}
catch (\PDOException $e)
{
// Catch some errors
switch ($e->getCode ())
{
// Duplicate Key
case 23000:
// Get attribute name and set error
i... | [
"private",
"function",
"executeCreateUpdateQuery",
"(",
"&",
"$",
"query",
")",
"{",
"// Execute",
"try",
"{",
"$",
"query",
"->",
"execute",
"(",
")",
";",
"return",
"TRUE",
";",
"}",
"catch",
"(",
"\\",
"PDOException",
"$",
"e",
")",
"{",
"// Catch som... | Execute create or update query and cope with an exception
@param \PDOStatement $query Query object to bind values to
@return boolean
@throws PDOException | [
"Execute",
"create",
"or",
"update",
"query",
"and",
"cope",
"with",
"an",
"exception"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L957-L1007 |
204,941 | andyburton/Sonic-Framework | src/Model.php | Model.read | public function read ($pkValue = FALSE, &$db = FALSE)
{
try
{
// If there is a key value passed set it
if ($pkValue !== FALSE)
{
$this->iset (static::$pk, $pkValue);
}
// Get database slave for read
if ($db === FALSE)
{
$db =& $this->getDbSlave ();
}
// Prepare quer... | php | public function read ($pkValue = FALSE, &$db = FALSE)
{
try
{
// If there is a key value passed set it
if ($pkValue !== FALSE)
{
$this->iset (static::$pk, $pkValue);
}
// Get database slave for read
if ($db === FALSE)
{
$db =& $this->getDbSlave ();
}
// Prepare quer... | [
"public",
"function",
"read",
"(",
"$",
"pkValue",
"=",
"FALSE",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"try",
"{",
"// If there is a key value passed set it",
"if",
"(",
"$",
"pkValue",
"!==",
"FALSE",
")",
"{",
"$",
"this",
"->",
"iset",
"(",
"... | Read an object from the database, populating the object attributes
@param mixed $pkValue Primary key value
@param \PDO $db Database connection to use, default to slave resource
@return boolean | [
"Read",
"an",
"object",
"from",
"the",
"database",
"populating",
"the",
"object",
"attributes"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1017-L1089 |
204,942 | andyburton/Sonic-Framework | src/Model.php | Model.readAttribute | public function readAttribute ($name)
{
$this->iset ($name, $this->getValue (array (
'select' => $name,
'where' => array (array (static::$pk, $this->iget (static::$pk)))
)));
} | php | public function readAttribute ($name)
{
$this->iset ($name, $this->getValue (array (
'select' => $name,
'where' => array (array (static::$pk, $this->iget (static::$pk)))
)));
} | [
"public",
"function",
"readAttribute",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"iset",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"getValue",
"(",
"array",
"(",
"'select'",
"=>",
"$",
"name",
",",
"'where'",
"=>",
"array",
"(",
"array",
"(",
... | Read and set a single object attribute from the database
@param string $name Attribute name
@return void | [
"Read",
"and",
"set",
"a",
"single",
"object",
"attribute",
"from",
"the",
"database"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1098-L1104 |
204,943 | andyburton/Sonic-Framework | src/Model.php | Model.update | public function update ($exclude = array (), &$db = FALSE)
{
// Get database master for write
if ($db === FALSE)
{
$db =& $this->getDbMaster ();
}
// Changelog
$old = FALSE;
if ($this->changelog ('update'))
{
$old = static::_Read ($this->get (static::$pk), $db);
}
// Exclude t... | php | public function update ($exclude = array (), &$db = FALSE)
{
// Get database master for write
if ($db === FALSE)
{
$db =& $this->getDbMaster ();
}
// Changelog
$old = FALSE;
if ($this->changelog ('update'))
{
$old = static::_Read ($this->get (static::$pk), $db);
}
// Exclude t... | [
"public",
"function",
"update",
"(",
"$",
"exclude",
"=",
"array",
"(",
")",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Get database master for write",
"if",
"(",
"$",
"db",
"===",
"FALSE",
")",
"{",
"$",
"db",
"=",
"&",
"$",
"this",
"->",
"g... | Update an object in the database
@param array $exclude Attributes not to update
@param \PDO $db Database connection to use, default to master resource
@return boolean | [
"Update",
"an",
"object",
"in",
"the",
"database"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1114-L1219 |
204,944 | andyburton/Sonic-Framework | src/Model.php | Model.hookTransactions | public function hookTransactions (Resource\Db &$parent, Resource\Db &$child = NULL)
{
// Use default object database resource if none is specified
if (!$child)
{
$child =& $this->getResource ('db');
}
/**
* We only want to create the hook and begin a transaction on the database
* if a trans... | php | public function hookTransactions (Resource\Db &$parent, Resource\Db &$child = NULL)
{
// Use default object database resource if none is specified
if (!$child)
{
$child =& $this->getResource ('db');
}
/**
* We only want to create the hook and begin a transaction on the database
* if a trans... | [
"public",
"function",
"hookTransactions",
"(",
"Resource",
"\\",
"Db",
"&",
"$",
"parent",
",",
"Resource",
"\\",
"Db",
"&",
"$",
"child",
"=",
"NULL",
")",
"{",
"// Use default object database resource if none is specified",
"if",
"(",
"!",
"$",
"child",
")",
... | Hook any database queries into another database transaction
so that the queries are commited and rolled back at the same point
@param \Sonic\Resource\Db $parent Parent database
This is the database resource that is hooked and passes transaction state to the child database
@param \Sonic\Resource\Db $child Child database... | [
"Hook",
"any",
"database",
"queries",
"into",
"another",
"database",
"transaction",
"so",
"that",
"the",
"queries",
"are",
"commited",
"and",
"rolled",
"back",
"at",
"the",
"same",
"point"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1449-L1469 |
204,945 | andyburton/Sonic-Framework | src/Model.php | Model.toXML | public function toXML ($attributes = FALSE)
{
// Set class name for the elements
// Remove the Sonic\Model prefix and convert namespace \ to _
$class = str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
// Create DOMDocument
$doc = new \DOMDocument ('1.0'... | php | public function toXML ($attributes = FALSE)
{
// Set class name for the elements
// Remove the Sonic\Model prefix and convert namespace \ to _
$class = str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
// Create DOMDocument
$doc = new \DOMDocument ('1.0'... | [
"public",
"function",
"toXML",
"(",
"$",
"attributes",
"=",
"FALSE",
")",
"{",
"// Set class name for the elements",
"// Remove the Sonic\\Model prefix and convert namespace \\ to _",
"$",
"class",
"=",
"str_replace",
"(",
"'\\\\'",
",",
"'_'",
",",
"str_replace",
"(",
... | Return a DOM tree with object attributes
@param array|boolean $attributes Attributes to include, default to false i.e all attributes
@return \DOMDocument|boolean | [
"Return",
"a",
"DOM",
"tree",
"with",
"object",
"attributes"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1478-L1510 |
204,946 | andyburton/Sonic-Framework | src/Model.php | Model.toJSON | public function toJSON ($attributes = FALSE, $addClass = FALSE)
{
// Get array
$arr = $this->toArray ($attributes);
// Add the class name if required
if ($addClass)
{
$arr['class'] = str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
}
// Retu... | php | public function toJSON ($attributes = FALSE, $addClass = FALSE)
{
// Get array
$arr = $this->toArray ($attributes);
// Add the class name if required
if ($addClass)
{
$arr['class'] = str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
}
// Retu... | [
"public",
"function",
"toJSON",
"(",
"$",
"attributes",
"=",
"FALSE",
",",
"$",
"addClass",
"=",
"FALSE",
")",
"{",
"// Get array",
"$",
"arr",
"=",
"$",
"this",
"->",
"toArray",
"(",
"$",
"attributes",
")",
";",
"// Add the class name if required",
"if",
... | Return a JSON encoded string with object attributes
@param array|boolean $attributes Attributes to include, default to false i.e all attributes
@param boolean $addClass Whether to add the class name to each exported object
@return object|boolean | [
"Return",
"a",
"JSON",
"encoded",
"string",
"with",
"object",
"attributes"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1520-L1538 |
204,947 | andyburton/Sonic-Framework | src/Model.php | Model.fromArray | public function fromArray ($attributes, $removeClass = FALSE, $validate = TRUE, $required = array (), $valid = array ())
{
// Remove class prefix
if ($removeClass)
{
// Set attributes to set
$arr = array ();
// Get class name
$class = strtolower ($this->getClass ());
// Loop through ... | php | public function fromArray ($attributes, $removeClass = FALSE, $validate = TRUE, $required = array (), $valid = array ())
{
// Remove class prefix
if ($removeClass)
{
// Set attributes to set
$arr = array ();
// Get class name
$class = strtolower ($this->getClass ());
// Loop through ... | [
"public",
"function",
"fromArray",
"(",
"$",
"attributes",
",",
"$",
"removeClass",
"=",
"FALSE",
",",
"$",
"validate",
"=",
"TRUE",
",",
"$",
"required",
"=",
"array",
"(",
")",
",",
"$",
"valid",
"=",
"array",
"(",
")",
")",
"{",
"// Remove class pre... | Populate object attributes from an array
@param array $attributes Attributes array
@param boolean $removeClass Remove class prefix from the attribute name
@param boolean $validate Validate attributes during set
@param array $required Required attributes
@param array $valid Valid attributes to set
@return void | [
"Populate",
"object",
"attributes",
"from",
"an",
"array"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1738-L1840 |
204,948 | andyburton/Sonic-Framework | src/Model.php | Model.getChildren | public function getChildren ($class, $recursive = FALSE, $index = FALSE, $key = FALSE, $params = array ())
{
// Get children
$children = self::_getChildren ($class, $this->iget (self::$pk), $recursive, $key, $params);
// If we want the indexes
if ($index)
{
$children = static::_getChildrenInde... | php | public function getChildren ($class, $recursive = FALSE, $index = FALSE, $key = FALSE, $params = array ())
{
// Get children
$children = self::_getChildren ($class, $this->iget (self::$pk), $recursive, $key, $params);
// If we want the indexes
if ($index)
{
$children = static::_getChildrenInde... | [
"public",
"function",
"getChildren",
"(",
"$",
"class",
",",
"$",
"recursive",
"=",
"FALSE",
",",
"$",
"index",
"=",
"FALSE",
",",
"$",
"key",
"=",
"FALSE",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"// Get children",
"$",
"children",
"="... | Return child objects matching class type
@param string $class Child class type
@param boolean $recursive Whether to load childrens children.
This will create an object attribute called 'children' on all objects
@param boolean $index Return indexed child array rather than object array
@param string $key Attribute to use... | [
"Return",
"child",
"objects",
"matching",
"class",
"type"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1893-L1909 |
204,949 | andyburton/Sonic-Framework | src/Model.php | Model.getValue | public function getValue ($params, $fetchMode = \PDO::FETCH_ASSOC, &$db = FALSE)
{
// Get database slave for read
if ($db === FALSE)
{
$db =& self::_getDbSlave ();
}
// Set table
$params['from'] = '`' . static::$dbTable . '`';
// Return value
return $db->getValue ($params, $fetchMode);
... | php | public function getValue ($params, $fetchMode = \PDO::FETCH_ASSOC, &$db = FALSE)
{
// Get database slave for read
if ($db === FALSE)
{
$db =& self::_getDbSlave ();
}
// Set table
$params['from'] = '`' . static::$dbTable . '`';
// Return value
return $db->getValue ($params, $fetchMode);
... | [
"public",
"function",
"getValue",
"(",
"$",
"params",
",",
"$",
"fetchMode",
"=",
"\\",
"PDO",
"::",
"FETCH_ASSOC",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Get database slave for read",
"if",
"(",
"$",
"db",
"===",
"FALSE",
")",
"{",
"$",
"db"... | Return a single row
@param array $params Parameter array
@param int $fetchMode PDO fetch mode, default to assoc
@param \PDO $db Database connection to use, default to slave resource
@return mixed | [
"Return",
"a",
"single",
"row"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1920-L1938 |
204,950 | andyburton/Sonic-Framework | src/Model.php | Model.& | public function &getResource ($name)
{
// If the resource is not set
if (!isset ($this->resources[$name]))
{
// Return FALSE
$bln = FALSE;
return $bln;
}
// Return resource reference
return $this->resources[$name];
} | php | public function &getResource ($name)
{
// If the resource is not set
if (!isset ($this->resources[$name]))
{
// Return FALSE
$bln = FALSE;
return $bln;
}
// Return resource reference
return $this->resources[$name];
} | [
"public",
"function",
"&",
"getResource",
"(",
"$",
"name",
")",
"{",
"// If the resource is not set",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"resources",
"[",
"$",
"name",
"]",
")",
")",
"{",
"// Return FALSE",
"$",
"bln",
"=",
"FALSE",
";",
... | Return a class resource reference
@param string $name Resource name
@return object|boolean | [
"Return",
"a",
"class",
"resource",
"reference"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2053-L2072 |
204,951 | andyburton/Sonic-Framework | src/Model.php | Model.setResource | public function setResource ($name, $resource)
{
// Get the resource
$obj =& Sonic::getResource ($resource);
if (!$obj)
{
return FALSE;
}
// Set resource object
$this->setResourceObj ($name, $obj);
// Return
return TRUE;
} | php | public function setResource ($name, $resource)
{
// Get the resource
$obj =& Sonic::getResource ($resource);
if (!$obj)
{
return FALSE;
}
// Set resource object
$this->setResourceObj ($name, $obj);
// Return
return TRUE;
} | [
"public",
"function",
"setResource",
"(",
"$",
"name",
",",
"$",
"resource",
")",
"{",
"// Get the resource",
"$",
"obj",
"=",
"&",
"Sonic",
"::",
"getResource",
"(",
"$",
"resource",
")",
";",
"if",
"(",
"!",
"$",
"obj",
")",
"{",
"return",
"FALSE",
... | Set an internal resource from a framework resource
@param string $name Resource name
@param string|array $resource Framework resource referece
@return boolean | [
"Set",
"an",
"internal",
"resource",
"from",
"a",
"framework",
"resource"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2082-L2102 |
204,952 | andyburton/Sonic-Framework | src/Model.php | Model.setResourceObj | public function setResourceObj ($name, &$resource)
{
// Set the resource
$this->resources[$name] =& $resource;
// If the object variable exists
if (isset ($this->$name))
{
// Assign to object variable
$this->$name =& $this->resources[$name];
}
} | php | public function setResourceObj ($name, &$resource)
{
// Set the resource
$this->resources[$name] =& $resource;
// If the object variable exists
if (isset ($this->$name))
{
// Assign to object variable
$this->$name =& $this->resources[$name];
}
} | [
"public",
"function",
"setResourceObj",
"(",
"$",
"name",
",",
"&",
"$",
"resource",
")",
"{",
"// Set the resource",
"$",
"this",
"->",
"resources",
"[",
"$",
"name",
"]",
"=",
"&",
"$",
"resource",
";",
"// If the object variable exists ",
"if",
"(",
"isse... | Set a class resource from the resource object
@param string $name Resource name
@param object $resource Resource object
@return void | [
"Set",
"a",
"class",
"resource",
"from",
"the",
"resource",
"object"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2112-L2130 |
204,953 | andyburton/Sonic-Framework | src/Model.php | Model.removeResource | public function removeResource ($name)
{
if (isset ($this->resources[$name]))
{
unset ($this->resources[$name]);
if (isset ($this->$name))
{
unset ($this->$name);
}
}
} | php | public function removeResource ($name)
{
if (isset ($this->resources[$name]))
{
unset ($this->resources[$name]);
if (isset ($this->$name))
{
unset ($this->$name);
}
}
} | [
"public",
"function",
"removeResource",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"resources",
"[",
"$",
"name",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"resources",
"[",
"$",
"name",
"]",
")",
";",
"if"... | Remove a class resource
@param string $name Resource name
@return void | [
"Remove",
"a",
"class",
"resource"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2139-L2154 |
204,954 | andyburton/Sonic-Framework | src/Model.php | Model.removeResources | public function removeResources ()
{
foreach (array_keys ($this->resources) as $name)
{
if (isset ($this->$name))
{
unset ($this->$name);
}
}
unset ($this->resources);
} | php | public function removeResources ()
{
foreach (array_keys ($this->resources) as $name)
{
if (isset ($this->$name))
{
unset ($this->$name);
}
}
unset ($this->resources);
} | [
"public",
"function",
"removeResources",
"(",
")",
"{",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"resources",
")",
"as",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"$",
"name",
")",
")",
"{",
"unset",
"(",
"$",
... | Remove all class resources
@return void | [
"Remove",
"all",
"class",
"resources"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2162-L2175 |
204,955 | andyburton/Sonic-Framework | src/Model.php | Model._attributeProperties | public static function _attributeProperties ($name, $property = FALSE)
{
// If the attribute exists
if (isset (static::$attributes[$name]))
{
// If a property is specified
if ($property)
{
// If the property doesnt exist
if (!isset (static::$attributes[$name][$property]))... | php | public static function _attributeProperties ($name, $property = FALSE)
{
// If the attribute exists
if (isset (static::$attributes[$name]))
{
// If a property is specified
if ($property)
{
// If the property doesnt exist
if (!isset (static::$attributes[$name][$property]))... | [
"public",
"static",
"function",
"_attributeProperties",
"(",
"$",
"name",
",",
"$",
"property",
"=",
"FALSE",
")",
"{",
"// If the attribute exists",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"attributes",
"[",
"$",
"name",
"]",
")",
")",
"{",
"// If a... | Return an attribute parameters array or FALSE if it doesnt exist
Also pass option property array to return a single attribute property
@param string $name Attribute name
@param string $property Attribute property
@return boolean | [
"Return",
"an",
"attribute",
"parameters",
"array",
"or",
"FALSE",
"if",
"it",
"doesnt",
"exist",
"Also",
"pass",
"option",
"property",
"array",
"to",
"return",
"a",
"single",
"attribute",
"property"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2258-L2294 |
204,956 | andyburton/Sonic-Framework | src/Model.php | Model._read | public static function _read ($params, &$db = FALSE)
{
// Create the object
$obj = new static;
// If the params are an array
if (is_array ($params))
{
// Select all
$params['select'] = '*';
// Get data
$row = static::_getValue ($params, \PDO::FETCH_ASSOC, $db);
// If no data ... | php | public static function _read ($params, &$db = FALSE)
{
// Create the object
$obj = new static;
// If the params are an array
if (is_array ($params))
{
// Select all
$params['select'] = '*';
// Get data
$row = static::_getValue ($params, \PDO::FETCH_ASSOC, $db);
// If no data ... | [
"public",
"static",
"function",
"_read",
"(",
"$",
"params",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Create the object",
"$",
"obj",
"=",
"new",
"static",
";",
"// If the params are an array",
"if",
"(",
"is_array",
"(",
"$",
"params",
")",
")",
... | Create a new object instance and read it from the database, populating the object attributes
@param mixed $params Object to read.
This can be an instance ID or a parameter array.
@param \PDO $db Database connection to use
@return \Sonic\Model | [
"Create",
"a",
"new",
"object",
"instance",
"and",
"read",
"it",
"from",
"the",
"database",
"populating",
"the",
"object",
"attributes"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2373-L2432 |
204,957 | andyburton/Sonic-Framework | src/Model.php | Model._count | public static function _count ($params = array (), &$db = FALSE)
{
// Remove order
if (isset ($params['orderby']))
{
unset ($params['orderby']);
}
// Remove limit
if (isset ($params['limit']))
{
unset ($params['limit']);
}
// Select count
$params['select'] = 'COUNT(*)';
// Retu... | php | public static function _count ($params = array (), &$db = FALSE)
{
// Remove order
if (isset ($params['orderby']))
{
unset ($params['orderby']);
}
// Remove limit
if (isset ($params['limit']))
{
unset ($params['limit']);
}
// Select count
$params['select'] = 'COUNT(*)';
// Retu... | [
"public",
"static",
"function",
"_count",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Remove order",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'orderby'",
"]",
")",
")",
"{",
"unset",
"(",
"$",
... | Return the number of objects in the database matching the parameters
@param array $params Parameter array
@param \PDO $db Database connection to use
@return integer|boolean | [
"Return",
"the",
"number",
"of",
"objects",
"in",
"the",
"database",
"matching",
"the",
"parameters"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2463-L2488 |
204,958 | andyburton/Sonic-Framework | src/Model.php | Model._exists | public static function _exists ($params, &$db = FALSE)
{
if (!is_array ($params))
{
$params = array (
'where' => array (
array (static::$pk, $params)
)
);
}
return self::_count ($params, $db) > 0;
} | php | public static function _exists ($params, &$db = FALSE)
{
if (!is_array ($params))
{
$params = array (
'where' => array (
array (static::$pk, $params)
)
);
}
return self::_count ($params, $db) > 0;
} | [
"public",
"static",
"function",
"_exists",
"(",
"$",
"params",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'where'",
"=>",
"array",
"(",
"array",
"... | Check to see whether the object matching the parameters exists
@param array $params Parameter array
@param \PDO $db Database connection to use
@return boolean | [
"Check",
"to",
"see",
"whether",
"the",
"object",
"matching",
"the",
"parameters",
"exists"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2498-L2512 |
204,959 | andyburton/Sonic-Framework | src/Model.php | Model._getObjects | public static function _getObjects ($params = array (), $key = FALSE, &$db = FALSE)
{
// Select all attributes if none are set
if (!isset ($params['select']))
{
$params['select'] = '*';
}
// Get data
$rows = static::_getValues ($params, $db);
// If no data was returned return FALSE
if ... | php | public static function _getObjects ($params = array (), $key = FALSE, &$db = FALSE)
{
// Select all attributes if none are set
if (!isset ($params['select']))
{
$params['select'] = '*';
}
// Get data
$rows = static::_getValues ($params, $db);
// If no data was returned return FALSE
if ... | [
"public",
"static",
"function",
"_getObjects",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"key",
"=",
"FALSE",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Select all attributes if none are set",
"if",
"(",
"!",
"isset",
"(",
"$",
"params"... | Create and return an array of objects for query parameters
@param array $params Parameter array
@param string $key Attribute value to use as the array index, default to 0-indexed
@param \PDO $db Database connection to use
@return \Sonic\Resource\Model\Collection | [
"Create",
"and",
"return",
"an",
"array",
"of",
"objects",
"for",
"query",
"parameters"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2638-L2663 |
204,960 | andyburton/Sonic-Framework | src/Model.php | Model._queryToObjects | public static function _queryToObjects ($query, $key = FALSE)
{
$query->execute ();
return static::_arrayToObjects ($query->fetchAll (\PDO::FETCH_ASSOC), $key);
} | php | public static function _queryToObjects ($query, $key = FALSE)
{
$query->execute ();
return static::_arrayToObjects ($query->fetchAll (\PDO::FETCH_ASSOC), $key);
} | [
"public",
"static",
"function",
"_queryToObjects",
"(",
"$",
"query",
",",
"$",
"key",
"=",
"FALSE",
")",
"{",
"$",
"query",
"->",
"execute",
"(",
")",
";",
"return",
"static",
"::",
"_arrayToObjects",
"(",
"$",
"query",
"->",
"fetchAll",
"(",
"\\",
"P... | Execute a PDOStatement query and convert the results into objects
@param \PDOStatement Query to execute
@param string $key Attribute value to use as the array index, default to 0-indexed
@return Resource\Model\Collection | [
"Execute",
"a",
"PDOStatement",
"query",
"and",
"convert",
"the",
"results",
"into",
"objects"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2673-L2677 |
204,961 | andyburton/Sonic-Framework | src/Model.php | Model._arrayToObjects | public static function _arrayToObjects ($arr, $key = FALSE)
{
// Set object array
$objs = new Resource\Model\Collection;
// If no data
if (!$arr)
{
return $objs;
}
// For each row
foreach ($arr as $row)
{
// Create the object
$obj = new static;
// Set each attribute va... | php | public static function _arrayToObjects ($arr, $key = FALSE)
{
// Set object array
$objs = new Resource\Model\Collection;
// If no data
if (!$arr)
{
return $objs;
}
// For each row
foreach ($arr as $row)
{
// Create the object
$obj = new static;
// Set each attribute va... | [
"public",
"static",
"function",
"_arrayToObjects",
"(",
"$",
"arr",
",",
"$",
"key",
"=",
"FALSE",
")",
"{",
"// Set object array",
"$",
"objs",
"=",
"new",
"Resource",
"\\",
"Model",
"\\",
"Collection",
";",
"// If no data",
"if",
"(",
"!",
"$",
"arr",
... | Convert an array into objects
@param array $arr Array to convert
@param string $key Attribute value to use as the array index, default to 0-indexed
@return Resource\Model\Collection | [
"Convert",
"an",
"array",
"into",
"objects"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2687-L2739 |
204,962 | andyburton/Sonic-Framework | src/Model.php | Model._genQuery | public static function _genQuery ($params, &$db = FALSE)
{
// Set select
if (!isset ($params['select']))
{
$params['select'] = '*';
}
// Set from
if (!isset ($params['from']))
{
$params['from'] = '`' . static::$dbTable . '`';
}
// Get database slave for read
if ($db === FALSE)
... | php | public static function _genQuery ($params, &$db = FALSE)
{
// Set select
if (!isset ($params['select']))
{
$params['select'] = '*';
}
// Set from
if (!isset ($params['from']))
{
$params['from'] = '`' . static::$dbTable . '`';
}
// Get database slave for read
if ($db === FALSE)
... | [
"public",
"static",
"function",
"_genQuery",
"(",
"$",
"params",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Set select",
"if",
"(",
"!",
"isset",
"(",
"$",
"params",
"[",
"'select'",
"]",
")",
")",
"{",
"$",
"params",
"[",
"'select'",
"]",
"=... | Generate a query and return the PDOStatement object
@param array $params Query parameters
@param \Sonic\Resource\Db $db Database resource, default to class slave
@return \PDOStatement
@throws Exception | [
"Generate",
"a",
"query",
"and",
"return",
"the",
"PDOStatement",
"object"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2750-L2783 |
204,963 | andyburton/Sonic-Framework | src/Model.php | Model._genSQL | public static function _genSQL ($params = array (), &$db = FALSE)
{
// Set select
if (!isset ($params['select']))
{
$params['select'] = '*';
}
// Set from
if (!isset ($params['from']))
{
$params['from'] = '`' . static::$dbTable . '`';
}
// Get database slave for read
if ($db === ... | php | public static function _genSQL ($params = array (), &$db = FALSE)
{
// Set select
if (!isset ($params['select']))
{
$params['select'] = '*';
}
// Set from
if (!isset ($params['from']))
{
$params['from'] = '`' . static::$dbTable . '`';
}
// Get database slave for read
if ($db === ... | [
"public",
"static",
"function",
"_genSQL",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Set select",
"if",
"(",
"!",
"isset",
"(",
"$",
"params",
"[",
"'select'",
"]",
")",
")",
"{",
"$",
"params",
... | Generate the SQL for a query on the model
@param array $params Parameter array
@param \PDO $db Database connection to use, default db
@return string | [
"Generate",
"the",
"SQL",
"for",
"a",
"query",
"on",
"the",
"model"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2793-L2826 |
204,964 | andyburton/Sonic-Framework | src/Model.php | Model._toXML | public static function _toXML ($params = array (), $attributes = FALSE, &$db = FALSE)
{
// Set class name for the elements
// Remove the Sonic\Model prefix and convert namespace \ to _
$class = str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
// Create DOM... | php | public static function _toXML ($params = array (), $attributes = FALSE, &$db = FALSE)
{
// Set class name for the elements
// Remove the Sonic\Model prefix and convert namespace \ to _
$class = str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
// Create DOM... | [
"public",
"static",
"function",
"_toXML",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"attributes",
"=",
"FALSE",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Set class name for the elements",
"// Remove the Sonic\\Model prefix and convert namespace \\... | Return a DOM tree with objects for given query parameters
@param array $params Parameter array
@param array|boolean $attributes Attributes to include, default to false i.e all attributes
@param \PDO $db Database connection to use
@return \DOMDocument|boolean | [
"Return",
"a",
"DOM",
"tree",
"with",
"objects",
"for",
"given",
"query",
"parameters"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2837-L2884 |
204,965 | andyburton/Sonic-Framework | src/Model.php | Model._toJSON | public static function _toJSON ($params = array (), $attributes = FALSE, $addClass = FALSE, &$db = FALSE)
{
// Get objects
$rows = static::_toArray ($params, $attributes, $db);
// Add the class name if required
if ($addClass)
{
// Set class name for the elements
// Remove the Sonic\Mo... | php | public static function _toJSON ($params = array (), $attributes = FALSE, $addClass = FALSE, &$db = FALSE)
{
// Get objects
$rows = static::_toArray ($params, $attributes, $db);
// Add the class name if required
if ($addClass)
{
// Set class name for the elements
// Remove the Sonic\Mo... | [
"public",
"static",
"function",
"_toJSON",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"attributes",
"=",
"FALSE",
",",
"$",
"addClass",
"=",
"FALSE",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Get objects",
"$",
"rows",
"=",
"static"... | Return a JSON encoded string with objects for given query parameters
@param array $params Parameter array
@param array|boolean $attributes Attributes to include, default to false i.e all attributes
@param boolean $addClass Whether to add the class name to each exported object
@param \PDO $db Database connection to use
... | [
"Return",
"a",
"JSON",
"encoded",
"string",
"with",
"objects",
"for",
"given",
"query",
"parameters"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2896-L2924 |
204,966 | andyburton/Sonic-Framework | src/Model.php | Model._toArray | public static function _toArray ($params = array (), $attributes = FALSE, &$db = FALSE)
{
// If no attributes are set to display, get all class attributes with get allowed
if ($attributes === FALSE)
{
$attributes = array ();
$obj = new static;
foreach (array_keys (static::$attributes) as ... | php | public static function _toArray ($params = array (), $attributes = FALSE, &$db = FALSE)
{
// If no attributes are set to display, get all class attributes with get allowed
if ($attributes === FALSE)
{
$attributes = array ();
$obj = new static;
foreach (array_keys (static::$attributes) as ... | [
"public",
"static",
"function",
"_toArray",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"attributes",
"=",
"FALSE",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// If no attributes are set to display, get all class attributes with get allowed",
"if",
"(... | Return an array with object attributes for given query parameters
@param array $params Parameter array
@param array|boolean $attributes Attributes to include, default to false i.e all attributes
@param \PDO $db Database connection to use
@return object|boolean | [
"Return",
"an",
"array",
"with",
"object",
"attributes",
"for",
"given",
"query",
"parameters"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2935-L3006 |
204,967 | andyburton/Sonic-Framework | src/Model.php | Model._getRelationPaths | public static function _getRelationPaths ($endClass, $fork = array (), $paths = array (), $processed = array (), $depth = 0)
{
// Remove first \ from end class
if ($endClass[0] == '\\')
{
$endClass = substr ($endClass, 1);
}
// Make sure fork is an array
if ($fork === FALSE)
{
$fork = a... | php | public static function _getRelationPaths ($endClass, $fork = array (), $paths = array (), $processed = array (), $depth = 0)
{
// Remove first \ from end class
if ($endClass[0] == '\\')
{
$endClass = substr ($endClass, 1);
}
// Make sure fork is an array
if ($fork === FALSE)
{
$fork = a... | [
"public",
"static",
"function",
"_getRelationPaths",
"(",
"$",
"endClass",
",",
"$",
"fork",
"=",
"array",
"(",
")",
",",
"$",
"paths",
"=",
"array",
"(",
")",
",",
"$",
"processed",
"=",
"array",
"(",
")",
",",
"$",
"depth",
"=",
"0",
")",
"{",
... | Return an array of available paths to a related class
@param string $class Destination class
@param array $fork Used to determine which fork to use when there are
multiple attributes related to the same class (see getRelated comments)
@param array $paths Available paths, set recursively
@param array $processed Already ... | [
"Return",
"an",
"array",
"of",
"available",
"paths",
"to",
"a",
"related",
"class"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3020-L3091 |
204,968 | andyburton/Sonic-Framework | src/Model.php | Model._getRelation | public static function _getRelation ($obj, $path, $params = array ())
{
foreach ($path as $class => $name)
{
$class = get_class ($obj);
$childClass = $class::$attributes[$name]['relation'];
if ($obj->iget ($name))
{
$params['where'][] = array ($childClass::$pk, $obj->iget ($name));
... | php | public static function _getRelation ($obj, $path, $params = array ())
{
foreach ($path as $class => $name)
{
$class = get_class ($obj);
$childClass = $class::$attributes[$name]['relation'];
if ($obj->iget ($name))
{
$params['where'][] = array ($childClass::$pk, $obj->iget ($name));
... | [
"public",
"static",
"function",
"_getRelation",
"(",
"$",
"obj",
",",
"$",
"path",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"path",
"as",
"$",
"class",
"=>",
"$",
"name",
")",
"{",
"$",
"class",
"=",
"get_class",
... | Return a related object for a given object and path
@param Model $obj Starting object
@param array $path Path to the end object
@param array $params Query parameter array
@return \Sonic\Model|boolean | [
"Return",
"a",
"related",
"object",
"for",
"a",
"given",
"object",
"and",
"path"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3140-L3163 |
204,969 | andyburton/Sonic-Framework | src/Model.php | Model._getChildren | public static function _getChildren ($class, $id, $recursive = FALSE, $key = FALSE, $params = array ())
{
// Remove first \ from class
if ($class[0] == '\\')
{
$class = substr ($class, 1);
}
// Get current (parent) class
$parent = get_called_class ();
// Find the child variable pointing... | php | public static function _getChildren ($class, $id, $recursive = FALSE, $key = FALSE, $params = array ())
{
// Remove first \ from class
if ($class[0] == '\\')
{
$class = substr ($class, 1);
}
// Get current (parent) class
$parent = get_called_class ();
// Find the child variable pointing... | [
"public",
"static",
"function",
"_getChildren",
"(",
"$",
"class",
",",
"$",
"id",
",",
"$",
"recursive",
"=",
"FALSE",
",",
"$",
"key",
"=",
"FALSE",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"// Remove first \\ from class",
"if",
"(",
"$"... | Return child objects with an attribute matching the current class and specified ID
@param string $class Child class
@param integer $id Parent ID
@param boolean $recursive Whether to load childrens children.
This will create an object attribute called 'children' on all objects
@param string $key Attribute to use as arra... | [
"Return",
"child",
"objects",
"with",
"an",
"attribute",
"matching",
"the",
"current",
"class",
"and",
"specified",
"ID"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3177-L3246 |
204,970 | andyburton/Sonic-Framework | src/Model.php | Model.getFromPivot | public function getFromPivot (\Sonic\Model $target, \Sonic\Model $pivot, $key = FALSE, $params = [])
{
// Find the pivot attribute pointing to the source
$sourceClass = get_called_class ();
$sourceRef = FALSE;
foreach ($pivot::$attributes as $name => $attribute)
{
if (isset ($attribute['relation... | php | public function getFromPivot (\Sonic\Model $target, \Sonic\Model $pivot, $key = FALSE, $params = [])
{
// Find the pivot attribute pointing to the source
$sourceClass = get_called_class ();
$sourceRef = FALSE;
foreach ($pivot::$attributes as $name => $attribute)
{
if (isset ($attribute['relation... | [
"public",
"function",
"getFromPivot",
"(",
"\\",
"Sonic",
"\\",
"Model",
"$",
"target",
",",
"\\",
"Sonic",
"\\",
"Model",
"$",
"pivot",
",",
"$",
"key",
"=",
"FALSE",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"// Find the pivot attribute pointing to th... | Return related objects from a many-to-many pivot table
@param \Sonic\Model $target Target objects to return
@param \Sonic\Model $pivot Pivot object
@return boolean|Model\Collection | [
"Return",
"related",
"objects",
"from",
"a",
"many",
"-",
"to",
"-",
"many",
"pivot",
"table"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3278-L3343 |
204,971 | andyburton/Sonic-Framework | src/Model.php | Model._getGrid | public static function _getGrid ($params = array (), $relations = array (), &$db = FALSE)
{
// If no limit has been set
if (!$params || !isset ($params['limit']))
{
// Set default query limit
$params['limit'] = array (0, 50);
}
// Get data
if ($relations)
{
$objs = static::_g... | php | public static function _getGrid ($params = array (), $relations = array (), &$db = FALSE)
{
// If no limit has been set
if (!$params || !isset ($params['limit']))
{
// Set default query limit
$params['limit'] = array (0, 50);
}
// Get data
if ($relations)
{
$objs = static::_g... | [
"public",
"static",
"function",
"_getGrid",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"relations",
"=",
"array",
"(",
")",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// If no limit has been set",
"if",
"(",
"!",
"$",
"params",
"||",
"!... | Return an array of items with total result count
@param array $params Array of query parameters - MUST BE ESCAPED!
@param array $relations Array of related object attributes or tranformed method attributes to return
e.g. related value - 'query_name' => array ('\Sonic\Model\User\Group', 'name')
e.g. tranformed value - '... | [
"Return",
"an",
"array",
"of",
"items",
"with",
"total",
"result",
"count"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3356-L3425 |
204,972 | andyburton/Sonic-Framework | src/Model.php | Model.& | public static function &_getResource ($name)
{
if (is_array ($name))
{
return Sonic::getResource ($name);
}
else if (isset (static::$defaultResources[$name]))
{
return Sonic::getResource (static::$defaultResources[$name]);
}
else
{
return Sonic::getSelectedResource ($name);
}
} | php | public static function &_getResource ($name)
{
if (is_array ($name))
{
return Sonic::getResource ($name);
}
else if (isset (static::$defaultResources[$name]))
{
return Sonic::getResource (static::$defaultResources[$name]);
}
else
{
return Sonic::getSelectedResource ($name);
}
} | [
"public",
"static",
"function",
"&",
"_getResource",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"return",
"Sonic",
"::",
"getResource",
"(",
"$",
"name",
")",
";",
"}",
"else",
"if",
"(",
"isset",
"(",
"stat... | Return a class resource
This will either be the default as defined for the class or the global framework resource
@param string|array $name Resource name
@return object|boolean | [
"Return",
"a",
"class",
"resource",
"This",
"will",
"either",
"be",
"the",
"default",
"as",
"defined",
"for",
"the",
"class",
"or",
"the",
"global",
"framework",
"resource"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3435-L3451 |
204,973 | andyburton/Sonic-Framework | src/Model.php | Model.& | public static function &_getRandomDbResource ($group)
{
$obj = FALSE;
while (Sonic::countResourceGroup ($group) > 0)
{
$name = Sonic::selectRandomResource ($group);
$obj =& Sonic::getResource (array ($group, $name));
// If a PDO object
if ($obj instanceof \PDO)
{
// Attempt to con... | php | public static function &_getRandomDbResource ($group)
{
$obj = FALSE;
while (Sonic::countResourceGroup ($group) > 0)
{
$name = Sonic::selectRandomResource ($group);
$obj =& Sonic::getResource (array ($group, $name));
// If a PDO object
if ($obj instanceof \PDO)
{
// Attempt to con... | [
"public",
"static",
"function",
"&",
"_getRandomDbResource",
"(",
"$",
"group",
")",
"{",
"$",
"obj",
"=",
"FALSE",
";",
"while",
"(",
"Sonic",
"::",
"countResourceGroup",
"(",
"$",
"group",
")",
">",
"0",
")",
"{",
"$",
"name",
"=",
"Sonic",
"::",
"... | Return random database resource object
@param string $group Group name
@return boolean|\Sonic\Model\PDO | [
"Return",
"random",
"database",
"resource",
"object"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3460-L3518 |
204,974 | andyburton/Sonic-Framework | src/Model.php | Model.changelog | private function changelog ($type)
{
// If changelog or type is disabled for the class return FALSE
if (isset (static::$changelogIgnore))
{
if (static::$changelogIgnore === TRUE ||
is_array (static::$changelogIgnore) && in_array ($type, static::$changelogIgnore))
{
return FALSE;
}
... | php | private function changelog ($type)
{
// If changelog or type is disabled for the class return FALSE
if (isset (static::$changelogIgnore))
{
if (static::$changelogIgnore === TRUE ||
is_array (static::$changelogIgnore) && in_array ($type, static::$changelogIgnore))
{
return FALSE;
}
... | [
"private",
"function",
"changelog",
"(",
"$",
"type",
")",
"{",
"// If changelog or type is disabled for the class return FALSE",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"changelogIgnore",
")",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"changelogIgnore",
"==... | Whether to write to the changelog
@param string $type Change type (create, update, delete)
@return boolean | [
"Whether",
"to",
"write",
"to",
"the",
"changelog"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3624-L3652 |
204,975 | frankfoerster/cakephp-asset | src/View/Helper/AssetHelper.php | AssetHelper.css | public function css($path, $plugin = false, $appendTime = true, array $attributes = [])
{
$href = $this->getUrl($path, $plugin, $appendTime);
return '<link rel="stylesheet" type="text/css" href="' . $href . '"' . $this->_renderAttributes($attributes) . '>';
} | php | public function css($path, $plugin = false, $appendTime = true, array $attributes = [])
{
$href = $this->getUrl($path, $plugin, $appendTime);
return '<link rel="stylesheet" type="text/css" href="' . $href . '"' . $this->_renderAttributes($attributes) . '>';
} | [
"public",
"function",
"css",
"(",
"$",
"path",
",",
"$",
"plugin",
"=",
"false",
",",
"$",
"appendTime",
"=",
"true",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"href",
"=",
"$",
"this",
"->",
"getUrl",
"(",
"$",
"path",
",",
... | Output a link stylesheet tag for a specific css file and optionally
append a last modified timestamp to clear the browser cache.
@param string $path The path to the css file relative to WEBROOT
@param bool $plugin Either false or the name of a plugin.
@param bool $appendTime Whether to append a last modified timestamp... | [
"Output",
"a",
"link",
"stylesheet",
"tag",
"for",
"a",
"specific",
"css",
"file",
"and",
"optionally",
"append",
"a",
"last",
"modified",
"timestamp",
"to",
"clear",
"the",
"browser",
"cache",
"."
] | 07b3646006d9bbf4f2d6fceeb319373392752b63 | https://github.com/frankfoerster/cakephp-asset/blob/07b3646006d9bbf4f2d6fceeb319373392752b63/src/View/Helper/AssetHelper.php#L52-L57 |
204,976 | frankfoerster/cakephp-asset | src/View/Helper/AssetHelper.php | AssetHelper.js | public function js($path, $plugin = false, $appendTime = true, array $attributes = [])
{
$src = $this->getUrl($path, $plugin, $appendTime);
return '<script type="text/javascript" src="' . $src . '"' . $this->_renderAttributes($attributes) . '></script>';
} | php | public function js($path, $plugin = false, $appendTime = true, array $attributes = [])
{
$src = $this->getUrl($path, $plugin, $appendTime);
return '<script type="text/javascript" src="' . $src . '"' . $this->_renderAttributes($attributes) . '></script>';
} | [
"public",
"function",
"js",
"(",
"$",
"path",
",",
"$",
"plugin",
"=",
"false",
",",
"$",
"appendTime",
"=",
"true",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"src",
"=",
"$",
"this",
"->",
"getUrl",
"(",
"$",
"path",
",",
... | Output a script tag for a specific js file and optionally
append a last modified timestamp to clear the browser cache.
@param string $path The path to the css file relative to the app or plugin webroot.
@param bool|string $plugin Either false or the name of a plugin.
@param bool $appendTime Whether to append a last mo... | [
"Output",
"a",
"script",
"tag",
"for",
"a",
"specific",
"js",
"file",
"and",
"optionally",
"append",
"a",
"last",
"modified",
"timestamp",
"to",
"clear",
"the",
"browser",
"cache",
"."
] | 07b3646006d9bbf4f2d6fceeb319373392752b63 | https://github.com/frankfoerster/cakephp-asset/blob/07b3646006d9bbf4f2d6fceeb319373392752b63/src/View/Helper/AssetHelper.php#L69-L74 |
204,977 | frankfoerster/cakephp-asset | src/View/Helper/AssetHelper.php | AssetHelper.getUrl | public function getUrl($path, $plugin, $appendTime = true)
{
$pathParts = explode('/', $path);
$isAssetPath = ($pathParts[0] === 'ASSETS');
if ($isAssetPath) {
$absPath = $this->_getBaseAssetPath($plugin) . join('/', array_slice($pathParts, 1));
} else {
$abs... | php | public function getUrl($path, $plugin, $appendTime = true)
{
$pathParts = explode('/', $path);
$isAssetPath = ($pathParts[0] === 'ASSETS');
if ($isAssetPath) {
$absPath = $this->_getBaseAssetPath($plugin) . join('/', array_slice($pathParts, 1));
} else {
$abs... | [
"public",
"function",
"getUrl",
"(",
"$",
"path",
",",
"$",
"plugin",
",",
"$",
"appendTime",
"=",
"true",
")",
"{",
"$",
"pathParts",
"=",
"explode",
"(",
"'/'",
",",
"$",
"path",
")",
";",
"$",
"isAssetPath",
"=",
"(",
"$",
"pathParts",
"[",
"0",... | Get the asset url for a specific file.
@param string $path The path to the css file relative to the app or plugin webroot.
@param bool|string $plugin Either false or the name of a plugin.
@param bool $appendTime Whether to append a last modified timestamp to the url.
@return string | [
"Get",
"the",
"asset",
"url",
"for",
"a",
"specific",
"file",
"."
] | 07b3646006d9bbf4f2d6fceeb319373392752b63 | https://github.com/frankfoerster/cakephp-asset/blob/07b3646006d9bbf4f2d6fceeb319373392752b63/src/View/Helper/AssetHelper.php#L84-L113 |
204,978 | frankfoerster/cakephp-asset | src/View/Helper/AssetHelper.php | AssetHelper._getBasePath | protected function _getBasePath($plugin = false)
{
if ($plugin !== false) {
return $this->_getPluginPath($plugin) . 'webroot' . DS;
}
return WWW_ROOT;
} | php | protected function _getBasePath($plugin = false)
{
if ($plugin !== false) {
return $this->_getPluginPath($plugin) . 'webroot' . DS;
}
return WWW_ROOT;
} | [
"protected",
"function",
"_getBasePath",
"(",
"$",
"plugin",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"plugin",
"!==",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"_getPluginPath",
"(",
"$",
"plugin",
")",
".",
"'webroot'",
".",
"DS",
";",
"}",
"r... | Get the base path to the app webroot or a plugin webroot.
@param bool|string $plugin Either false or the name of a plugin.
@return string | [
"Get",
"the",
"base",
"path",
"to",
"the",
"app",
"webroot",
"or",
"a",
"plugin",
"webroot",
"."
] | 07b3646006d9bbf4f2d6fceeb319373392752b63 | https://github.com/frankfoerster/cakephp-asset/blob/07b3646006d9bbf4f2d6fceeb319373392752b63/src/View/Helper/AssetHelper.php#L136-L143 |
204,979 | frankfoerster/cakephp-asset | src/View/Helper/AssetHelper.php | AssetHelper._renderAttributes | protected function _renderAttributes(array $attributes = [])
{
$attributeStrings = [];
foreach ($attributes as $attribute => $value) {
$attributeStrings[] = $attribute . '="' . htmlentities($value) . '"';
}
if (empty($attributeStrings)) {
return '';
}... | php | protected function _renderAttributes(array $attributes = [])
{
$attributeStrings = [];
foreach ($attributes as $attribute => $value) {
$attributeStrings[] = $attribute . '="' . htmlentities($value) . '"';
}
if (empty($attributeStrings)) {
return '';
}... | [
"protected",
"function",
"_renderAttributes",
"(",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"attributeStrings",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"attribute",
"=>",
"$",
"value",
")",
"{",
"$",
"attributeS... | Render attribute key value pairs as html attributes.
@param array $attributes Key value pairs of html attributes.
@return string | [
"Render",
"attribute",
"key",
"value",
"pairs",
"as",
"html",
"attributes",
"."
] | 07b3646006d9bbf4f2d6fceeb319373392752b63 | https://github.com/frankfoerster/cakephp-asset/blob/07b3646006d9bbf4f2d6fceeb319373392752b63/src/View/Helper/AssetHelper.php#L182-L194 |
204,980 | Wonail/yii2-widget-nestable | Nestable.php | Nestable.renderWidget | public function renderWidget()
{
// BEGIN:nestable-box
echo Html::beginTag('div', ['class' => 'nestable-box']);
foreach ($this->items as $item) {
$this->renderGroup($item);
}
// END:nestable-box
echo Html::endTag('div');
if ($this->hasModel()) {
... | php | public function renderWidget()
{
// BEGIN:nestable-box
echo Html::beginTag('div', ['class' => 'nestable-box']);
foreach ($this->items as $item) {
$this->renderGroup($item);
}
// END:nestable-box
echo Html::endTag('div');
if ($this->hasModel()) {
... | [
"public",
"function",
"renderWidget",
"(",
")",
"{",
"// BEGIN:nestable-box",
"echo",
"Html",
"::",
"beginTag",
"(",
"'div'",
",",
"[",
"'class'",
"=>",
"'nestable-box'",
"]",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"item",
")",
... | Initializes and renders the widget | [
"Initializes",
"and",
"renders",
"the",
"widget"
] | b9e4ccaab15d616e0791cb49a7a96597f4dc3d60 | https://github.com/Wonail/yii2-widget-nestable/blob/b9e4ccaab15d616e0791cb49a7a96597f4dc3d60/Nestable.php#L107-L121 |
204,981 | luoxiaojun1992/lb_framework | controllers/console/SwooleController.php | SwooleController.http | public function http()
{
$this->writeln('Starting swoole http server...');
$server = new HttpServer(
$this->swooleConfig['http']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['http']['port'] ?? self::DEFAULT_SWOOLE_PORT
);
$server->on(
... | php | public function http()
{
$this->writeln('Starting swoole http server...');
$server = new HttpServer(
$this->swooleConfig['http']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['http']['port'] ?? self::DEFAULT_SWOOLE_PORT
);
$server->on(
... | [
"public",
"function",
"http",
"(",
")",
"{",
"$",
"this",
"->",
"writeln",
"(",
"'Starting swoole http server...'",
")",
";",
"$",
"server",
"=",
"new",
"HttpServer",
"(",
"$",
"this",
"->",
"swooleConfig",
"[",
"'http'",
"]",
"[",
"'host'",
"]",
"??",
"... | Swoole Http Server | [
"Swoole",
"Http",
"Server"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/controllers/console/SwooleController.php#L38-L66 |
204,982 | luoxiaojun1992/lb_framework | controllers/console/SwooleController.php | SwooleController.tcp | public function tcp()
{
$this->writeln('Starting swoole tcp server...');
$server = new TcpServer(
$this->swooleConfig['tcp']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['tcp']['port'] ?? self::DEFAULT_SWOOLE_PORT
);
//防止粘包
$server->set(... | php | public function tcp()
{
$this->writeln('Starting swoole tcp server...');
$server = new TcpServer(
$this->swooleConfig['tcp']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['tcp']['port'] ?? self::DEFAULT_SWOOLE_PORT
);
//防止粘包
$server->set(... | [
"public",
"function",
"tcp",
"(",
")",
"{",
"$",
"this",
"->",
"writeln",
"(",
"'Starting swoole tcp server...'",
")",
";",
"$",
"server",
"=",
"new",
"TcpServer",
"(",
"$",
"this",
"->",
"swooleConfig",
"[",
"'tcp'",
"]",
"[",
"'host'",
"]",
"??",
"self... | Swoole Tcp Server | [
"Swoole",
"Tcp",
"Server"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/controllers/console/SwooleController.php#L71-L121 |
204,983 | luoxiaojun1992/lb_framework | controllers/console/SwooleController.php | SwooleController.udp | public function udp()
{
$this->writeln('Starting swoole udp server...');
$udpServer = new TcpServer(
$this->swooleConfig['upd']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['upd']['port'] ?? self::DEFAULT_SWOOLE_PORT,
SWOOLE_PROCESS,
SWOO... | php | public function udp()
{
$this->writeln('Starting swoole udp server...');
$udpServer = new TcpServer(
$this->swooleConfig['upd']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['upd']['port'] ?? self::DEFAULT_SWOOLE_PORT,
SWOOLE_PROCESS,
SWOO... | [
"public",
"function",
"udp",
"(",
")",
"{",
"$",
"this",
"->",
"writeln",
"(",
"'Starting swoole udp server...'",
")",
";",
"$",
"udpServer",
"=",
"new",
"TcpServer",
"(",
"$",
"this",
"->",
"swooleConfig",
"[",
"'upd'",
"]",
"[",
"'host'",
"]",
"??",
"s... | Swoole UDP Server | [
"Swoole",
"UDP",
"Server"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/controllers/console/SwooleController.php#L126-L177 |
204,984 | luoxiaojun1992/lb_framework | controllers/console/SwooleController.php | SwooleController.websocket | public function websocket()
{
$this->writeln('Starting swoole websocket server...');
$ws = new WebsocketServer(
$this->swooleConfig['ws']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['ws']['port'] ?? self::DEFAULT_SWOOLE_PORT
);
$ws->on(
... | php | public function websocket()
{
$this->writeln('Starting swoole websocket server...');
$ws = new WebsocketServer(
$this->swooleConfig['ws']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['ws']['port'] ?? self::DEFAULT_SWOOLE_PORT
);
$ws->on(
... | [
"public",
"function",
"websocket",
"(",
")",
"{",
"$",
"this",
"->",
"writeln",
"(",
"'Starting swoole websocket server...'",
")",
";",
"$",
"ws",
"=",
"new",
"WebsocketServer",
"(",
"$",
"this",
"->",
"swooleConfig",
"[",
"'ws'",
"]",
"[",
"'host'",
"]",
... | Swoole Websocket Server | [
"Swoole",
"Websocket",
"Server"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/controllers/console/SwooleController.php#L182-L230 |
204,985 | luoxiaojun1992/lb_framework | controllers/console/SwooleController.php | SwooleController.mqtt | public function mqtt()
{
$this->writeln('Starting swoole mqtt server...');
$serv = new TcpServer(
$this->swooleConfig['tcp']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['tcp']['port'] ?? self::DEFAULT_SWOOLE_PORT,
SWOOLE_BASE
);
$ser... | php | public function mqtt()
{
$this->writeln('Starting swoole mqtt server...');
$serv = new TcpServer(
$this->swooleConfig['tcp']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['tcp']['port'] ?? self::DEFAULT_SWOOLE_PORT,
SWOOLE_BASE
);
$ser... | [
"public",
"function",
"mqtt",
"(",
")",
"{",
"$",
"this",
"->",
"writeln",
"(",
"'Starting swoole mqtt server...'",
")",
";",
"$",
"serv",
"=",
"new",
"TcpServer",
"(",
"$",
"this",
"->",
"swooleConfig",
"[",
"'tcp'",
"]",
"[",
"'host'",
"]",
"??",
"self... | Swoole Mqtt Server | [
"Swoole",
"Mqtt",
"Server"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/controllers/console/SwooleController.php#L235-L280 |
204,986 | luoxiaojun1992/lb_framework | controllers/console/SwooleController.php | SwooleController.udpClient | public function udpClient()
{
$this->writeln('Starting demo swoole udp client...');
$client = new TcpClient(SWOOLE_SOCK_UDP, SWOOLE_SOCK_ASYNC);
$client->on(
'connect', function ($cli) {
//发送数据中不能包含'\r\n\r\n'
$cli->send(JsonHelper::encode(['handl... | php | public function udpClient()
{
$this->writeln('Starting demo swoole udp client...');
$client = new TcpClient(SWOOLE_SOCK_UDP, SWOOLE_SOCK_ASYNC);
$client->on(
'connect', function ($cli) {
//发送数据中不能包含'\r\n\r\n'
$cli->send(JsonHelper::encode(['handl... | [
"public",
"function",
"udpClient",
"(",
")",
"{",
"$",
"this",
"->",
"writeln",
"(",
"'Starting demo swoole udp client...'",
")",
";",
"$",
"client",
"=",
"new",
"TcpClient",
"(",
"SWOOLE_SOCK_UDP",
",",
"SWOOLE_SOCK_ASYNC",
")",
";",
"$",
"client",
"->",
"on"... | Swoole UDP Client Demo | [
"Swoole",
"UDP",
"Client",
"Demo"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/controllers/console/SwooleController.php#L323-L356 |
204,987 | luoxiaojun1992/lb_framework | controllers/console/SwooleController.php | SwooleController.websocketClient | public function websocketClient()
{
$this->writeln('Starting demo websocket client...');
$client = new Client(
'ws://' .
($this->swooleConfig['ws']['host'] ?? self::DEFAULT_SWOOLE_HOST) . ':' .
($this->swooleConfig['ws']['port'] ?? self::DEFAULT_SWOOLE_PORT)
... | php | public function websocketClient()
{
$this->writeln('Starting demo websocket client...');
$client = new Client(
'ws://' .
($this->swooleConfig['ws']['host'] ?? self::DEFAULT_SWOOLE_HOST) . ':' .
($this->swooleConfig['ws']['port'] ?? self::DEFAULT_SWOOLE_PORT)
... | [
"public",
"function",
"websocketClient",
"(",
")",
"{",
"$",
"this",
"->",
"writeln",
"(",
"'Starting demo websocket client...'",
")",
";",
"$",
"client",
"=",
"new",
"Client",
"(",
"'ws://'",
".",
"(",
"$",
"this",
"->",
"swooleConfig",
"[",
"'ws'",
"]",
... | Websocket Client Demo | [
"Websocket",
"Client",
"Demo"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/controllers/console/SwooleController.php#L361-L373 |
204,988 | wartw98/core | Config/Source/API.php | API.map | final protected function map() {
/** @var array(string => string) $result */ /** @var bool $met */
$result = df_map_0([], $met = $this->isRequirementMet() ? null : $this->requirement());
if ($met) {
try {$result += $this->fetch();}
catch (\Exception $e) {$result = $this->exception($e);}
}
return $result... | php | final protected function map() {
/** @var array(string => string) $result */ /** @var bool $met */
$result = df_map_0([], $met = $this->isRequirementMet() ? null : $this->requirement());
if ($met) {
try {$result += $this->fetch();}
catch (\Exception $e) {$result = $this->exception($e);}
}
return $result... | [
"final",
"protected",
"function",
"map",
"(",
")",
"{",
"/** @var array(string => string) $result */",
"/** @var bool $met */",
"$",
"result",
"=",
"df_map_0",
"(",
"[",
"]",
",",
"$",
"met",
"=",
"$",
"this",
"->",
"isRequirementMet",
"(",
")",
"?",
"null",
"... | 2017-07-02
@override
@see \Df\Config\Source::map()
@used-by \Df\Config\Source::toOptionArray()
@return array(string => string) | [
"2017",
"-",
"07",
"-",
"02"
] | e1f44f6b4798a7b988f6a1cae639ff3745c9cd2a | https://github.com/wartw98/core/blob/e1f44f6b4798a7b988f6a1cae639ff3745c9cd2a/Config/Source/API.php#L56-L64 |
204,989 | xelax90/xelax-admin | src/XelaxAdmin/Router/ListRoute.php | ListRoute.getControllerOptions | public function getControllerOptions(){
if(empty($this->controllerOptions)){
$routePluginManager = $this->getServiceLocator();
if(empty($routePluginManager)){
throw new Exception\RuntimeException('ServiceLocator not set');
}
/* @var $sl ServiceLocatorInterface */
$sl = $routePluginManager->getSer... | php | public function getControllerOptions(){
if(empty($this->controllerOptions)){
$routePluginManager = $this->getServiceLocator();
if(empty($routePluginManager)){
throw new Exception\RuntimeException('ServiceLocator not set');
}
/* @var $sl ServiceLocatorInterface */
$sl = $routePluginManager->getSer... | [
"public",
"function",
"getControllerOptions",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"controllerOptions",
")",
")",
"{",
"$",
"routePluginManager",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"... | Fetches and returns the associated ListControllerOptions for this route
@return ListControllerOptions
@throws Exception\RuntimeException | [
"Fetches",
"and",
"returns",
"the",
"associated",
"ListControllerOptions",
"for",
"this",
"route"
] | eb8133384b74e18f6641689f290c6ba956641b6d | https://github.com/xelax90/xelax-admin/blob/eb8133384b74e18f6641689f290c6ba956641b6d/src/XelaxAdmin/Router/ListRoute.php#L424-L447 |
204,990 | matryoshka-model/matryoshka | library/Criteria/ExtractionTrait.php | ExtractionTrait.extractValue | protected function extractValue(ModelStubInterface $model, $name, $value, $extractName = true)
{
$modelHydrator = $model->getHydrator();
if (!$modelHydrator || !method_exists($modelHydrator, 'extractValue')) {
throw new Exception\RuntimeException(
'Model hydrator must be ... | php | protected function extractValue(ModelStubInterface $model, $name, $value, $extractName = true)
{
$modelHydrator = $model->getHydrator();
if (!$modelHydrator || !method_exists($modelHydrator, 'extractValue')) {
throw new Exception\RuntimeException(
'Model hydrator must be ... | [
"protected",
"function",
"extractValue",
"(",
"ModelStubInterface",
"$",
"model",
",",
"$",
"name",
",",
"$",
"value",
",",
"$",
"extractName",
"=",
"true",
")",
"{",
"$",
"modelHydrator",
"=",
"$",
"model",
"->",
"getHydrator",
"(",
")",
";",
"if",
"(",... | Extract a value in order to be used within datagateway context
If $extractName is false, $name must be in the datagateway context,
otherwise $name will be converted using extractName().
@param ModelStubInterface $model
@param string $name
@param string $value
@param bool $extractName
@throws Exception\RuntimeExceptio... | [
"Extract",
"a",
"value",
"in",
"order",
"to",
"be",
"used",
"within",
"datagateway",
"context"
] | 51792df00d9897f556d5a3c53193eed0974ff09d | https://github.com/matryoshka-model/matryoshka/blob/51792df00d9897f556d5a3c53193eed0974ff09d/library/Criteria/ExtractionTrait.php#L36-L51 |
204,991 | matryoshka-model/matryoshka | library/Criteria/ExtractionTrait.php | ExtractionTrait.extractName | protected function extractName(ModelStubInterface $model, $name)
{
if ($model->getObjectPrototype() instanceof HydratorAwareInterface) {
$objectHydrator = $model->getObjectPrototype()->getHydrator();
if (!$objectHydrator || !method_exists($objectHydrator, 'hydrateName'))... | php | protected function extractName(ModelStubInterface $model, $name)
{
if ($model->getObjectPrototype() instanceof HydratorAwareInterface) {
$objectHydrator = $model->getObjectPrototype()->getHydrator();
if (!$objectHydrator || !method_exists($objectHydrator, 'hydrateName'))... | [
"protected",
"function",
"extractName",
"(",
"ModelStubInterface",
"$",
"model",
",",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"model",
"->",
"getObjectPrototype",
"(",
")",
"instanceof",
"HydratorAwareInterface",
")",
"{",
"$",
"objectHydrator",
"=",
"$",
"mode... | Extract a name in order to be used within datagateway context
If an object's hydrator is avaliable, then $name will be converted to
a model name using the object's hydrator naming strategy.
Finally, $name will be extracted using the model's hydrator naming
strategy.
@param ModelStubInterface $model
@param string $nam... | [
"Extract",
"a",
"name",
"in",
"order",
"to",
"be",
"used",
"within",
"datagateway",
"context"
] | 51792df00d9897f556d5a3c53193eed0974ff09d | https://github.com/matryoshka-model/matryoshka/blob/51792df00d9897f556d5a3c53193eed0974ff09d/library/Criteria/ExtractionTrait.php#L66-L89 |
204,992 | UnionOfRAD/li3_quality | qa/rules/syntax/HasCorrectTabIndention.php | HasCorrectTabIndention._getSpaceAlignmentInArray | protected function _getSpaceAlignmentInArray($lineIndex, $testable) {
if (!$lineIndex) {
return;
}
$tokens = $testable->tokens();
$lines = $testable->lines();
$lineCache = $testable->lineCache();
$prevLine = $lines[$lineIndex - 1];
$previousTokens = $lineCache[$testable->findTokensByLine($lineIndex)]... | php | protected function _getSpaceAlignmentInArray($lineIndex, $testable) {
if (!$lineIndex) {
return;
}
$tokens = $testable->tokens();
$lines = $testable->lines();
$lineCache = $testable->lineCache();
$prevLine = $lines[$lineIndex - 1];
$previousTokens = $lineCache[$testable->findTokensByLine($lineIndex)]... | [
"protected",
"function",
"_getSpaceAlignmentInArray",
"(",
"$",
"lineIndex",
",",
"$",
"testable",
")",
"{",
"if",
"(",
"!",
"$",
"lineIndex",
")",
"{",
"return",
";",
"}",
"$",
"tokens",
"=",
"$",
"testable",
"->",
"tokens",
"(",
")",
";",
"$",
"lines... | Return the minimal space required for a multilined expression in an array definition.
@param int $lineIndex The index the current line is on
@param array $testable The testable object
@return int | [
"Return",
"the",
"minimal",
"space",
"required",
"for",
"a",
"multilined",
"expression",
"in",
"an",
"array",
"definition",
"."
] | acb72a43ae835e6d200bc0eba1a61aee610e36bf | https://github.com/UnionOfRAD/li3_quality/blob/acb72a43ae835e6d200bc0eba1a61aee610e36bf/qa/rules/syntax/HasCorrectTabIndention.php#L167-L194 |
204,993 | UnionOfRAD/li3_quality | qa/rules/syntax/HasCorrectTabIndention.php | HasCorrectTabIndention._getIndent | protected function _getIndent($line) {
$count = $space = $tab = 0;
$end = strlen($line);
while (($count < $end) && ($line[$count] === "\t")) {
$tab++;
$count++;
}
while (($count < $end) && ($line[$count] === ' ')) {
$space++;
$count++;
}
return array(
'space' => $space,
'tab' => $tab
)... | php | protected function _getIndent($line) {
$count = $space = $tab = 0;
$end = strlen($line);
while (($count < $end) && ($line[$count] === "\t")) {
$tab++;
$count++;
}
while (($count < $end) && ($line[$count] === ' ')) {
$space++;
$count++;
}
return array(
'space' => $space,
'tab' => $tab
)... | [
"protected",
"function",
"_getIndent",
"(",
"$",
"line",
")",
"{",
"$",
"count",
"=",
"$",
"space",
"=",
"$",
"tab",
"=",
"0",
";",
"$",
"end",
"=",
"strlen",
"(",
"$",
"line",
")",
";",
"while",
"(",
"(",
"$",
"count",
"<",
"$",
"end",
")",
... | Will determine how many tabs are at the beginning of a line.
@param string $line The current line is on
@return bool | [
"Will",
"determine",
"how",
"many",
"tabs",
"are",
"at",
"the",
"beginning",
"of",
"a",
"line",
"."
] | acb72a43ae835e6d200bc0eba1a61aee610e36bf | https://github.com/UnionOfRAD/li3_quality/blob/acb72a43ae835e6d200bc0eba1a61aee610e36bf/qa/rules/syntax/HasCorrectTabIndention.php#L202-L217 |
204,994 | ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.configure | public function configure($prefix, $resourceName, array $options)
{
$this->prefix = $prefix;
$this->resourceName = $resourceName;
$this->options = $this->getOptionsResolver()->resolve($options);
return $this;
} | php | public function configure($prefix, $resourceName, array $options)
{
$this->prefix = $prefix;
$this->resourceName = $resourceName;
$this->options = $this->getOptionsResolver()->resolve($options);
return $this;
} | [
"public",
"function",
"configure",
"(",
"$",
"prefix",
",",
"$",
"resourceName",
",",
"array",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"prefix",
"=",
"$",
"prefix",
";",
"$",
"this",
"->",
"resourceName",
"=",
"$",
"resourceName",
";",
"$",
"this"... | Configures the pool builder.
@param string $prefix
@param string $resourceName
@param array $options
@return PoolBuilder | [
"Configures",
"the",
"pool",
"builder",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L97-L104 |
204,995 | ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.createEntityClassParameter | private function createEntityClassParameter()
{
$id = $this->getServiceId('class');
if (!$this->container->hasParameter($id)) {
$this->container->setParameter($id, $this->options['entity']);
}
$this->configureInheritanceMapping(
$this->prefix.'.'.$this->resou... | php | private function createEntityClassParameter()
{
$id = $this->getServiceId('class');
if (!$this->container->hasParameter($id)) {
$this->container->setParameter($id, $this->options['entity']);
}
$this->configureInheritanceMapping(
$this->prefix.'.'.$this->resou... | [
"private",
"function",
"createEntityClassParameter",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getServiceId",
"(",
"'class'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"->",
"hasParameter",
"(",
"$",
"id",
")",
")",
"{",
"$",
... | Creates the entity class parameter. | [
"Creates",
"the",
"entity",
"class",
"parameter",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L248-L260 |
204,996 | ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.createConfigurationDefinition | private function createConfigurationDefinition()
{
$id = $this->getServiceId('configuration');
if (!$this->container->has($id)) {
$definition = new Definition(self::CONFIGURATION);
$definition
->setFactory([new Reference('ekyna_admin.pool_factory'), 'createCon... | php | private function createConfigurationDefinition()
{
$id = $this->getServiceId('configuration');
if (!$this->container->has($id)) {
$definition = new Definition(self::CONFIGURATION);
$definition
->setFactory([new Reference('ekyna_admin.pool_factory'), 'createCon... | [
"private",
"function",
"createConfigurationDefinition",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getServiceId",
"(",
"'configuration'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"$",... | Creates the Configuration service definition. | [
"Creates",
"the",
"Configuration",
"service",
"definition",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L265-L288 |
204,997 | ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.buildTemplateList | private function buildTemplateList($templatesConfig)
{
$templateNamespace = self::DEFAULT_TEMPLATES;
if (is_string($templatesConfig)) {
$templateNamespace = $templatesConfig;
}
$templatesList = [];
foreach (self::$templates as $name => $extensions) {
f... | php | private function buildTemplateList($templatesConfig)
{
$templateNamespace = self::DEFAULT_TEMPLATES;
if (is_string($templatesConfig)) {
$templateNamespace = $templatesConfig;
}
$templatesList = [];
foreach (self::$templates as $name => $extensions) {
f... | [
"private",
"function",
"buildTemplateList",
"(",
"$",
"templatesConfig",
")",
"{",
"$",
"templateNamespace",
"=",
"self",
"::",
"DEFAULT_TEMPLATES",
";",
"if",
"(",
"is_string",
"(",
"$",
"templatesConfig",
")",
")",
"{",
"$",
"templateNamespace",
"=",
"$",
"t... | Builds the templates list.
@param mixed $templatesConfig
@return array | [
"Builds",
"the",
"templates",
"list",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L296-L314 |
204,998 | ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.createManagerDefinition | private function createManagerDefinition()
{
$id = $this->getServiceId('manager');
if (!$this->container->has($id)) {
$this->container->setAlias($id, new Alias($this->getManagerServiceId()));
}
} | php | private function createManagerDefinition()
{
$id = $this->getServiceId('manager');
if (!$this->container->has($id)) {
$this->container->setAlias($id, new Alias($this->getManagerServiceId()));
}
} | [
"private",
"function",
"createManagerDefinition",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getServiceId",
"(",
"'manager'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
... | Creates the manager definition. | [
"Creates",
"the",
"manager",
"definition",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L337-L343 |
204,999 | ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.createRepositoryDefinition | private function createRepositoryDefinition()
{
$id = $this->getServiceId('repository');
if (!$this->container->has($id)) {
$definition = new Definition($class = $this->getServiceClass('repository'));
$definition->setArguments([
new Reference($this->getService... | php | private function createRepositoryDefinition()
{
$id = $this->getServiceId('repository');
if (!$this->container->has($id)) {
$definition = new Definition($class = $this->getServiceClass('repository'));
$definition->setArguments([
new Reference($this->getService... | [
"private",
"function",
"createRepositoryDefinition",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getServiceId",
"(",
"'repository'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"$",
"de... | Creates the Repository service definition. | [
"Creates",
"the",
"Repository",
"service",
"definition",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L348-L365 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.