repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
miknatr/grace-dbal | lib/Grace/DBAL/QueryLogger.php | QueryLogger.stopQuery | public function stopQuery()
{
$this->queries[$this->counter]['time'] = (time() + microtime(true) - $this->timer);
$this->counter++;
$this->timer = 0;
} | php | public function stopQuery()
{
$this->queries[$this->counter]['time'] = (time() + microtime(true) - $this->timer);
$this->counter++;
$this->timer = 0;
} | [
"public",
"function",
"stopQuery",
"(",
")",
"{",
"$",
"this",
"->",
"queries",
"[",
"$",
"this",
"->",
"counter",
"]",
"[",
"'time'",
"]",
"=",
"(",
"time",
"(",
")",
"+",
"microtime",
"(",
"true",
")",
"-",
"$",
"this",
"->",
"timer",
")",
";",... | Stops timer and logs query information | [
"Stops",
"timer",
"and",
"logs",
"query",
"information"
] | b05e03040568631dc6c77477c0eaed6e60db4ba2 | https://github.com/miknatr/grace-dbal/blob/b05e03040568631dc6c77477c0eaed6e60db4ba2/lib/Grace/DBAL/QueryLogger.php#L36-L41 | train |
miknatr/grace-dbal | lib/Grace/DBAL/QueryLogger.php | QueryLogger.startConnection | public function startConnection($queryString)
{
$this->connections[$this->counterConnections] = array('query' => $queryString);
$this->timer = time() + microtime(true);
} | php | public function startConnection($queryString)
{
$this->connections[$this->counterConnections] = array('query' => $queryString);
$this->timer = time() + microtime(true);
} | [
"public",
"function",
"startConnection",
"(",
"$",
"queryString",
")",
"{",
"$",
"this",
"->",
"connections",
"[",
"$",
"this",
"->",
"counterConnections",
"]",
"=",
"array",
"(",
"'query'",
"=>",
"$",
"queryString",
")",
";",
"$",
"this",
"->",
"timer",
... | Start timer for connection
@param string $queryString sql query string | [
"Start",
"timer",
"for",
"connection"
] | b05e03040568631dc6c77477c0eaed6e60db4ba2 | https://github.com/miknatr/grace-dbal/blob/b05e03040568631dc6c77477c0eaed6e60db4ba2/lib/Grace/DBAL/QueryLogger.php#L59-L63 | train |
miknatr/grace-dbal | lib/Grace/DBAL/QueryLogger.php | QueryLogger.stopConnection | public function stopConnection()
{
$this->connections[$this->counterConnections]['time'] = (time() + microtime(true) - $this->timer);
$this->counterConnections++;
$this->timer = 0;
} | php | public function stopConnection()
{
$this->connections[$this->counterConnections]['time'] = (time() + microtime(true) - $this->timer);
$this->counterConnections++;
$this->timer = 0;
} | [
"public",
"function",
"stopConnection",
"(",
")",
"{",
"$",
"this",
"->",
"connections",
"[",
"$",
"this",
"->",
"counterConnections",
"]",
"[",
"'time'",
"]",
"=",
"(",
"time",
"(",
")",
"+",
"microtime",
"(",
"true",
")",
"-",
"$",
"this",
"->",
"t... | Stops timer and logs connection information | [
"Stops",
"timer",
"and",
"logs",
"connection",
"information"
] | b05e03040568631dc6c77477c0eaed6e60db4ba2 | https://github.com/miknatr/grace-dbal/blob/b05e03040568631dc6c77477c0eaed6e60db4ba2/lib/Grace/DBAL/QueryLogger.php#L67-L72 | train |
miknatr/grace-dbal | lib/Grace/DBAL/QueryLogger.php | QueryLogger.reset | public function reset()
{
$this->timer = 0;
$this->counter = 0;
$this->counterConnections = 0;
$this->queries = array();
$this->connections = array();
} | php | public function reset()
{
$this->timer = 0;
$this->counter = 0;
$this->counterConnections = 0;
$this->queries = array();
$this->connections = array();
} | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"timer",
"=",
"0",
";",
"$",
"this",
"->",
"counter",
"=",
"0",
";",
"$",
"this",
"->",
"counterConnections",
"=",
"0",
";",
"$",
"this",
"->",
"queries",
"=",
"array",
"(",
")",
";... | Clear all logged data | [
"Clear",
"all",
"logged",
"data"
] | b05e03040568631dc6c77477c0eaed6e60db4ba2 | https://github.com/miknatr/grace-dbal/blob/b05e03040568631dc6c77477c0eaed6e60db4ba2/lib/Grace/DBAL/QueryLogger.php#L84-L91 | train |
stevenliebregt/crispysystem | src/View/SmartyView.php | SmartyView.with | public function with(array $data) : SmartyView
{
foreach ($data as $k => $v) {
$this->smarty->assign($k, $v);
}
return $this;
} | php | public function with(array $data) : SmartyView
{
foreach ($data as $k => $v) {
$this->smarty->assign($k, $v);
}
return $this;
} | [
"public",
"function",
"with",
"(",
"array",
"$",
"data",
")",
":",
"SmartyView",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"smarty",
"->",
"assign",
"(",
"$",
"k",
",",
"$",
"v",
")",
";",
... | Assigns data to Smarty
@param array $data
@return SmartyView
@since 1.0.0 | [
"Assigns",
"data",
"to",
"Smarty"
] | 06547dae100dae1023a93ec903f2d2abacce9aec | https://github.com/stevenliebregt/crispysystem/blob/06547dae100dae1023a93ec903f2d2abacce9aec/src/View/SmartyView.php#L109-L116 | train |
nicodevs/laito | src/Laito/Session/Session.php | Session.login | public function login($username, $password, $data)
{
// Verify the password against the stored hash
if (!password_verify($password, $this->getStoredPassword($username))) {
throw new \Exception('Incorrect username or password', 401);
}
// Create token
return $this... | php | public function login($username, $password, $data)
{
// Verify the password against the stored hash
if (!password_verify($password, $this->getStoredPassword($username))) {
throw new \Exception('Incorrect username or password', 401);
}
// Create token
return $this... | [
"public",
"function",
"login",
"(",
"$",
"username",
",",
"$",
"password",
",",
"$",
"data",
")",
"{",
"// Verify the password against the stored hash",
"if",
"(",
"!",
"password_verify",
"(",
"$",
"password",
",",
"$",
"this",
"->",
"getStoredPassword",
"(",
... | Attempts to start a session
@param string $username Username to login
@param string $password Password
@param array $data Data to store in the session
@return array|bool Session data or false | [
"Attempts",
"to",
"start",
"a",
"session"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Session/Session.php#L31-L40 | train |
nicodevs/laito | src/Laito/Session/Session.php | Session.getField | public function getField($field, $token = null)
{
$session = $this->app->tokens->get($token);
return ($session && isset($session[$field]))? $session[$field] : null;
} | php | public function getField($field, $token = null)
{
$session = $this->app->tokens->get($token);
return ($session && isset($session[$field]))? $session[$field] : null;
} | [
"public",
"function",
"getField",
"(",
"$",
"field",
",",
"$",
"token",
"=",
"null",
")",
"{",
"$",
"session",
"=",
"$",
"this",
"->",
"app",
"->",
"tokens",
"->",
"get",
"(",
"$",
"token",
")",
";",
"return",
"(",
"$",
"session",
"&&",
"isset",
... | Gets a session field
@param string $field Field name
@param string $token Token hash
@return array|bool Session data or false | [
"Gets",
"a",
"session",
"field"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Session/Session.php#L71-L75 | train |
nicodevs/laito | src/Laito/Session/Session.php | Session.update | public function update($token = null, $data = [])
{
return $this->app->tokens->update($token, $data);
} | php | public function update($token = null, $data = [])
{
return $this->app->tokens->update($token, $data);
} | [
"public",
"function",
"update",
"(",
"$",
"token",
"=",
"null",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"app",
"->",
"tokens",
"->",
"update",
"(",
"$",
"token",
",",
"$",
"data",
")",
";",
"}"
] | Updates a session
@param string $token Token hash
@param array $data Data to store
@return array|bool Session data or false | [
"Updates",
"a",
"session"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Session/Session.php#L84-L87 | train |
nicodevs/laito | src/Laito/Session/Session.php | Session.getStoredPassword | private function getStoredPassword($username)
{
// Get table object
$db = $this->app->db->reset()->table($this->table);
// Find user by username column
$user = $db->select($this->passwordColumn)->limit(1)->where($this->usernameColumn, $username)->getOne();
// Abort if the u... | php | private function getStoredPassword($username)
{
// Get table object
$db = $this->app->db->reset()->table($this->table);
// Find user by username column
$user = $db->select($this->passwordColumn)->limit(1)->where($this->usernameColumn, $username)->getOne();
// Abort if the u... | [
"private",
"function",
"getStoredPassword",
"(",
"$",
"username",
")",
"{",
"// Get table object",
"$",
"db",
"=",
"$",
"this",
"->",
"app",
"->",
"db",
"->",
"reset",
"(",
")",
"->",
"table",
"(",
"$",
"this",
"->",
"table",
")",
";",
"// Find user by u... | Gets an stored password for a user
@param string $username Username
@return mixed User password, of false if the user does not exist | [
"Gets",
"an",
"stored",
"password",
"for",
"a",
"user"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Session/Session.php#L106-L121 | train |
rafrsr/generic-api | src/ApiRequestBuilder.php | ApiRequestBuilder.withJsonBody | public function withJsonBody($data, SerializationContext $context = null)
{
if (is_string($data)) {
$json = $data;
} else {
$json = SerializerBuilder::create()->build()->serialize($data, 'json', $context);
}
$this->withBody($json);
return $this;
} | php | public function withJsonBody($data, SerializationContext $context = null)
{
if (is_string($data)) {
$json = $data;
} else {
$json = SerializerBuilder::create()->build()->serialize($data, 'json', $context);
}
$this->withBody($json);
return $this;
} | [
"public",
"function",
"withJsonBody",
"(",
"$",
"data",
",",
"SerializationContext",
"$",
"context",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"data",
")",
")",
"{",
"$",
"json",
"=",
"$",
"data",
";",
"}",
"else",
"{",
"$",
"json",
... | Create json with given data using serialization
@param $data
@param SerializationContext|null $context
@return $this | [
"Create",
"json",
"with",
"given",
"data",
"using",
"serialization"
] | 2572d3dcc32e03914cf710f0229d72e1c09ea65b | https://github.com/rafrsr/generic-api/blob/2572d3dcc32e03914cf710f0229d72e1c09ea65b/src/ApiRequestBuilder.php#L282-L292 | train |
rafrsr/generic-api | src/ApiRequestBuilder.php | ApiRequestBuilder.withXMLBody | public function withXMLBody($data, SerializationContext $context = null)
{
if (is_string($data)) {
$xml = $data;
} else {
$xml = SerializerBuilder::create()->build()->serialize($data, 'xml', $context);
}
$this->addHeader('Content-Type', 'text/xml; charset=utf-... | php | public function withXMLBody($data, SerializationContext $context = null)
{
if (is_string($data)) {
$xml = $data;
} else {
$xml = SerializerBuilder::create()->build()->serialize($data, 'xml', $context);
}
$this->addHeader('Content-Type', 'text/xml; charset=utf-... | [
"public",
"function",
"withXMLBody",
"(",
"$",
"data",
",",
"SerializationContext",
"$",
"context",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"data",
")",
")",
"{",
"$",
"xml",
"=",
"$",
"data",
";",
"}",
"else",
"{",
"$",
"xml",
"="... | Create xml with given data using serialization
@param $data
@param SerializationContext|null $context
@return $this | [
"Create",
"xml",
"with",
"given",
"data",
"using",
"serialization"
] | 2572d3dcc32e03914cf710f0229d72e1c09ea65b | https://github.com/rafrsr/generic-api/blob/2572d3dcc32e03914cf710f0229d72e1c09ea65b/src/ApiRequestBuilder.php#L302-L313 | train |
RedCirclePL/ConsoleProcessManagerBundle | EventListener/CommandListener.php | CommandListener.onConsoleCommand | public function onConsoleCommand(ConsoleCommandEvent $event)
{
if (!$this->processRepository->createSchemaIfNotExists()) {
throw new Exception('Cannot create schema for ConsoleProcessManagerBundle');
}
$argv = $_SERVER['argv'];
unset($argv[0]);
$command = implode... | php | public function onConsoleCommand(ConsoleCommandEvent $event)
{
if (!$this->processRepository->createSchemaIfNotExists()) {
throw new Exception('Cannot create schema for ConsoleProcessManagerBundle');
}
$argv = $_SERVER['argv'];
unset($argv[0]);
$command = implode... | [
"public",
"function",
"onConsoleCommand",
"(",
"ConsoleCommandEvent",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"processRepository",
"->",
"createSchemaIfNotExists",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Cannot create schema for ... | Run on console command start
@param ConsoleCommandEvent $event
@throws Exception | [
"Run",
"on",
"console",
"command",
"start"
] | 76b17924d3b7faf81f81f5fdaa96555200dee66b | https://github.com/RedCirclePL/ConsoleProcessManagerBundle/blob/76b17924d3b7faf81f81f5fdaa96555200dee66b/EventListener/CommandListener.php#L46-L71 | train |
RedCirclePL/ConsoleProcessManagerBundle | EventListener/CommandListener.php | CommandListener.onConsoleException | public function onConsoleException(ConsoleExceptionEvent $event)
{
$call = $this->callRepository->find($_REQUEST['call_id']);
$call->setStatus(Call::STATUS_FAILED)
->setOutput($event->getException());
$this->callRepository->update($call);
$this->registerError($call);
... | php | public function onConsoleException(ConsoleExceptionEvent $event)
{
$call = $this->callRepository->find($_REQUEST['call_id']);
$call->setStatus(Call::STATUS_FAILED)
->setOutput($event->getException());
$this->callRepository->update($call);
$this->registerError($call);
... | [
"public",
"function",
"onConsoleException",
"(",
"ConsoleExceptionEvent",
"$",
"event",
")",
"{",
"$",
"call",
"=",
"$",
"this",
"->",
"callRepository",
"->",
"find",
"(",
"$",
"_REQUEST",
"[",
"'call_id'",
"]",
")",
";",
"$",
"call",
"->",
"setStatus",
"(... | Run on console command exception
@param ConsoleExceptionEvent $event | [
"Run",
"on",
"console",
"command",
"exception"
] | 76b17924d3b7faf81f81f5fdaa96555200dee66b | https://github.com/RedCirclePL/ConsoleProcessManagerBundle/blob/76b17924d3b7faf81f81f5fdaa96555200dee66b/EventListener/CommandListener.php#L78-L88 | train |
RedCirclePL/ConsoleProcessManagerBundle | EventListener/CommandListener.php | CommandListener.onConsoleTerminate | public function onConsoleTerminate(ConsoleTerminateEvent $event)
{
$call = $this->callRepository->find($_REQUEST['call_id']);
if (!$call->getStatus()) {
$call->setStatus(Call::STATUS_SUCCESS);
}
if ($event->getExitCode()) {
$call->setStatus(Call::STATUS_ABOR... | php | public function onConsoleTerminate(ConsoleTerminateEvent $event)
{
$call = $this->callRepository->find($_REQUEST['call_id']);
if (!$call->getStatus()) {
$call->setStatus(Call::STATUS_SUCCESS);
}
if ($event->getExitCode()) {
$call->setStatus(Call::STATUS_ABOR... | [
"public",
"function",
"onConsoleTerminate",
"(",
"ConsoleTerminateEvent",
"$",
"event",
")",
"{",
"$",
"call",
"=",
"$",
"this",
"->",
"callRepository",
"->",
"find",
"(",
"$",
"_REQUEST",
"[",
"'call_id'",
"]",
")",
";",
"if",
"(",
"!",
"$",
"call",
"->... | Run on console command ends
@param ConsoleTerminateEvent $event | [
"Run",
"on",
"console",
"command",
"ends"
] | 76b17924d3b7faf81f81f5fdaa96555200dee66b | https://github.com/RedCirclePL/ConsoleProcessManagerBundle/blob/76b17924d3b7faf81f81f5fdaa96555200dee66b/EventListener/CommandListener.php#L95-L116 | train |
mtils/cmsable | src/Cmsable/Resource/ResourceBus.php | ResourceBus.getEventBus | public function getEventBus()
{
if ($this->eventBus) {
return $this->eventBus;
}
if (isset(static::$staticEventBus) && static::$staticEventBus) {
return static::$staticEventBus;
}
if (!$this->eventBus) {
$this->eventBus = Bus::instance();... | php | public function getEventBus()
{
if ($this->eventBus) {
return $this->eventBus;
}
if (isset(static::$staticEventBus) && static::$staticEventBus) {
return static::$staticEventBus;
}
if (!$this->eventBus) {
$this->eventBus = Bus::instance();... | [
"public",
"function",
"getEventBus",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"eventBus",
")",
"{",
"return",
"$",
"this",
"->",
"eventBus",
";",
"}",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"staticEventBus",
")",
"&&",
"static",
"::",
"$",... | Return the single instance of resource bus
@return BusContract | [
"Return",
"the",
"single",
"instance",
"of",
"resource",
"bus"
] | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Resource/ResourceBus.php#L28-L42 | train |
Arcesilas/dot-array | src/DotArray.php | DotArray.get | public function get(string $key, $default = null)
{
if (array_key_exists($key, $this->input)) {
return $this->input[$key];
} elseif (array_key_exists($key, $this->cache)) {
return $this->cache[$key];
}
// No dot, then not nested keys. We already tried that ke... | php | public function get(string $key, $default = null)
{
if (array_key_exists($key, $this->input)) {
return $this->input[$key];
} elseif (array_key_exists($key, $this->cache)) {
return $this->cache[$key];
}
// No dot, then not nested keys. We already tried that ke... | [
"public",
"function",
"get",
"(",
"string",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"input",
")",
")",
"{",
"return",
"$",
"this",
"->",
"input",
"[",
"$",
"k... | Returns an item using dot notation
@method get
@param string $key
@param mixed $default
@return mixed | [
"Returns",
"an",
"item",
"using",
"dot",
"notation"
] | 89839a56c71cb472a8df7d7d1d3b90d68bf31f97 | https://github.com/Arcesilas/dot-array/blob/89839a56c71cb472a8df7d7d1d3b90d68bf31f97/src/DotArray.php#L80-L99 | train |
Arcesilas/dot-array | src/DotArray.php | DotArray.has | public function has(string $key)
{
if (array_key_exists($key, $this->input)) {
return true;
}
try {
$this->find($this->input, $key);
return true;
} catch (\Exception $e) {
return false;
}
} | php | public function has(string $key)
{
if (array_key_exists($key, $this->input)) {
return true;
}
try {
$this->find($this->input, $key);
return true;
} catch (\Exception $e) {
return false;
}
} | [
"public",
"function",
"has",
"(",
"string",
"$",
"key",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"input",
")",
")",
"{",
"return",
"true",
";",
"}",
"try",
"{",
"$",
"this",
"->",
"find",
"(",
"$",
"this",... | Checks whether the dotted key exists
@method has
@param string $key
@return boolean | [
"Checks",
"whether",
"the",
"dotted",
"key",
"exists"
] | 89839a56c71cb472a8df7d7d1d3b90d68bf31f97 | https://github.com/Arcesilas/dot-array/blob/89839a56c71cb472a8df7d7d1d3b90d68bf31f97/src/DotArray.php#L107-L119 | train |
Arcesilas/dot-array | src/DotArray.php | DotArray.find | protected function find(array $array, string $key)
{
$item = $array;
foreach (explode('.', $key) as $segment) {
if (is_array($item) && array_key_exists($segment, $item)) {
$item = $item[$segment];
} else {
throw new \Exception();
}... | php | protected function find(array $array, string $key)
{
$item = $array;
foreach (explode('.', $key) as $segment) {
if (is_array($item) && array_key_exists($segment, $item)) {
$item = $item[$segment];
} else {
throw new \Exception();
}... | [
"protected",
"function",
"find",
"(",
"array",
"$",
"array",
",",
"string",
"$",
"key",
")",
"{",
"$",
"item",
"=",
"$",
"array",
";",
"foreach",
"(",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
"as",
"$",
"segment",
")",
"{",
"if",
"(",
"is_arr... | Find a value with its dotted key in an array
@param array $array
@param string $key
@return mixed
@throws \Exception if the key is not found | [
"Find",
"a",
"value",
"with",
"its",
"dotted",
"key",
"in",
"an",
"array"
] | 89839a56c71cb472a8df7d7d1d3b90d68bf31f97 | https://github.com/Arcesilas/dot-array/blob/89839a56c71cb472a8df7d7d1d3b90d68bf31f97/src/DotArray.php#L128-L143 | train |
Arcesilas/dot-array | src/DotArray.php | DotArray.set | public function set(string $key, $value)
{
$array = &$this->input;
$keys = explode('.', $key);
while (count($keys) > 1) {
$k = array_shift($keys);
if (!isset($array[$k]) || ! is_array($array[$k])) {
$array[$k] = [];
}
$array = ... | php | public function set(string $key, $value)
{
$array = &$this->input;
$keys = explode('.', $key);
while (count($keys) > 1) {
$k = array_shift($keys);
if (!isset($array[$k]) || ! is_array($array[$k])) {
$array[$k] = [];
}
$array = ... | [
"public",
"function",
"set",
"(",
"string",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"array",
"=",
"&",
"$",
"this",
"->",
"input",
";",
"$",
"keys",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"while",
"(",
"count",
"(",
"$",
... | Sets a value using dot notation
@param string $key
@param mixed $value | [
"Sets",
"a",
"value",
"using",
"dot",
"notation"
] | 89839a56c71cb472a8df7d7d1d3b90d68bf31f97 | https://github.com/Arcesilas/dot-array/blob/89839a56c71cb472a8df7d7d1d3b90d68bf31f97/src/DotArray.php#L150-L165 | train |
Arcesilas/dot-array | src/DotArray.php | DotArray.unset | public function unset(string $key)
{
if (array_key_exists($key, $this->input)) {
unset($this->input[$key]);
unset($this->cache[$key]);
}
$item = &$this->input;
foreach (explode('.', $key) as $segment) {
if (! isset($item[$segment])) {
... | php | public function unset(string $key)
{
if (array_key_exists($key, $this->input)) {
unset($this->input[$key]);
unset($this->cache[$key]);
}
$item = &$this->input;
foreach (explode('.', $key) as $segment) {
if (! isset($item[$segment])) {
... | [
"public",
"function",
"unset",
"(",
"string",
"$",
"key",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"input",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"input",
"[",
"$",
"key",
"]",
")",
";",
"unset",... | Unsets a dotted key
@param string $key | [
"Unsets",
"a",
"dotted",
"key"
] | 89839a56c71cb472a8df7d7d1d3b90d68bf31f97 | https://github.com/Arcesilas/dot-array/blob/89839a56c71cb472a8df7d7d1d3b90d68bf31f97/src/DotArray.php#L171-L192 | train |
Arcesilas/dot-array | src/DotArray.php | DotArray.import | public function import($input)
{
if (false !== ($array = $this->getImportableArray($input))) {
$this->input = array_replace_recursive($this->input, $array);
$this->cache = [];
}
} | php | public function import($input)
{
if (false !== ($array = $this->getImportableArray($input))) {
$this->input = array_replace_recursive($this->input, $array);
$this->cache = [];
}
} | [
"public",
"function",
"import",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"false",
"!==",
"(",
"$",
"array",
"=",
"$",
"this",
"->",
"getImportableArray",
"(",
"$",
"input",
")",
")",
")",
"{",
"$",
"this",
"->",
"input",
"=",
"array_replace_recursive",
... | Import an array, ArrayAccess
@method import
@param mixed $input | [
"Import",
"an",
"array",
"ArrayAccess"
] | 89839a56c71cb472a8df7d7d1d3b90d68bf31f97 | https://github.com/Arcesilas/dot-array/blob/89839a56c71cb472a8df7d7d1d3b90d68bf31f97/src/DotArray.php#L199-L205 | train |
ciims/ciims-modules-api | components/ApiController.php | ApiController.createAction | public function createAction($actionID)
{
if ($actionID==='')
$actionID=$this->defaultAction;
if (Yii::app()->request->getRequestType() != 'GET' && $actionID != 'error')
$actionID .= Yii::app()->request->getRequestType();
if (method_exists($this,'action'.$actionID) && strcasecmp($actionID,'s')) /... | php | public function createAction($actionID)
{
if ($actionID==='')
$actionID=$this->defaultAction;
if (Yii::app()->request->getRequestType() != 'GET' && $actionID != 'error')
$actionID .= Yii::app()->request->getRequestType();
if (method_exists($this,'action'.$actionID) && strcasecmp($actionID,'s')) /... | [
"public",
"function",
"createAction",
"(",
"$",
"actionID",
")",
"{",
"if",
"(",
"$",
"actionID",
"===",
"''",
")",
"$",
"actionID",
"=",
"$",
"this",
"->",
"defaultAction",
";",
"if",
"(",
"Yii",
"::",
"app",
"(",
")",
"->",
"request",
"->",
"getReq... | Method overload allows clearer separation of controller actions in relation to REQUEST_TYPE
GET actions will be routed to action$actionID
Other actions will be routed to action$actionIDREQUEST_TYPE
@param $actionID string The string name of the action that we want to run
@return CInlineAction
@see CController::create... | [
"Method",
"overload",
"allows",
"clearer",
"separation",
"of",
"controller",
"actions",
"in",
"relation",
"to",
"REQUEST_TYPE"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/components/ApiController.php#L115-L133 | train |
ciims/ciims-modules-api | components/ApiController.php | ApiController.beforeAction | public function beforeAction($action)
{
try {
@Yii::app()->newRelic->setTransactionName($this->id, $action->id);
} catch (Exception $e) {} // Ignore errors if NewRelic isn't installed/configured properly
// Force SSL for secure areas if enabled from the dashboard
if (!Yii::app()->getRequest()->isSec... | php | public function beforeAction($action)
{
try {
@Yii::app()->newRelic->setTransactionName($this->id, $action->id);
} catch (Exception $e) {} // Ignore errors if NewRelic isn't installed/configured properly
// Force SSL for secure areas if enabled from the dashboard
if (!Yii::app()->getRequest()->isSec... | [
"public",
"function",
"beforeAction",
"(",
"$",
"action",
")",
"{",
"try",
"{",
"@",
"Yii",
"::",
"app",
"(",
")",
"->",
"newRelic",
"->",
"setTransactionName",
"(",
"$",
"this",
"->",
"id",
",",
"$",
"action",
"->",
"id",
")",
";",
"}",
"catch",
"... | BeforeAction, validates that there is a valid response body
@param CAction $action The action we want to run | [
"BeforeAction",
"validates",
"that",
"there",
"is",
"a",
"valid",
"response",
"body"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/components/ApiController.php#L139-L167 | train |
ciims/ciims-modules-api | components/ApiController.php | ApiController.actionError | public function actionError()
{
$response = array();
$this->message = Yii::t('Api.Controller', 'An unexpected error occured.');
if ($error=Yii::app()->errorHandler->error)
{
$this->status = $error['code'];
$this->message = $error['message'];
if (YII_DEBUG)
$response = $error;
}
... | php | public function actionError()
{
$response = array();
$this->message = Yii::t('Api.Controller', 'An unexpected error occured.');
if ($error=Yii::app()->errorHandler->error)
{
$this->status = $error['code'];
$this->message = $error['message'];
if (YII_DEBUG)
$response = $error;
}
... | [
"public",
"function",
"actionError",
"(",
")",
"{",
"$",
"response",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"message",
"=",
"Yii",
"::",
"t",
"(",
"'Api.Controller'",
",",
"'An unexpected error occured.'",
")",
";",
"if",
"(",
"$",
"error",
"=",... | Default Error Handler. Yii automatically magics the response when renderOutput is called. This just updates the necessary components for us | [
"Default",
"Error",
"Handler",
".",
"Yii",
"automatically",
"magics",
"the",
"response",
"when",
"renderOutput",
"is",
"called",
".",
"This",
"just",
"updates",
"the",
"necessary",
"components",
"for",
"us"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/components/ApiController.php#L173-L187 | train |
ciims/ciims-modules-api | components/ApiController.php | ApiController.renderOutput | public function renderOutput($response = array(), $status=NULL, $message=NULL)
{
http_response_code( $status != NULL ? $status : $this->status );
header('Content-Type: application/json');
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: x-auth-token, x-auth-email");
heade... | php | public function renderOutput($response = array(), $status=NULL, $message=NULL)
{
http_response_code( $status != NULL ? $status : $this->status );
header('Content-Type: application/json');
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: x-auth-token, x-auth-email");
heade... | [
"public",
"function",
"renderOutput",
"(",
"$",
"response",
"=",
"array",
"(",
")",
",",
"$",
"status",
"=",
"NULL",
",",
"$",
"message",
"=",
"NULL",
")",
"{",
"http_response_code",
"(",
"$",
"status",
"!=",
"NULL",
"?",
"$",
"status",
":",
"$",
"th... | Outputs the data as JSON
@param boolean|null $response the response data | [
"Outputs",
"the",
"data",
"as",
"JSON"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/components/ApiController.php#L235-L253 | train |
ciims/ciims-modules-api | components/ApiController.php | ApiController.returnError | public function returnError($status, $message = NULL, $response)
{
header('HTTP/1.1 '. $status);
$this->status = $status;
if ($message === NULL)
$this->message = Yii::t('Api.main', 'Failed to set model attributes.');
else
$this->message = $message;
// This is a special condition in Yii. We ... | php | public function returnError($status, $message = NULL, $response)
{
header('HTTP/1.1 '. $status);
$this->status = $status;
if ($message === NULL)
$this->message = Yii::t('Api.main', 'Failed to set model attributes.');
else
$this->message = $message;
// This is a special condition in Yii. We ... | [
"public",
"function",
"returnError",
"(",
"$",
"status",
",",
"$",
"message",
"=",
"NULL",
",",
"$",
"response",
")",
"{",
"header",
"(",
"'HTTP/1.1 '",
".",
"$",
"status",
")",
";",
"$",
"this",
"->",
"status",
"=",
"$",
"status",
";",
"if",
"(",
... | Performs an error dump with the given status code
@param int $status The HTTP Status Code
@param string $message The error message
@param array $response The error response
@return array | [
"Performs",
"an",
"error",
"dump",
"with",
"the",
"given",
"status",
"code"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/components/ApiController.php#L262-L277 | train |
ciims/ciims-modules-api | components/ApiController.php | ApiController.getRole | protected function getRole($role)
{
if (!isset($this->user))
return false;
if (isset($this->user->role))
return $this->user->role->hasPermission($role);
return false;
} | php | protected function getRole($role)
{
if (!isset($this->user))
return false;
if (isset($this->user->role))
return $this->user->role->hasPermission($role);
return false;
} | [
"protected",
"function",
"getRole",
"(",
"$",
"role",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"user",
")",
")",
"return",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"user",
"->",
"role",
")",
")",
"return",
"$",
... | Helper function to get the user's role
@param integer $role the user's role'
@return boolean | [
"Helper",
"function",
"to",
"get",
"the",
"user",
"s",
"role"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/components/ApiController.php#L284-L293 | train |
stubbles/stubbles-reflect | src/main/php/annotation/Annotation.php | Annotation.getValueByName | public function getValueByName(string $name, $default = null)
{
if (isset($this->values[$name])) {
return $this->parseType($this->values[$name]);
}
return $default;
} | php | public function getValueByName(string $name, $default = null)
{
if (isset($this->values[$name])) {
return $this->parseType($this->values[$name]);
}
return $default;
} | [
"public",
"function",
"getValueByName",
"(",
"string",
"$",
"name",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"values",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"parseType",
"(... | returns a value by its name
Returns null if a value with given name does not exist or is not set.
@api
@param string $name
@param mixed $default optional value to return if value not set
@return mixed
@since 1.7.0 | [
"returns",
"a",
"value",
"by",
"its",
"name"
] | ab48f9b8692293ef0d276b52619625dbb8869c97 | https://github.com/stubbles/stubbles-reflect/blob/ab48f9b8692293ef0d276b52619625dbb8869c97/src/main/php/annotation/Annotation.php#L125-L132 | train |
stubbles/stubbles-reflect | src/main/php/annotation/Annotation.php | Annotation.parseType | private function parseType(string $value)
{
if ((substr($value, 0, 1) === '"' && substr($value, -1) === '"') || (substr($value, 0, 1) === "'" && substr($value, -1) === "'")) {
return substr($value, 1, strlen($value) - 2);
}
return Parse::toType($value);
} | php | private function parseType(string $value)
{
if ((substr($value, 0, 1) === '"' && substr($value, -1) === '"') || (substr($value, 0, 1) === "'" && substr($value, -1) === "'")) {
return substr($value, 1, strlen($value) - 2);
}
return Parse::toType($value);
} | [
"private",
"function",
"parseType",
"(",
"string",
"$",
"value",
")",
"{",
"if",
"(",
"(",
"substr",
"(",
"$",
"value",
",",
"0",
",",
"1",
")",
"===",
"'\"'",
"&&",
"substr",
"(",
"$",
"value",
",",
"-",
"1",
")",
"===",
"'\"'",
")",
"||",
"("... | parses value to correct type
@param string $value
@return mixed | [
"parses",
"value",
"to",
"correct",
"type"
] | ab48f9b8692293ef0d276b52619625dbb8869c97 | https://github.com/stubbles/stubbles-reflect/blob/ab48f9b8692293ef0d276b52619625dbb8869c97/src/main/php/annotation/Annotation.php#L231-L238 | train |
redkite-labs/ThemeEngineBundle | Core/Rendering/DependencyInjection/BaseExtension.php | BaseExtension.loadConfigurationRecursive | protected function loadConfigurationRecursive(ContainerBuilder $container, array $configuration)
{
foreach ($configuration as $values) {
$loader = new XmlFileLoader($container, new FileLocator($values['path']));
foreach ($values['configFiles'] as $configFile) {
$loade... | php | protected function loadConfigurationRecursive(ContainerBuilder $container, array $configuration)
{
foreach ($configuration as $values) {
$loader = new XmlFileLoader($container, new FileLocator($values['path']));
foreach ($values['configFiles'] as $configFile) {
$loade... | [
"protected",
"function",
"loadConfigurationRecursive",
"(",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"configuration",
")",
"{",
"foreach",
"(",
"$",
"configuration",
"as",
"$",
"values",
")",
"{",
"$",
"loader",
"=",
"new",
"XmlFileLoader",
"(",
... | Loads the them configuration recursively
@param \Symfony\Component\DependencyInjection\ContainerBuilder $container
@param array $configuration | [
"Loads",
"the",
"them",
"configuration",
"recursively"
] | 427409110f2d4f8f39d8802c17d5dd4115cbdf2b | https://github.com/redkite-labs/ThemeEngineBundle/blob/427409110f2d4f8f39d8802c17d5dd4115cbdf2b/Core/Rendering/DependencyInjection/BaseExtension.php#L67-L78 | train |
ekyna/PaymentBundle | DependencyInjection/Configuration.php | Configuration.addPoolsSection | private function addPoolsSection(ArrayNodeDefinition $node)
{
$node
->children()
->arrayNode('pools')
->addDefaultsIfNotSet()
->children()
->arrayNode('method')
->addDefaultsIfNotSet()
... | php | private function addPoolsSection(ArrayNodeDefinition $node)
{
$node
->children()
->arrayNode('pools')
->addDefaultsIfNotSet()
->children()
->arrayNode('method')
->addDefaultsIfNotSet()
... | [
"private",
"function",
"addPoolsSection",
"(",
"ArrayNodeDefinition",
"$",
"node",
")",
"{",
"$",
"node",
"->",
"children",
"(",
")",
"->",
"arrayNode",
"(",
"'pools'",
")",
"->",
"addDefaultsIfNotSet",
"(",
")",
"->",
"children",
"(",
")",
"->",
"arrayNode"... | Adds admin pool sections.
@param ArrayNodeDefinition $node | [
"Adds",
"admin",
"pool",
"sections",
"."
] | 1b4f4103b28e3a4f8dbfac2cbd872d728238f4d1 | https://github.com/ekyna/PaymentBundle/blob/1b4f4103b28e3a4f8dbfac2cbd872d728238f4d1/DependencyInjection/Configuration.php#L34-L63 | train |
byjg/authuser | src/UsersDBDataset.php | UsersDBDataset.getIterator | public function getIterator(IteratorFilter $filter = null)
{
if (is_null($filter)) {
$filter = new IteratorFilter();
}
$param = [];
$formatter = new IteratorFilterSqlFormatter();
$sql = $formatter->getFilter($filter->getRawFilters(), $param);
$query = Qu... | php | public function getIterator(IteratorFilter $filter = null)
{
if (is_null($filter)) {
$filter = new IteratorFilter();
}
$param = [];
$formatter = new IteratorFilterSqlFormatter();
$sql = $formatter->getFilter($filter->getRawFilters(), $param);
$query = Qu... | [
"public",
"function",
"getIterator",
"(",
"IteratorFilter",
"$",
"filter",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"filter",
")",
")",
"{",
"$",
"filter",
"=",
"new",
"IteratorFilter",
"(",
")",
";",
"}",
"$",
"param",
"=",
"[",
"]",
... | Get the users database information based on a filter.
@param IteratorFilter $filter Filter to find user
@return UserModel[]
@throws \ByJG\MicroOrm\Exception\InvalidArgumentException
@throws \ByJG\Serializer\Exception\InvalidArgumentException | [
"Get",
"the",
"users",
"database",
"information",
"based",
"on",
"a",
"filter",
"."
] | 2ca520e921e559257d14dd933c746a1df28eaf9f | https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersDBDataset.php#L134-L149 | train |
byjg/authuser | src/UsersDBDataset.php | UsersDBDataset.removeByLoginField | public function removeByLoginField($login)
{
$user = $this->getByLoginField($login);
if ($user !== null) {
return $this->removeUserById($user->getUserid());
}
return false;
} | php | public function removeByLoginField($login)
{
$user = $this->getByLoginField($login);
if ($user !== null) {
return $this->removeUserById($user->getUserid());
}
return false;
} | [
"public",
"function",
"removeByLoginField",
"(",
"$",
"login",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getByLoginField",
"(",
"$",
"login",
")",
";",
"if",
"(",
"$",
"user",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"removeUserById"... | Remove the user based on his user login.
@param string $login
@return bool
@throws \Exception | [
"Remove",
"the",
"user",
"based",
"on",
"his",
"user",
"login",
"."
] | 2ca520e921e559257d14dd933c746a1df28eaf9f | https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersDBDataset.php#L181-L190 | train |
byjg/authuser | src/UsersDBDataset.php | UsersDBDataset.removeUserById | public function removeUserById($userId)
{
$updtableProperties = Updatable::getInstance()
->table($this->getUserPropertiesDefinition()->table())
->where(
"{$this->getUserPropertiesDefinition()->getUserid()} = :id",
[
"id" => $userId
... | php | public function removeUserById($userId)
{
$updtableProperties = Updatable::getInstance()
->table($this->getUserPropertiesDefinition()->table())
->where(
"{$this->getUserPropertiesDefinition()->getUserid()} = :id",
[
"id" => $userId
... | [
"public",
"function",
"removeUserById",
"(",
"$",
"userId",
")",
"{",
"$",
"updtableProperties",
"=",
"Updatable",
"::",
"getInstance",
"(",
")",
"->",
"table",
"(",
"$",
"this",
"->",
"getUserPropertiesDefinition",
"(",
")",
"->",
"table",
"(",
")",
")",
... | Remove the user based on his user id.
@param mixed $userId
@return bool
@throws \Exception | [
"Remove",
"the",
"user",
"based",
"on",
"his",
"user",
"id",
"."
] | 2ca520e921e559257d14dd933c746a1df28eaf9f | https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersDBDataset.php#L199-L214 | train |
byjg/authuser | src/UsersDBDataset.php | UsersDBDataset.removeProperty | public function removeProperty($userId, $propertyName, $value = null)
{
$user = $this->getById($userId);
if ($user !== null) {
$updateable = Updatable::getInstance()
->table($this->getUserPropertiesDefinition()->table())
->where("{$this->getUserProperties... | php | public function removeProperty($userId, $propertyName, $value = null)
{
$user = $this->getById($userId);
if ($user !== null) {
$updateable = Updatable::getInstance()
->table($this->getUserPropertiesDefinition()->table())
->where("{$this->getUserProperties... | [
"public",
"function",
"removeProperty",
"(",
"$",
"userId",
",",
"$",
"propertyName",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getById",
"(",
"$",
"userId",
")",
";",
"if",
"(",
"$",
"user",
"!==",
"null",
")"... | Remove a specific site from user
Return True or false
@param int $userId User Id
@param string $propertyName Property name
@param string $value Property value with a site
@return bool
@throws \ByJG\MicroOrm\Exception\InvalidArgumentException
@throws \ByJG\Serializer\Exception\InvalidArgumentException | [
"Remove",
"a",
"specific",
"site",
"from",
"user",
"Return",
"True",
"or",
"false"
] | 2ca520e921e559257d14dd933c746a1df28eaf9f | https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersDBDataset.php#L254-L274 | train |
byjg/authuser | src/UsersDBDataset.php | UsersDBDataset.setPropertiesInUser | protected function setPropertiesInUser(UserModel $userRow)
{
$query = Query::getInstance()
->table($this->getUserPropertiesDefinition()->table())
->where("{$this->getUserPropertiesDefinition()->getUserid()} = :id", ['id' =>$userRow->getUserid()]);
$userRow->setProperties($thi... | php | protected function setPropertiesInUser(UserModel $userRow)
{
$query = Query::getInstance()
->table($this->getUserPropertiesDefinition()->table())
->where("{$this->getUserPropertiesDefinition()->getUserid()} = :id", ['id' =>$userRow->getUserid()]);
$userRow->setProperties($thi... | [
"protected",
"function",
"setPropertiesInUser",
"(",
"UserModel",
"$",
"userRow",
")",
"{",
"$",
"query",
"=",
"Query",
"::",
"getInstance",
"(",
")",
"->",
"table",
"(",
"$",
"this",
"->",
"getUserPropertiesDefinition",
"(",
")",
"->",
"table",
"(",
")",
... | Return all property's fields from this user
@param UserModel $userRow
@throws \ByJG\MicroOrm\Exception\InvalidArgumentException
@throws \ByJG\Serializer\Exception\InvalidArgumentException | [
"Return",
"all",
"property",
"s",
"fields",
"from",
"this",
"user"
] | 2ca520e921e559257d14dd933c746a1df28eaf9f | https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersDBDataset.php#L307-L313 | train |
ptlis/grep-db | src/Search/Search.php | Search.searchServer | public function searchServer(
Connection $connection,
string $searchTerm
): \Generator {
$serverMetadata = (new MetadataFactory())->getServerMetadata($connection);
foreach ($serverMetadata->getAllDatabaseMetadata() as $databaseMetadata) {
$resultList = $this->searchDatab... | php | public function searchServer(
Connection $connection,
string $searchTerm
): \Generator {
$serverMetadata = (new MetadataFactory())->getServerMetadata($connection);
foreach ($serverMetadata->getAllDatabaseMetadata() as $databaseMetadata) {
$resultList = $this->searchDatab... | [
"public",
"function",
"searchServer",
"(",
"Connection",
"$",
"connection",
",",
"string",
"$",
"searchTerm",
")",
":",
"\\",
"Generator",
"{",
"$",
"serverMetadata",
"=",
"(",
"new",
"MetadataFactory",
"(",
")",
")",
"->",
"getServerMetadata",
"(",
"$",
"co... | Performs a search across databases on a server.
@param Connection $connection
@param string $searchTerm
@return \Generator|RowSearchResult[] | [
"Performs",
"a",
"search",
"across",
"databases",
"on",
"a",
"server",
"."
] | 7abff68982d426690d0515ccd7adc7a2e3d72a3f | https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Search/Search.php#L28-L45 | train |
ptlis/grep-db | src/Search/Search.php | Search.searchDatabase | public function searchDatabase(
Connection $connection,
string $databaseName,
string $searchTerm
): \Generator {
$databaseMetadata = (new MetadataFactory())->getDatabaseMetadata($connection, $databaseName);
foreach ($databaseMetadata->getAllTableMetadata() as $tableMetadata)... | php | public function searchDatabase(
Connection $connection,
string $databaseName,
string $searchTerm
): \Generator {
$databaseMetadata = (new MetadataFactory())->getDatabaseMetadata($connection, $databaseName);
foreach ($databaseMetadata->getAllTableMetadata() as $tableMetadata)... | [
"public",
"function",
"searchDatabase",
"(",
"Connection",
"$",
"connection",
",",
"string",
"$",
"databaseName",
",",
"string",
"$",
"searchTerm",
")",
":",
"\\",
"Generator",
"{",
"$",
"databaseMetadata",
"=",
"(",
"new",
"MetadataFactory",
"(",
")",
")",
... | Performs a search across tables in a database.
@param Connection $connection
@param string $databaseName
@param string $searchTerm
@return \Generator|RowSearchResult[] | [
"Performs",
"a",
"search",
"across",
"tables",
"in",
"a",
"database",
"."
] | 7abff68982d426690d0515ccd7adc7a2e3d72a3f | https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Search/Search.php#L55-L74 | train |
ptlis/grep-db | src/Search/Search.php | Search.searchTable | public function searchTable(
Connection $connection,
string $databaseName,
string $tableName,
string $searchTerm
): \Generator {
$tableMetadata = (new MetadataFactory())->getTableMetadata($connection, $databaseName, $tableName);
if (!$tableMetadata->hasStringTypeColu... | php | public function searchTable(
Connection $connection,
string $databaseName,
string $tableName,
string $searchTerm
): \Generator {
$tableMetadata = (new MetadataFactory())->getTableMetadata($connection, $databaseName, $tableName);
if (!$tableMetadata->hasStringTypeColu... | [
"public",
"function",
"searchTable",
"(",
"Connection",
"$",
"connection",
",",
"string",
"$",
"databaseName",
",",
"string",
"$",
"tableName",
",",
"string",
"$",
"searchTerm",
")",
":",
"\\",
"Generator",
"{",
"$",
"tableMetadata",
"=",
"(",
"new",
"Metada... | Performs a search on the provided table.
@param Connection $connection
@param string $databaseName
@param string $tableName
@param string $searchTerm
@return \Generator|RowSearchResult[] | [
"Performs",
"a",
"search",
"on",
"the",
"provided",
"table",
"."
] | 7abff68982d426690d0515ccd7adc7a2e3d72a3f | https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Search/Search.php#L85-L107 | train |
zenodorus-tools/filesystem | src/Filesystem.php | Filesystem.slash | public static function slash(string ...$sections)
{
$count = count($sections);
// If we only got a single section, return it.
if (1 === $count) {
return $sections[0];
} // Somehow we got NO sections, so return null.
elseif (0 >= $count || empty($sections)) {
... | php | public static function slash(string ...$sections)
{
$count = count($sections);
// If we only got a single section, return it.
if (1 === $count) {
return $sections[0];
} // Somehow we got NO sections, so return null.
elseif (0 >= $count || empty($sections)) {
... | [
"public",
"static",
"function",
"slash",
"(",
"string",
"...",
"$",
"sections",
")",
"{",
"$",
"count",
"=",
"count",
"(",
"$",
"sections",
")",
";",
"// If we only got a single section, return it.",
"if",
"(",
"1",
"===",
"$",
"count",
")",
"{",
"return",
... | Combine strings with a directory separator.
Accepts any number of strings.
This is purely string manipulation: Although this function will likely
be used for paths, it does no path validation of any sort.
@param string[] ...$sections All strings you wish to concatenate.
@return string | [
"Combine",
"strings",
"with",
"a",
"directory",
"separator",
"."
] | 210d098fa9cc7f261d68402667763497cba1fba0 | https://github.com/zenodorus-tools/filesystem/blob/210d098fa9cc7f261d68402667763497cba1fba0/src/Filesystem.php#L16-L48 | train |
zenodorus-tools/filesystem | src/Filesystem.php | Filesystem.resolve | public static function resolve(string $path, bool $absolute = false)
{
$path = static::normalize($path);
if (strpos($path, DIRECTORY_SEPARATOR) === 0) {
// This was an absolute string, so keep it that way.
$absolute = true;
}
/** @noinspection SpellCheckingIns... | php | public static function resolve(string $path, bool $absolute = false)
{
$path = static::normalize($path);
if (strpos($path, DIRECTORY_SEPARATOR) === 0) {
// This was an absolute string, so keep it that way.
$absolute = true;
}
/** @noinspection SpellCheckingIns... | [
"public",
"static",
"function",
"resolve",
"(",
"string",
"$",
"path",
",",
"bool",
"$",
"absolute",
"=",
"false",
")",
"{",
"$",
"path",
"=",
"static",
"::",
"normalize",
"(",
"$",
"path",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"path",
",",
"DIR... | Naively resolve paths.
This attempts to discern the correct directory path from something that
contains relative indicators (i.e. `../`). It does not touch the actual
filesystem, so do not assume that these paths are accurate, or that they
even exist.
Notably, this means that you can use this to deal with symlinks
(S... | [
"Naively",
"resolve",
"paths",
"."
] | 210d098fa9cc7f261d68402667763497cba1fba0 | https://github.com/zenodorus-tools/filesystem/blob/210d098fa9cc7f261d68402667763497cba1fba0/src/Filesystem.php#L94-L121 | train |
zenodorus-tools/filesystem | src/Filesystem.php | Filesystem.resolveReal | public static function resolveReal(string $path, string $workingDir = null)
{
if (null === $workingDir
/**
* Path includes full (absolute) path, which doesn't need
* working directory.
*/
&& file_exists($real = Filesystem::resolve($path))) {
return ... | php | public static function resolveReal(string $path, string $workingDir = null)
{
if (null === $workingDir
/**
* Path includes full (absolute) path, which doesn't need
* working directory.
*/
&& file_exists($real = Filesystem::resolve($path))) {
return ... | [
"public",
"static",
"function",
"resolveReal",
"(",
"string",
"$",
"path",
",",
"string",
"$",
"workingDir",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"workingDir",
"/**\n * Path includes full (absolute) path, which doesn't need\n * working dir... | Resolve paths to real locations.
A wrapper for `Filesystem::resolve()` that returns real paths. It will
fully evaluate symbolic links, so they will return their targets.
If a directory/file does not exist, this method returns `null`.
In certain situations, this may return `null` for files that are,
technically acces... | [
"Resolve",
"paths",
"to",
"real",
"locations",
"."
] | 210d098fa9cc7f261d68402667763497cba1fba0 | https://github.com/zenodorus-tools/filesystem/blob/210d098fa9cc7f261d68402667763497cba1fba0/src/Filesystem.php#L142-L161 | train |
zenodorus-tools/filesystem | src/Filesystem.php | Filesystem.recursiveRemove | public static function recursiveRemove(string $dir, bool $complete = true)
{
$di = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS);
$ri = new \RecursiveIteratorIterator($di, \RecursiveIteratorIterator::CHILD_FIRST);
foreach ($ri as $file) {
$file->isDir() ? ... | php | public static function recursiveRemove(string $dir, bool $complete = true)
{
$di = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS);
$ri = new \RecursiveIteratorIterator($di, \RecursiveIteratorIterator::CHILD_FIRST);
foreach ($ri as $file) {
$file->isDir() ? ... | [
"public",
"static",
"function",
"recursiveRemove",
"(",
"string",
"$",
"dir",
",",
"bool",
"$",
"complete",
"=",
"true",
")",
"{",
"$",
"di",
"=",
"new",
"\\",
"RecursiveDirectoryIterator",
"(",
"$",
"dir",
",",
"\\",
"FilesystemIterator",
"::",
"SKIP_DOTS",... | Removes all files and directories in a directory. BE CAREFUL!
By default, this includes directory specified in `$dir`. Pass `false` to
the second argument to disable this behavior and leave `$dir` in place.
@see https://stackoverflow.com/a/24563703
@param string $dir
@param boolean $complete
@return boolean | [
"Removes",
"all",
"files",
"and",
"directories",
"in",
"a",
"directory",
".",
"BE",
"CAREFUL!"
] | 210d098fa9cc7f261d68402667763497cba1fba0 | https://github.com/zenodorus-tools/filesystem/blob/210d098fa9cc7f261d68402667763497cba1fba0/src/Filesystem.php#L175-L186 | train |
spyrit/PropelDatagridBundle | Datagrid/PropelDatagrid.php | PropelDatagrid.getPaginationPath | public function getPaginationPath($route, $page, $extraParams = array())
{
$params = array(
$this->getActionParameterName() => $this->getPageActionParameterName(),
$this->getDatagridParameterName() => $this->getName(),
$this->getPageParameterName() => $page,
);
... | php | public function getPaginationPath($route, $page, $extraParams = array())
{
$params = array(
$this->getActionParameterName() => $this->getPageActionParameterName(),
$this->getDatagridParameterName() => $this->getName(),
$this->getPageParameterName() => $page,
);
... | [
"public",
"function",
"getPaginationPath",
"(",
"$",
"route",
",",
"$",
"page",
",",
"$",
"extraParams",
"=",
"array",
"(",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"$",
"this",
"->",
"getActionParameterName",
"(",
")",
"=>",
"$",
"this",
"->",... | Generate pagination route
@param type $route
@param type $extraParams
@return type | [
"Generate",
"pagination",
"route"
] | 2c12ad90e8e6f44dc106a4512225c1ec68871076 | https://github.com/spyrit/PropelDatagridBundle/blob/2c12ad90e8e6f44dc106a4512225c1ec68871076/Datagrid/PropelDatagrid.php#L462-L470 | train |
spyrit/PropelDatagridBundle | Datagrid/PropelDatagrid.php | PropelDatagrid.getResetPath | public function getResetPath($route, $extraParams = array())
{
$params = array(
$this->getActionParameterName() => $this->getResetActionParameterName(),
$this->getDatagridParameterName() => $this->getName(),
);
return $this->container->get('router')->generate($route, ... | php | public function getResetPath($route, $extraParams = array())
{
$params = array(
$this->getActionParameterName() => $this->getResetActionParameterName(),
$this->getDatagridParameterName() => $this->getName(),
);
return $this->container->get('router')->generate($route, ... | [
"public",
"function",
"getResetPath",
"(",
"$",
"route",
",",
"$",
"extraParams",
"=",
"array",
"(",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"$",
"this",
"->",
"getActionParameterName",
"(",
")",
"=>",
"$",
"this",
"->",
"getResetActionParameterNa... | Generate reset route for the button view
@param type $route
@param type $extraParams
@return type | [
"Generate",
"reset",
"route",
"for",
"the",
"button",
"view"
] | 2c12ad90e8e6f44dc106a4512225c1ec68871076 | https://github.com/spyrit/PropelDatagridBundle/blob/2c12ad90e8e6f44dc106a4512225c1ec68871076/Datagrid/PropelDatagrid.php#L478-L485 | train |
spyrit/PropelDatagridBundle | Datagrid/PropelDatagrid.php | PropelDatagrid.getSortPath | public function getSortPath($route, $column, $order, $extraParams = array())
{
$params = array(
$this->getActionParameterName() => $this->getSortActionParameterName(),
$this->getDatagridParameterName() => $this->getName(),
$this->getSortColumnParameterName() => $column,
... | php | public function getSortPath($route, $column, $order, $extraParams = array())
{
$params = array(
$this->getActionParameterName() => $this->getSortActionParameterName(),
$this->getDatagridParameterName() => $this->getName(),
$this->getSortColumnParameterName() => $column,
... | [
"public",
"function",
"getSortPath",
"(",
"$",
"route",
",",
"$",
"column",
",",
"$",
"order",
",",
"$",
"extraParams",
"=",
"array",
"(",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"$",
"this",
"->",
"getActionParameterName",
"(",
")",
"=>",
"... | Generate sorting route for a given column to be displayed in view
@todo Remove the order parameter and ask to the datagrid to guess it ?
@param type $route
@param type $column
@param type $order
@param type $extraParams
@return type | [
"Generate",
"sorting",
"route",
"for",
"a",
"given",
"column",
"to",
"be",
"displayed",
"in",
"view"
] | 2c12ad90e8e6f44dc106a4512225c1ec68871076 | https://github.com/spyrit/PropelDatagridBundle/blob/2c12ad90e8e6f44dc106a4512225c1ec68871076/Datagrid/PropelDatagrid.php#L496-L505 | train |
shrink0r/php-schema | src/Property/ScalarProperty.php | ScalarProperty.validate | public function validate($value)
{
return is_scalar($value) ? Ok::unit() : Error::unit([ Error::NON_SCALAR ]);
} | php | public function validate($value)
{
return is_scalar($value) ? Ok::unit() : Error::unit([ Error::NON_SCALAR ]);
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"return",
"is_scalar",
"(",
"$",
"value",
")",
"?",
"Ok",
"::",
"unit",
"(",
")",
":",
"Error",
"::",
"unit",
"(",
"[",
"Error",
"::",
"NON_SCALAR",
"]",
")",
";",
"}"
] | Tells if a given value is a valid scalar.
@param mixed $value
@return ResultInterface Returns Ok if the value is valid, otherwise an Error is returned. | [
"Tells",
"if",
"a",
"given",
"value",
"is",
"a",
"valid",
"scalar",
"."
] | 94293fe897af376dd9d05962e2c516079409dd29 | https://github.com/shrink0r/php-schema/blob/94293fe897af376dd9d05962e2c516079409dd29/src/Property/ScalarProperty.php#L18-L21 | train |
OxfordInfoLabs/kinikit-core | src/Validation/FieldValidators/LengthFieldValidator.php | LengthFieldValidator.validateObjectFieldValue | public function validateObjectFieldValue($value, $fieldName, $targetObject, &$validatorParams, $validatorKey) {
if (sizeof($validatorParams) < ($this->mode == self::MODE_RANGE ? 2 : 1)) {
throw new MisconfiguredValidatorException($validatorKey, $fieldName, $targetObject);
}
if (!$v... | php | public function validateObjectFieldValue($value, $fieldName, $targetObject, &$validatorParams, $validatorKey) {
if (sizeof($validatorParams) < ($this->mode == self::MODE_RANGE ? 2 : 1)) {
throw new MisconfiguredValidatorException($validatorKey, $fieldName, $targetObject);
}
if (!$v... | [
"public",
"function",
"validateObjectFieldValue",
"(",
"$",
"value",
",",
"$",
"fieldName",
",",
"$",
"targetObject",
",",
"&",
"$",
"validatorParams",
",",
"$",
"validatorKey",
")",
"{",
"if",
"(",
"sizeof",
"(",
"$",
"validatorParams",
")",
"<",
"(",
"$"... | Validate a range object
@param string $value
@param $fieldName
@param SerialisableObject $targetObject
@param array $validatorParams
@param $validatorKey
@return bool|mixed
@throws MisconfiguredValidatorException | [
"Validate",
"a",
"range",
"object"
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Validation/FieldValidators/LengthFieldValidator.php#L39-L56 | train |
jbouzekri/SculpinTagCloudBundle | Component/Manager/TagCloudManager.php | TagCloudManager.applyStrategies | protected function applyStrategies(\Jb\Bundle\TagCloudBundle\Model\TagCloud $tagCloud)
{
foreach ($this->strategies as $strategy) {
$strategy->process($tagCloud);
}
} | php | protected function applyStrategies(\Jb\Bundle\TagCloudBundle\Model\TagCloud $tagCloud)
{
foreach ($this->strategies as $strategy) {
$strategy->process($tagCloud);
}
} | [
"protected",
"function",
"applyStrategies",
"(",
"\\",
"Jb",
"\\",
"Bundle",
"\\",
"TagCloudBundle",
"\\",
"Model",
"\\",
"TagCloud",
"$",
"tagCloud",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"strategies",
"as",
"$",
"strategy",
")",
"{",
"$",
"strateg... | Apply all registered strategies
@param \Jb\Bundle\TagCloudBundle\Model\TagCloud $tagCloud | [
"Apply",
"all",
"registered",
"strategies"
] | 936cf34ce60cb8fb4774931b1841fc775a3e9208 | https://github.com/jbouzekri/SculpinTagCloudBundle/blob/936cf34ce60cb8fb4774931b1841fc775a3e9208/Component/Manager/TagCloudManager.php#L107-L112 | train |
Th3Mouk/CMSPageBundle | Migration/BlocksMigration.php | BlocksMigration.migrateCkeditorBlocks | public function migrateCkeditorBlocks()
{
$legacyBlocks = $this->getLegacyCkeditorBlocks();
foreach ($legacyBlocks as $legacyBlock) {
$legacyBlock->setType('cms.block.ckeditor');
$settings = $legacyBlock->getSettings();
if (isset($settings['contenu'])) {
... | php | public function migrateCkeditorBlocks()
{
$legacyBlocks = $this->getLegacyCkeditorBlocks();
foreach ($legacyBlocks as $legacyBlock) {
$legacyBlock->setType('cms.block.ckeditor');
$settings = $legacyBlock->getSettings();
if (isset($settings['contenu'])) {
... | [
"public",
"function",
"migrateCkeditorBlocks",
"(",
")",
"{",
"$",
"legacyBlocks",
"=",
"$",
"this",
"->",
"getLegacyCkeditorBlocks",
"(",
")",
";",
"foreach",
"(",
"$",
"legacyBlocks",
"as",
"$",
"legacyBlock",
")",
"{",
"$",
"legacyBlock",
"->",
"setType",
... | Function of migration of included blocks. | [
"Function",
"of",
"migration",
"of",
"included",
"blocks",
"."
] | c78667ae6969f5947263dcde625e0541f9064774 | https://github.com/Th3Mouk/CMSPageBundle/blob/c78667ae6969f5947263dcde625e0541f9064774/Migration/BlocksMigration.php#L34-L52 | train |
Facebook-Anonymous-Publisher/shortener | src/Drivers/Hashids.php | Hashids.exists | protected function exists($url)
{
$shortener = Shortener::where('hash', hash('sha512', $url))->first();
if (is_null($shortener)) {
return false;
}
return route('shortener.show', [
'url' => $this->hashids->encode($shortener->getKey()),
]);
} | php | protected function exists($url)
{
$shortener = Shortener::where('hash', hash('sha512', $url))->first();
if (is_null($shortener)) {
return false;
}
return route('shortener.show', [
'url' => $this->hashids->encode($shortener->getKey()),
]);
} | [
"protected",
"function",
"exists",
"(",
"$",
"url",
")",
"{",
"$",
"shortener",
"=",
"Shortener",
"::",
"where",
"(",
"'hash'",
",",
"hash",
"(",
"'sha512'",
",",
"$",
"url",
")",
")",
"->",
"first",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
... | Returns shorten url if exists, or false.
@param $url
@return string | [
"Returns",
"shorten",
"url",
"if",
"exists",
"or",
"false",
"."
] | 3b2e49d9cdd96758d35cf57a7a27659d2b6682aa | https://github.com/Facebook-Anonymous-Publisher/shortener/blob/3b2e49d9cdd96758d35cf57a7a27659d2b6682aa/src/Drivers/Hashids.php#L53-L64 | train |
Facebook-Anonymous-Publisher/shortener | src/Drivers/Hashids.php | Hashids.decode | public function decode($short)
{
$ids = $this->hashids->decode($short);
if (empty($ids)) {
throw new \InvalidArgumentException;
}
return Shortener::findOrFail(reset($ids))->getAttribute('url');
} | php | public function decode($short)
{
$ids = $this->hashids->decode($short);
if (empty($ids)) {
throw new \InvalidArgumentException;
}
return Shortener::findOrFail(reset($ids))->getAttribute('url');
} | [
"public",
"function",
"decode",
"(",
"$",
"short",
")",
"{",
"$",
"ids",
"=",
"$",
"this",
"->",
"hashids",
"->",
"decode",
"(",
"$",
"short",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"ids",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentExcep... | Get the origin url.
@param string $short
@return string | [
"Get",
"the",
"origin",
"url",
"."
] | 3b2e49d9cdd96758d35cf57a7a27659d2b6682aa | https://github.com/Facebook-Anonymous-Publisher/shortener/blob/3b2e49d9cdd96758d35cf57a7a27659d2b6682aa/src/Drivers/Hashids.php#L73-L82 | train |
ARCANESOFT/SEO | src/Helpers/SeoChecker.php | SeoChecker.label | public static function label($status)
{
$statuses = [
SeoChecker::STATUS_DANGER => 'danger',
SeoChecker::STATUS_GOOD => 'success',
SeoChecker::STATUS_WARNING => 'warning',
];
return Arr::get($statuses, $status, 'default');
} | php | public static function label($status)
{
$statuses = [
SeoChecker::STATUS_DANGER => 'danger',
SeoChecker::STATUS_GOOD => 'success',
SeoChecker::STATUS_WARNING => 'warning',
];
return Arr::get($statuses, $status, 'default');
} | [
"public",
"static",
"function",
"label",
"(",
"$",
"status",
")",
"{",
"$",
"statuses",
"=",
"[",
"SeoChecker",
"::",
"STATUS_DANGER",
"=>",
"'danger'",
",",
"SeoChecker",
"::",
"STATUS_GOOD",
"=>",
"'success'",
",",
"SeoChecker",
"::",
"STATUS_WARNING",
"=>",... | Get the label class for the given status.
@param string $status
@return string | [
"Get",
"the",
"label",
"class",
"for",
"the",
"given",
"status",
"."
] | ce6d6135d55e8b2fd43cf7923839b4791b7c7ad2 | https://github.com/ARCANESOFT/SEO/blob/ce6d6135d55e8b2fd43cf7923839b4791b7c7ad2/src/Helpers/SeoChecker.php#L61-L70 | train |
ARCANESOFT/SEO | src/Helpers/SeoChecker.php | SeoChecker.check | protected static function check($value, $min, $max)
{
$length = strlen($value);
if ($length < $min)
return self::STATUS_WARNING;
if ($min <= $length && $length <= $max)
return self::STATUS_GOOD;
return self::STATUS_DANGER;
} | php | protected static function check($value, $min, $max)
{
$length = strlen($value);
if ($length < $min)
return self::STATUS_WARNING;
if ($min <= $length && $length <= $max)
return self::STATUS_GOOD;
return self::STATUS_DANGER;
} | [
"protected",
"static",
"function",
"check",
"(",
"$",
"value",
",",
"$",
"min",
",",
"$",
"max",
")",
"{",
"$",
"length",
"=",
"strlen",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"length",
"<",
"$",
"min",
")",
"return",
"self",
"::",
"STATUS_... | Check the value with min & max length.
@param string $value
@param int $min
@param int $max
@return string | [
"Check",
"the",
"value",
"with",
"min",
"&",
"max",
"length",
"."
] | ce6d6135d55e8b2fd43cf7923839b4791b7c7ad2 | https://github.com/ARCANESOFT/SEO/blob/ce6d6135d55e8b2fd43cf7923839b4791b7c7ad2/src/Helpers/SeoChecker.php#L86-L97 | train |
PatrolServer/patrolsdk-php | lib/Server.php | Server.save | public function save() {
if ($this->id) {
throw new Exception('Can\'t save this server because it is already stored');
}
$server = $this->_post('servers', $this->dirty_values);
$this->mergeValues($server);
} | php | public function save() {
if ($this->id) {
throw new Exception('Can\'t save this server because it is already stored');
}
$server = $this->_post('servers', $this->dirty_values);
$this->mergeValues($server);
} | [
"public",
"function",
"save",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"id",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Can\\'t save this server because it is already stored'",
")",
";",
"}",
"$",
"server",
"=",
"$",
"this",
"->",
"_post",
"(",
"'se... | Saves a server | [
"Saves",
"a",
"server"
] | 2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2 | https://github.com/PatrolServer/patrolsdk-php/blob/2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2/lib/Server.php#L41-L48 | train |
PatrolServer/patrolsdk-php | lib/Server.php | Server.verify | public function verify($token = null) {
if (!$token) {
$data = $this->requestVerificationToken();
$token = $data['token'];
}
return $this->_post('servers/' . $this->id . '/verify', ['token' => $token]);
} | php | public function verify($token = null) {
if (!$token) {
$data = $this->requestVerificationToken();
$token = $data['token'];
}
return $this->_post('servers/' . $this->id . '/verify', ['token' => $token]);
} | [
"public",
"function",
"verify",
"(",
"$",
"token",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"token",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"requestVerificationToken",
"(",
")",
";",
"$",
"token",
"=",
"$",
"data",
"[",
"'token'",
"]",
... | Verifies the server with the verification token | [
"Verifies",
"the",
"server",
"with",
"the",
"verification",
"token"
] | 2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2 | https://github.com/PatrolServer/patrolsdk-php/blob/2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2/lib/Server.php#L64-L71 | train |
PatrolServer/patrolsdk-php | lib/Server.php | Server.allSoftware | public function allSoftware($scopes = []) {
if (!$this->id) {
throw new Exception("The server has no ID, can\'t get software");
}
$software = new Software($this->patrol);
$software->defaults([
'server_id' => $this->id
]);
return $software->all($... | php | public function allSoftware($scopes = []) {
if (!$this->id) {
throw new Exception("The server has no ID, can\'t get software");
}
$software = new Software($this->patrol);
$software->defaults([
'server_id' => $this->id
]);
return $software->all($... | [
"public",
"function",
"allSoftware",
"(",
"$",
"scopes",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"id",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"The server has no ID, can\\'t get software\"",
")",
";",
"}",
"$",
"software",
"=",
... | Gets all installed software from this server
@param array $scopes optional
@return array List of PatrolSdk\Software | [
"Gets",
"all",
"installed",
"software",
"from",
"this",
"server"
] | 2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2 | https://github.com/PatrolServer/patrolsdk-php/blob/2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2/lib/Server.php#L92-L104 | train |
PatrolServer/patrolsdk-php | lib/Server.php | Server.software | public function software($id, $scopes = []) {
if (!$this->id) {
throw new Exception("The server has no ID, can\'t get software");
}
$software = new Software($this->patrol);
$software->defaults([
'server_id' => $this->id
]);
return $software->fin... | php | public function software($id, $scopes = []) {
if (!$this->id) {
throw new Exception("The server has no ID, can\'t get software");
}
$software = new Software($this->patrol);
$software->defaults([
'server_id' => $this->id
]);
return $software->fin... | [
"public",
"function",
"software",
"(",
"$",
"id",
",",
"$",
"scopes",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"id",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"The server has no ID, can\\'t get software\"",
")",
";",
"}",
"$",
"s... | Gets a single installed software from this server
@param integer $id
@param array $scopes optional
@return Software | [
"Gets",
"a",
"single",
"installed",
"software",
"from",
"this",
"server"
] | 2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2 | https://github.com/PatrolServer/patrolsdk-php/blob/2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2/lib/Server.php#L114-L126 | train |
PatrolServer/patrolsdk-php | lib/Server.php | Server.buckets | public function buckets() {
if (!$this->id) {
throw new Exception("The server has no ID, can\'t get buckets");
}
$bucket = new Bucket($this->patrol);
$bucket->defaults([
'server_id' => $this->id
]);
return $bucket->all();
} | php | public function buckets() {
if (!$this->id) {
throw new Exception("The server has no ID, can\'t get buckets");
}
$bucket = new Bucket($this->patrol);
$bucket->defaults([
'server_id' => $this->id
]);
return $bucket->all();
} | [
"public",
"function",
"buckets",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"id",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"The server has no ID, can\\'t get buckets\"",
")",
";",
"}",
"$",
"bucket",
"=",
"new",
"Bucket",
"(",
"$",
"this",
"-... | Gets all software buckets from this server
@return array List of PatrolSdk\Bucket | [
"Gets",
"all",
"software",
"buckets",
"from",
"this",
"server"
] | 2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2 | https://github.com/PatrolServer/patrolsdk-php/blob/2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2/lib/Server.php#L133-L145 | train |
PatrolServer/patrolsdk-php | lib/Server.php | Server.bucket | public function bucket($key = null) {
if (!$this->id) {
throw new Exception("The server has no ID, can\'t get buckets");
}
$bucket = new Bucket($this->patrol);
$bucket->defaults([
'server_id' => $this->id
]);
if (is_null($key)) {
ret... | php | public function bucket($key = null) {
if (!$this->id) {
throw new Exception("The server has no ID, can\'t get buckets");
}
$bucket = new Bucket($this->patrol);
$bucket->defaults([
'server_id' => $this->id
]);
if (is_null($key)) {
ret... | [
"public",
"function",
"bucket",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"id",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"The server has no ID, can\\'t get buckets\"",
")",
";",
"}",
"$",
"bucket",
"=",
"new",
"Bucke... | Gets a single software bucket
If no key is set, an empty Bucket object will be returned which will act as a repository
@param string $key optional
@return Bucket | [
"Gets",
"a",
"single",
"software",
"bucket",
"If",
"no",
"key",
"is",
"set",
"an",
"empty",
"Bucket",
"object",
"will",
"be",
"returned",
"which",
"will",
"act",
"as",
"a",
"repository"
] | 2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2 | https://github.com/PatrolServer/patrolsdk-php/blob/2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2/lib/Server.php#L155-L180 | train |
UWEnrollmentManagement/Secure-Upload | src/Cipher.php | Cipher.cleanFilename | public static function cleanFilename($filename)
{
return preg_replace(
'/[^A-Za-z0-9_\-]/',
'_',
htmlentities(pathinfo($filename, PATHINFO_FILENAME))
) . '.' . preg_replace(
'/[^A-Za-z0-9_\-]/',
'_',
htmlentities(pathinfo($filen... | php | public static function cleanFilename($filename)
{
return preg_replace(
'/[^A-Za-z0-9_\-]/',
'_',
htmlentities(pathinfo($filename, PATHINFO_FILENAME))
) . '.' . preg_replace(
'/[^A-Za-z0-9_\-]/',
'_',
htmlentities(pathinfo($filen... | [
"public",
"static",
"function",
"cleanFilename",
"(",
"$",
"filename",
")",
"{",
"return",
"preg_replace",
"(",
"'/[^A-Za-z0-9_\\-]/'",
",",
"'_'",
",",
"htmlentities",
"(",
"pathinfo",
"(",
"$",
"filename",
",",
"PATHINFO_FILENAME",
")",
")",
")",
".",
"'.'",... | White list scrub of file name.
@param string $filename A filename to be cleaned of potentially troublesome characters.
@return string | [
"White",
"list",
"scrub",
"of",
"file",
"name",
"."
] | 153e1f59224d9311585be464e22bd53ed7e1fb01 | https://github.com/UWEnrollmentManagement/Secure-Upload/blob/153e1f59224d9311585be464e22bd53ed7e1fb01/src/Cipher.php#L19-L30 | train |
UWEnrollmentManagement/Secure-Upload | src/Cipher.php | Cipher.encrypt | public static function encrypt($name, $location, $destination, $publicKeyLocation)
{
/** @var resource $publicKey */
$publicKey = openssl_get_publickey(file_get_contents($publicKeyLocation));
/** @var string $data */
$data = file_get_contents($location);
/** @var string $inf... | php | public static function encrypt($name, $location, $destination, $publicKeyLocation)
{
/** @var resource $publicKey */
$publicKey = openssl_get_publickey(file_get_contents($publicKeyLocation));
/** @var string $data */
$data = file_get_contents($location);
/** @var string $inf... | [
"public",
"static",
"function",
"encrypt",
"(",
"$",
"name",
",",
"$",
"location",
",",
"$",
"destination",
",",
"$",
"publicKeyLocation",
")",
"{",
"/** @var resource $publicKey */",
"$",
"publicKey",
"=",
"openssl_get_publickey",
"(",
"file_get_contents",
"(",
"... | Encrypt a specified file.
@param string $name The name that the file shall have when it's decrypted.
@param string $location The current location of the file.
@param string $destination The folder into which you wish to encrypt the file.
@param string $publicKeyLocation The location of the ... | [
"Encrypt",
"a",
"specified",
"file",
"."
] | 153e1f59224d9311585be464e22bd53ed7e1fb01 | https://github.com/UWEnrollmentManagement/Secure-Upload/blob/153e1f59224d9311585be464e22bd53ed7e1fb01/src/Cipher.php#L41-L66 | train |
Panigale/laravel5-Points | src/Traits/GetPointEvent.php | GetPointEvent.getPointEvent | public function getPointEvent($typeId = null)
{
$this->buildQuery();
$query = $this->eventQuery;
if(! is_null($typeId)){
$query->where('point_event_type_id' ,$typeId);
}
return $this->doQuery();
} | php | public function getPointEvent($typeId = null)
{
$this->buildQuery();
$query = $this->eventQuery;
if(! is_null($typeId)){
$query->where('point_event_type_id' ,$typeId);
}
return $this->doQuery();
} | [
"public",
"function",
"getPointEvent",
"(",
"$",
"typeId",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"buildQuery",
"(",
")",
";",
"$",
"query",
"=",
"$",
"this",
"->",
"eventQuery",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"typeId",
")",
")",
"{",... | get user point event
@return \Illuminate\Database\Eloquent\Collection|static[] | [
"get",
"user",
"point",
"event"
] | 6fb559d91694a336f5a11d8408348a85395b4ff3 | https://github.com/Panigale/laravel5-Points/blob/6fb559d91694a336f5a11d8408348a85395b4ff3/src/Traits/GetPointEvent.php#L40-L50 | train |
Panigale/laravel5-Points | src/Traits/GetPointEvent.php | GetPointEvent.getPointEventByType | public function getPointEventByType($isIncrease = true)
{
$query = PointEventType::select('id');
$isIncrease ? $query->where('is_increase' ,$isIncrease) : $query->where('is_deduction');
$eventType = $query->get();
$this->eventQuery = PointEvent::with('activities')
->whe... | php | public function getPointEventByType($isIncrease = true)
{
$query = PointEventType::select('id');
$isIncrease ? $query->where('is_increase' ,$isIncrease) : $query->where('is_deduction');
$eventType = $query->get();
$this->eventQuery = PointEvent::with('activities')
->whe... | [
"public",
"function",
"getPointEventByType",
"(",
"$",
"isIncrease",
"=",
"true",
")",
"{",
"$",
"query",
"=",
"PointEventType",
"::",
"select",
"(",
"'id'",
")",
";",
"$",
"isIncrease",
"?",
"$",
"query",
"->",
"where",
"(",
"'is_increase'",
",",
"$",
"... | get point event by type
@param bool $isIncrease
@return \Illuminate\Database\Eloquent\Collection|static[] | [
"get",
"point",
"event",
"by",
"type"
] | 6fb559d91694a336f5a11d8408348a85395b4ff3 | https://github.com/Panigale/laravel5-Points/blob/6fb559d91694a336f5a11d8408348a85395b4ff3/src/Traits/GetPointEvent.php#L58-L69 | train |
erenmustafaozdal/laravel-modules-base | src/Validators/BaseValidator.php | BaseValidator.validateElfinder | public function validateElfinder($attribute, $value, $parameters, $validator)
{
if( ! File::exists($value) ) {
return false;
}
if(count($parameters)>0) {
return in_array( File::extension($value),$parameters );
}
return true;
} | php | public function validateElfinder($attribute, $value, $parameters, $validator)
{
if( ! File::exists($value) ) {
return false;
}
if(count($parameters)>0) {
return in_array( File::extension($value),$parameters );
}
return true;
} | [
"public",
"function",
"validateElfinder",
"(",
"$",
"attribute",
",",
"$",
"value",
",",
"$",
"parameters",
",",
"$",
"validator",
")",
"{",
"if",
"(",
"!",
"File",
"::",
"exists",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
... | validator elfinder file
@param $attribute
@param $value
@param $parameters
@param $validator
@return bool | [
"validator",
"elfinder",
"file"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Validators/BaseValidator.php#L19-L30 | train |
erenmustafaozdal/laravel-modules-base | src/Validators/BaseValidator.php | BaseValidator.validateElfinderMax | public function validateElfinderMax($attribute, $value, $parameters, $validator)
{
$size = $parameters[0] * 1024; // parameters kB to B
if ( File::size($value) > $size ) {
return false;
}
return true;
} | php | public function validateElfinderMax($attribute, $value, $parameters, $validator)
{
$size = $parameters[0] * 1024; // parameters kB to B
if ( File::size($value) > $size ) {
return false;
}
return true;
} | [
"public",
"function",
"validateElfinderMax",
"(",
"$",
"attribute",
",",
"$",
"value",
",",
"$",
"parameters",
",",
"$",
"validator",
")",
"{",
"$",
"size",
"=",
"$",
"parameters",
"[",
"0",
"]",
"*",
"1024",
";",
"// parameters kB to B\r",
"if",
"(",
"F... | validator elfinder max size file
@param $attribute
@param $value
@param $parameters
@param $validator
@return bool | [
"validator",
"elfinder",
"max",
"size",
"file"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Validators/BaseValidator.php#L41-L48 | train |
erenmustafaozdal/laravel-modules-base | src/Validators/BaseValidator.php | BaseValidator.validateVideoLink | public function validateVideoLink($attribute, $value, $parameters, $validator)
{
return preg_match($this->youtubeRegex, $value) || preg_match($this->vimeoRegex, $value);
} | php | public function validateVideoLink($attribute, $value, $parameters, $validator)
{
return preg_match($this->youtubeRegex, $value) || preg_match($this->vimeoRegex, $value);
} | [
"public",
"function",
"validateVideoLink",
"(",
"$",
"attribute",
",",
"$",
"value",
",",
"$",
"parameters",
",",
"$",
"validator",
")",
"{",
"return",
"preg_match",
"(",
"$",
"this",
"->",
"youtubeRegex",
",",
"$",
"value",
")",
"||",
"preg_match",
"(",
... | validator youtube link
@param $attribute
@param $value
@param $parameters
@param $validator
@param $validator
@return bool | [
"validator",
"youtube",
"link"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Validators/BaseValidator.php#L104-L107 | train |
horntell/php-sdk | src/Horntell/Http/Request.php | Request.send | public function send($method, $endpoint, $data = [])
{
try
{
$request = $this->client->createRequest($method, $endpoint, ['body' => json_encode($data)]);
return new Response($this->client->send($request));
}
catch(GuzzleExceptions\RequestException $e)
{
// pass the exception to a helper method,
/... | php | public function send($method, $endpoint, $data = [])
{
try
{
$request = $this->client->createRequest($method, $endpoint, ['body' => json_encode($data)]);
return new Response($this->client->send($request));
}
catch(GuzzleExceptions\RequestException $e)
{
// pass the exception to a helper method,
/... | [
"public",
"function",
"send",
"(",
"$",
"method",
",",
"$",
"endpoint",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"client",
"->",
"createRequest",
"(",
"$",
"method",
",",
"$",
"endpoint",
",",
... | Wraps HTTP call into a good mould
@param string $method
@param string $endpoint
@param array $data
@return Horntell\Http\Response
@throws Horntell\Errors\* | [
"Wraps",
"HTTP",
"call",
"into",
"a",
"good",
"mould"
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/src/Horntell/Http/Request.php#L46-L60 | train |
horntell/php-sdk | src/Horntell/Http/Request.php | Request.handleError | private function handleError($e)
{
// if there's no response attached to the exception,
// we will assume that the request was never sent and
// thus will throw a network error
if( ! $e->hasResponse())
{
throw new Errors\NetworkError;
}
// if there's a response attached to the exception,
// we will... | php | private function handleError($e)
{
// if there's no response attached to the exception,
// we will assume that the request was never sent and
// thus will throw a network error
if( ! $e->hasResponse())
{
throw new Errors\NetworkError;
}
// if there's a response attached to the exception,
// we will... | [
"private",
"function",
"handleError",
"(",
"$",
"e",
")",
"{",
"// if there's no response attached to the exception,",
"// we will assume that the request was never sent and",
"// thus will throw a network error",
"if",
"(",
"!",
"$",
"e",
"->",
"hasResponse",
"(",
")",
")",
... | Handles the error by throwing proper exception
@param GuzzleHttp\Exception\RequestException $e
@return null
@throws Horntell\Errors\NetworkError If original exception has no response attached to it
@throws Horntell\Errors\InvalidRequestException If HTTP Status Code is 400
@throws Horntell\Errors\AuthenticationExcepti... | [
"Handles",
"the",
"error",
"by",
"throwing",
"proper",
"exception"
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/src/Horntell/Http/Request.php#L74-L118 | train |
horntell/php-sdk | src/Horntell/Http/Request.php | Request.handleUnknownError | private function handleUnknownError($e)
{
$response = $e->getResponse();
$body = $response->json();
// switching on the first number of status code
// we are using floor to round off to the lower end
// eg. floor(404 / 100) == 4
switch(floor($response->getStatusCode() / 100))
{
// client error (4xx)
... | php | private function handleUnknownError($e)
{
$response = $e->getResponse();
$body = $response->json();
// switching on the first number of status code
// we are using floor to round off to the lower end
// eg. floor(404 / 100) == 4
switch(floor($response->getStatusCode() / 100))
{
// client error (4xx)
... | [
"private",
"function",
"handleUnknownError",
"(",
"$",
"e",
")",
"{",
"$",
"response",
"=",
"$",
"e",
"->",
"getResponse",
"(",
")",
";",
"$",
"body",
"=",
"$",
"response",
"->",
"json",
"(",
")",
";",
"// switching on the first number of status code",
"// w... | Handles unknown errors by checking the kind of HTTP status code
@param GuzzleHttp\Exception\RequestException $e
@return null
@throws Horntell\Errors\InvalidRequestError If HTTP Status Code is 4xx
@throws Horntell\Errors\ServiceError If HTTP Status Code is 5xx
@throws Horntell\Errors\Error If HTTP Status Code is other... | [
"Handles",
"unknown",
"errors",
"by",
"checking",
"the",
"kind",
"of",
"HTTP",
"status",
"code"
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/src/Horntell/Http/Request.php#L129-L153 | train |
pixelpolishers/makedocs | src/MakeDocs/Generator/PageManager.php | PageManager.getSourceFile | public function getSourceFile($page)
{
$path = realpath($this->generator->getInputDirectory() . '/' . $page . '.xml');
return new SourceFile($page, $path);
} | php | public function getSourceFile($page)
{
$path = realpath($this->generator->getInputDirectory() . '/' . $page . '.xml');
return new SourceFile($page, $path);
} | [
"public",
"function",
"getSourceFile",
"(",
"$",
"page",
")",
"{",
"$",
"path",
"=",
"realpath",
"(",
"$",
"this",
"->",
"generator",
"->",
"getInputDirectory",
"(",
")",
".",
"'/'",
".",
"$",
"page",
".",
"'.xml'",
")",
";",
"return",
"new",
"SourceFi... | Loads a source file.
@param string $page The page to load.
@return SourceFile | [
"Loads",
"a",
"source",
"file",
"."
] | 1fa243b52565b5de417ef2dbdfbcae9896b6b483 | https://github.com/pixelpolishers/makedocs/blob/1fa243b52565b5de417ef2dbdfbcae9896b6b483/src/MakeDocs/Generator/PageManager.php#L67-L72 | train |
congraphcms/core | Traits/ValidatorTrait.php | ValidatorTrait.validateParams | protected function validateParams(array &$params, $rules = null, $clean = false)
{
if( ! is_null($rules) )
{
// init laravel validator
$validator = $this->newValidator($params, $rules, $clean);
$this->setValidator($validator);
}
$validator = $this->getValidator();
$rules = $validator->getRules();
... | php | protected function validateParams(array &$params, $rules = null, $clean = false)
{
if( ! is_null($rules) )
{
// init laravel validator
$validator = $this->newValidator($params, $rules, $clean);
$this->setValidator($validator);
}
$validator = $this->getValidator();
$rules = $validator->getRules();
... | [
"protected",
"function",
"validateParams",
"(",
"array",
"&",
"$",
"params",
",",
"$",
"rules",
"=",
"null",
",",
"$",
"clean",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"rules",
")",
")",
"{",
"// init laravel validator",
"$",
"vali... | Validate params by given rules
@param $params array - input parameters
@param $rules array - rules for validator
@param $clean boolean - whether to unset params that are not in rules
@return boolean | [
"Validate",
"params",
"by",
"given",
"rules"
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Traits/ValidatorTrait.php#L59-L87 | train |
WellCommerce/ClientBundle | Twig/Extension/ClientAddressFormatterExtension.php | ClientAddressFormatterExtension.formatShippingAddress | public function formatShippingAddress(ClientShippingAddressInterface $address, $lineSeparator = self::LINES_SEPARATOR)
{
$lines = [];
$lines[] = sprintf('%s %s', $address->getFirstName(), $address->getLastName());
if ('' !== $address->getCompanyName()) {
$lines[] = $address->ge... | php | public function formatShippingAddress(ClientShippingAddressInterface $address, $lineSeparator = self::LINES_SEPARATOR)
{
$lines = [];
$lines[] = sprintf('%s %s', $address->getFirstName(), $address->getLastName());
if ('' !== $address->getCompanyName()) {
$lines[] = $address->ge... | [
"public",
"function",
"formatShippingAddress",
"(",
"ClientShippingAddressInterface",
"$",
"address",
",",
"$",
"lineSeparator",
"=",
"self",
"::",
"LINES_SEPARATOR",
")",
"{",
"$",
"lines",
"=",
"[",
"]",
";",
"$",
"lines",
"[",
"]",
"=",
"sprintf",
"(",
"'... | Formats the shipping address
@param ClientShippingAddressInterface $address
@param string $lineSeparator
@return string | [
"Formats",
"the",
"shipping",
"address"
] | b19aa5c962e67972f79338d2f341b30fa1ee879e | https://github.com/WellCommerce/ClientBundle/blob/b19aa5c962e67972f79338d2f341b30fa1ee879e/Twig/Extension/ClientAddressFormatterExtension.php#L74-L86 | train |
WellCommerce/ClientBundle | Twig/Extension/ClientAddressFormatterExtension.php | ClientAddressFormatterExtension.formatContactDetails | public function formatContactDetails(ClientContactDetailsInterface $details, $lineSeparator = self::LINES_SEPARATOR)
{
$lines = [];
$lines[] = sprintf('%s %s', $details->getFirstName(), $details->getLastName());
$lines[] = sprintf('%s %s', $details->getPhone(), $details->getSecondaryPhone(... | php | public function formatContactDetails(ClientContactDetailsInterface $details, $lineSeparator = self::LINES_SEPARATOR)
{
$lines = [];
$lines[] = sprintf('%s %s', $details->getFirstName(), $details->getLastName());
$lines[] = sprintf('%s %s', $details->getPhone(), $details->getSecondaryPhone(... | [
"public",
"function",
"formatContactDetails",
"(",
"ClientContactDetailsInterface",
"$",
"details",
",",
"$",
"lineSeparator",
"=",
"self",
"::",
"LINES_SEPARATOR",
")",
"{",
"$",
"lines",
"=",
"[",
"]",
";",
"$",
"lines",
"[",
"]",
"=",
"sprintf",
"(",
"'%s... | Formats the contact details
@param ClientContactDetailsInterface $details
@param string $lineSeparator
@return string | [
"Formats",
"the",
"contact",
"details"
] | b19aa5c962e67972f79338d2f341b30fa1ee879e | https://github.com/WellCommerce/ClientBundle/blob/b19aa5c962e67972f79338d2f341b30fa1ee879e/Twig/Extension/ClientAddressFormatterExtension.php#L96-L104 | train |
raphievila/xtags | src/xTags.php | xTags.frm | public function frm($txt, $att = '', $a = '', $m = '', $e = '')
{
$attList = array();
if (!empty($a)) {
$attList['action'] = $a;
}
if (!empty($m)) {
$attList['method'] = $m;
}
if (!empty($e)) {
$attList['enctype'] = $e;
}
... | php | public function frm($txt, $att = '', $a = '', $m = '', $e = '')
{
$attList = array();
if (!empty($a)) {
$attList['action'] = $a;
}
if (!empty($m)) {
$attList['method'] = $m;
}
if (!empty($e)) {
$attList['enctype'] = $e;
}
... | [
"public",
"function",
"frm",
"(",
"$",
"txt",
",",
"$",
"att",
"=",
"''",
",",
"$",
"a",
"=",
"''",
",",
"$",
"m",
"=",
"''",
",",
"$",
"e",
"=",
"''",
")",
"{",
"$",
"attList",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
... | complex tags predefined to simplify coding | [
"complex",
"tags",
"predefined",
"to",
"simplify",
"coding"
] | cd05cc4d8811662becffb0dd1abce30d8436f2c7 | https://github.com/raphievila/xtags/blob/cd05cc4d8811662becffb0dd1abce30d8436f2c7/src/xTags.php#L213-L228 | train |
TitaPHP/framework | src/TitaPHP/Foundation/Application.php | Application.setConfig | public function setConfig( $param, $value )
{
$dn = new DotNotation($this->configs);
$dn->set($param, $value);
$this->configs = $dn->getValues();
} | php | public function setConfig( $param, $value )
{
$dn = new DotNotation($this->configs);
$dn->set($param, $value);
$this->configs = $dn->getValues();
} | [
"public",
"function",
"setConfig",
"(",
"$",
"param",
",",
"$",
"value",
")",
"{",
"$",
"dn",
"=",
"new",
"DotNotation",
"(",
"$",
"this",
"->",
"configs",
")",
";",
"$",
"dn",
"->",
"set",
"(",
"$",
"param",
",",
"$",
"value",
")",
";",
"$",
"... | Set configuration parameter.
@param string $param
@param string $value
@return void | [
"Set",
"configuration",
"parameter",
"."
] | 72283a45733a49c1d9c1fc0eba22ff13a802295c | https://github.com/TitaPHP/framework/blob/72283a45733a49c1d9c1fc0eba22ff13a802295c/src/TitaPHP/Foundation/Application.php#L127-L132 | train |
TitaPHP/framework | src/TitaPHP/Foundation/Application.php | Application.getConfig | public function getConfig( $param, $defaultValue = null )
{
$dn = new DotNotation($this->configs);
return $dn->get($param, $defaultValue);
} | php | public function getConfig( $param, $defaultValue = null )
{
$dn = new DotNotation($this->configs);
return $dn->get($param, $defaultValue);
} | [
"public",
"function",
"getConfig",
"(",
"$",
"param",
",",
"$",
"defaultValue",
"=",
"null",
")",
"{",
"$",
"dn",
"=",
"new",
"DotNotation",
"(",
"$",
"this",
"->",
"configs",
")",
";",
"return",
"$",
"dn",
"->",
"get",
"(",
"$",
"param",
",",
"$",... | Get Configuration Value.
@param string $param
@param null $defaultValue
@return mixed | [
"Get",
"Configuration",
"Value",
"."
] | 72283a45733a49c1d9c1fc0eba22ff13a802295c | https://github.com/TitaPHP/framework/blob/72283a45733a49c1d9c1fc0eba22ff13a802295c/src/TitaPHP/Foundation/Application.php#L143-L147 | train |
TitaPHP/framework | src/TitaPHP/Foundation/Application.php | Application.loadProviders | protected function loadProviders($providers)
{
foreach ((array) $providers as $provider) {
$provider = $this->container->get($provider);
if (!$provider instanceof ServiceProviderInterface) {
$providerName = get_class($provider);
throw new \Exception(
"$providerName does not implement required \\T... | php | protected function loadProviders($providers)
{
foreach ((array) $providers as $provider) {
$provider = $this->container->get($provider);
if (!$provider instanceof ServiceProviderInterface) {
$providerName = get_class($provider);
throw new \Exception(
"$providerName does not implement required \\T... | [
"protected",
"function",
"loadProviders",
"(",
"$",
"providers",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"providers",
"as",
"$",
"provider",
")",
"{",
"$",
"provider",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"$",
"provider",
")... | Register Providers into the Application.
@param array $providers
@return void
@throws \Exception | [
"Register",
"Providers",
"into",
"the",
"Application",
"."
] | 72283a45733a49c1d9c1fc0eba22ff13a802295c | https://github.com/TitaPHP/framework/blob/72283a45733a49c1d9c1fc0eba22ff13a802295c/src/TitaPHP/Foundation/Application.php#L178-L192 | train |
TitaPHP/framework | src/TitaPHP/Foundation/Application.php | Application.loadEvents | protected function loadEvents($appEvents)
{
foreach ((array) $appEvents as $appEventType => $events) {
foreach ($events as $event) {
$this->eventDispatcher->addListener($appEventType, $this->container->get($event));
}
}
} | php | protected function loadEvents($appEvents)
{
foreach ((array) $appEvents as $appEventType => $events) {
foreach ($events as $event) {
$this->eventDispatcher->addListener($appEventType, $this->container->get($event));
}
}
} | [
"protected",
"function",
"loadEvents",
"(",
"$",
"appEvents",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"appEvents",
"as",
"$",
"appEventType",
"=>",
"$",
"events",
")",
"{",
"foreach",
"(",
"$",
"events",
"as",
"$",
"event",
")",
"{",
"$",
"... | Register Event Listeners.
@param array $appEvents
@return void | [
"Register",
"Event",
"Listeners",
"."
] | 72283a45733a49c1d9c1fc0eba22ff13a802295c | https://github.com/TitaPHP/framework/blob/72283a45733a49c1d9c1fc0eba22ff13a802295c/src/TitaPHP/Foundation/Application.php#L200-L207 | train |
phossa/phossa-config | src/Phossa/Config/Parameter.php | Parameter.getSuperGlobalValue | protected function getSuperGlobalValue(/*# string */ $name)
{
$pos = strpos($name, $this->field_splitter);
if (false !== $pos) {
$pref = substr($name, 0, $pos);
$suff = substr($name, $pos + 1);
if (isset($GLOBALS[$pref][$suff])) {
return $GLOBALS[$... | php | protected function getSuperGlobalValue(/*# string */ $name)
{
$pos = strpos($name, $this->field_splitter);
if (false !== $pos) {
$pref = substr($name, 0, $pos);
$suff = substr($name, $pos + 1);
if (isset($GLOBALS[$pref][$suff])) {
return $GLOBALS[$... | [
"protected",
"function",
"getSuperGlobalValue",
"(",
"/*# string */",
"$",
"name",
")",
"{",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"field_splitter",
")",
";",
"if",
"(",
"false",
"!==",
"$",
"pos",
")",
"{",
"$",
"pref",
... | Get super global value
@param string $name something like '_SERVER.HTTP_HOST'
@return string|array
@access protected | [
"Get",
"super",
"global",
"value"
] | fdb90831da06408bb674ab777754e67025604bed | https://github.com/phossa/phossa-config/blob/fdb90831da06408bb674ab777754e67025604bed/src/Phossa/Config/Parameter.php#L165-L181 | train |
phossa/phossa-config | src/Phossa/Config/Parameter.php | Parameter.exceptionIfNotString | protected function exceptionIfNotString($key)
{
if (!is_string($key)) {
throw new InvalidArgumentException(
Message::get(Message::CONFIG_KEY_INVALID, $key),
Message::CONFIG_KEY_INVALID
);
}
} | php | protected function exceptionIfNotString($key)
{
if (!is_string($key)) {
throw new InvalidArgumentException(
Message::get(Message::CONFIG_KEY_INVALID, $key),
Message::CONFIG_KEY_INVALID
);
}
} | [
"protected",
"function",
"exceptionIfNotString",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"Message",
"::",
"get",
"(",
"Message",
"::",
"CONFIG_KEY_INVALID",
",",... | Throw exception if not a string
@param string $key
@throws InvalidArgumentException if $key not a string
@access public | [
"Throw",
"exception",
"if",
"not",
"a",
"string"
] | fdb90831da06408bb674ab777754e67025604bed | https://github.com/phossa/phossa-config/blob/fdb90831da06408bb674ab777754e67025604bed/src/Phossa/Config/Parameter.php#L190-L198 | train |
agentmedia/phine-core | src/Core/Logic/Routing/FrontendRouter.php | FrontendRouter.GatherParams | static function GatherParams($url)
{
$reader = new StringReader($url);
$param = '';
$params = array();
$start = false;
while (false !== ($ch = $reader->ReadChar())) {
if ($ch == '{') {
$start = true;
}
else if ($ch == '}' &&... | php | static function GatherParams($url)
{
$reader = new StringReader($url);
$param = '';
$params = array();
$start = false;
while (false !== ($ch = $reader->ReadChar())) {
if ($ch == '{') {
$start = true;
}
else if ($ch == '}' &&... | [
"static",
"function",
"GatherParams",
"(",
"$",
"url",
")",
"{",
"$",
"reader",
"=",
"new",
"StringReader",
"(",
"$",
"url",
")",
";",
"$",
"param",
"=",
"''",
";",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"start",
"=",
"false",
";",
"whi... | Gathers the obligatory parameters from the url
@param string $url The page url
@return string[] Array of parameter names | [
"Gathers",
"the",
"obligatory",
"parameters",
"from",
"the",
"url"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Routing/FrontendRouter.php#L26-L46 | train |
agentmedia/phine-core | src/Core/Logic/Routing/FrontendRouter.php | FrontendRouter.PageUrl | static function PageUrl(Page $page, array $params = array(), $fragment = '')
{
$siteUrl = $page->GetSite()->GetUrl();
$pageUrl = $page->GetUrl();
if ($pageUrl == 'index.html') {
$url = $siteUrl;
}
else {
$url = Path::Combine($siteUrl, $pageUrl);
... | php | static function PageUrl(Page $page, array $params = array(), $fragment = '')
{
$siteUrl = $page->GetSite()->GetUrl();
$pageUrl = $page->GetUrl();
if ($pageUrl == 'index.html') {
$url = $siteUrl;
}
else {
$url = Path::Combine($siteUrl, $pageUrl);
... | [
"static",
"function",
"PageUrl",
"(",
"Page",
"$",
"page",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"fragment",
"=",
"''",
")",
"{",
"$",
"siteUrl",
"=",
"$",
"page",
"->",
"GetSite",
"(",
")",
"->",
"GetUrl",
"(",
")",
";",... | Returns the url of a page with parameters and fragment
@param Page $page The page
@param array $params All parameters
@return string Return the page url | [
"Returns",
"the",
"url",
"of",
"a",
"page",
"with",
"parameters",
"and",
"fragment"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Routing/FrontendRouter.php#L54-L70 | train |
agentmedia/phine-core | src/Core/Logic/Routing/FrontendRouter.php | FrontendRouter.Url | static function Url(PageUrl $pageUrl, array $additionalParameters = array())
{
$list = new PageParamListProvider($pageUrl);
$params = $list->ToArray();
foreach ($additionalParameters as $key => $value) {
$params[$key] = $value;
}
return self::PageUrl($pageUrl->Get... | php | static function Url(PageUrl $pageUrl, array $additionalParameters = array())
{
$list = new PageParamListProvider($pageUrl);
$params = $list->ToArray();
foreach ($additionalParameters as $key => $value) {
$params[$key] = $value;
}
return self::PageUrl($pageUrl->Get... | [
"static",
"function",
"Url",
"(",
"PageUrl",
"$",
"pageUrl",
",",
"array",
"$",
"additionalParameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"list",
"=",
"new",
"PageParamListProvider",
"(",
"$",
"pageUrl",
")",
";",
"$",
"params",
"=",
"$",
"list",
... | Gets the url for a page url entity
@param PageUrl $pageUrl The page url as stored in the database
@param array $additionalParameters Additional parameters; will override stored parameters with same keys
@return string Returns the page url | [
"Gets",
"the",
"url",
"for",
"a",
"page",
"url",
"entity"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Routing/FrontendRouter.php#L78-L86 | train |
agentmedia/phine-core | src/Core/Logic/Routing/FrontendRouter.php | FrontendRouter.AttachObligatoryParams | private static function AttachObligatoryParams($url, array $oblParams, array $params)
{
foreach ($oblParams as $oblParam) {
$value = '';
if (!array_key_exists($oblParam, $params)) {
$value = Request::GetData($oblParam);
}
else {
... | php | private static function AttachObligatoryParams($url, array $oblParams, array $params)
{
foreach ($oblParams as $oblParam) {
$value = '';
if (!array_key_exists($oblParam, $params)) {
$value = Request::GetData($oblParam);
}
else {
... | [
"private",
"static",
"function",
"AttachObligatoryParams",
"(",
"$",
"url",
",",
"array",
"$",
"oblParams",
",",
"array",
"$",
"params",
")",
"{",
"foreach",
"(",
"$",
"oblParams",
"as",
"$",
"oblParam",
")",
"{",
"$",
"value",
"=",
"''",
";",
"if",
"(... | Attaches obligatory parameters
@param string $url The url pattern as given by the associated page property
@param array $oblParams The names of the obligatory parameters
@param array $params All given parameters for appending
@return string Returns the url with obligatory paramters attached
@throws \LogicException Rais... | [
"Attaches",
"obligatory",
"parameters"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Routing/FrontendRouter.php#L96-L112 | train |
agentmedia/phine-core | src/Core/Logic/Routing/FrontendRouter.php | FrontendRouter.AttachMoreParams | private static function AttachMoreParams($url, array $oblParams, array $params)
{
$moreParams = array();
foreach ($params as $key => $value) {
if (!in_array($key, $oblParams)) {
$moreParams[$key] = $value;
}
}
if (count($moreParams)) {
... | php | private static function AttachMoreParams($url, array $oblParams, array $params)
{
$moreParams = array();
foreach ($params as $key => $value) {
if (!in_array($key, $oblParams)) {
$moreParams[$key] = $value;
}
}
if (count($moreParams)) {
... | [
"private",
"static",
"function",
"AttachMoreParams",
"(",
"$",
"url",
",",
"array",
"$",
"oblParams",
",",
"array",
"$",
"params",
")",
"{",
"$",
"moreParams",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"key",
"=>",
"$",
"... | Attaches none oblique url paramters
@param string $url The url with obligatory parameters already attached
@param array $oblParams The names of the obligatory parameters
@param array $params All url parameters
@return string Returns the url with all paramteters attached | [
"Attaches",
"none",
"oblique",
"url",
"paramters"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Routing/FrontendRouter.php#L121-L133 | train |
agentmedia/phine-core | src/Core/Logic/Routing/FrontendRouter.php | FrontendRouter.Page404 | static function Page404(Site $site)
{
$sql = Access::SqlBuilder();
$tblPage = Page::Schema()->Table();
$where = $sql->Equals($tblPage->Field('Type'), $sql->Value((string) PageType::NotFound()))
->And_($sql->Equals($tblPage->Field('Site'), $sql->Value($site->GetID())));
... | php | static function Page404(Site $site)
{
$sql = Access::SqlBuilder();
$tblPage = Page::Schema()->Table();
$where = $sql->Equals($tblPage->Field('Type'), $sql->Value((string) PageType::NotFound()))
->And_($sql->Equals($tblPage->Field('Site'), $sql->Value($site->GetID())));
... | [
"static",
"function",
"Page404",
"(",
"Site",
"$",
"site",
")",
"{",
"$",
"sql",
"=",
"Access",
"::",
"SqlBuilder",
"(",
")",
";",
"$",
"tblPage",
"=",
"Page",
"::",
"Schema",
"(",
")",
"->",
"Table",
"(",
")",
";",
"$",
"where",
"=",
"$",
"sql",... | Finds the 404 page for a site
@param Site $site The site whise 404 page is searched for
@return Page The 404 page | [
"Finds",
"the",
"404",
"page",
"for",
"a",
"site"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Routing/FrontendRouter.php#L140-L148 | train |
phossa/phossa-config | src/Phossa/Config/Reference/ReferenceTrait.php | ReferenceTrait.getPattern | protected function getPattern()/*# : string */
{
if (is_null($this->reference_pattern)) {
if ('' === $this->reference_start ||
is_null($this->reference_end)) {
$this->reference_pattern = '';
} else {
$this->reference_pattern = '~(' .
... | php | protected function getPattern()/*# : string */
{
if (is_null($this->reference_pattern)) {
if ('' === $this->reference_start ||
is_null($this->reference_end)) {
$this->reference_pattern = '';
} else {
$this->reference_pattern = '~(' .
... | [
"protected",
"function",
"getPattern",
"(",
")",
"/*# : string */",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"reference_pattern",
")",
")",
"{",
"if",
"(",
"''",
"===",
"$",
"this",
"->",
"reference_start",
"||",
"is_null",
"(",
"$",
"this",
"-... | Get the reference pattern
@return string
@access protected | [
"Get",
"the",
"reference",
"pattern"
] | fdb90831da06408bb674ab777754e67025604bed | https://github.com/phossa/phossa-config/blob/fdb90831da06408bb674ab777754e67025604bed/src/Phossa/Config/Reference/ReferenceTrait.php#L181-L195 | train |
phossa/phossa-config | src/Phossa/Config/Reference/ReferenceTrait.php | ReferenceTrait.deReferenceArray | protected function deReferenceArray(
array &$dataArray,
/*# bool */ $clearCache = false
) {
// reference feature disabled
if ('' === $this->getPattern()) {
return;
}
// clear old cache
if ($clearCache) {
$this->loop_detect = [];
... | php | protected function deReferenceArray(
array &$dataArray,
/*# bool */ $clearCache = false
) {
// reference feature disabled
if ('' === $this->getPattern()) {
return;
}
// clear old cache
if ($clearCache) {
$this->loop_detect = [];
... | [
"protected",
"function",
"deReferenceArray",
"(",
"array",
"&",
"$",
"dataArray",
",",
"/*# bool */",
"$",
"clearCache",
"=",
"false",
")",
"{",
"// reference feature disabled",
"if",
"(",
"''",
"===",
"$",
"this",
"->",
"getPattern",
"(",
")",
")",
"{",
"re... | Derefence all references in an array
@param array &$dataArray
@param bool $clearCache clear dereference cache
@throws LogicException if malformed reference found
@access protected | [
"Derefence",
"all",
"references",
"in",
"an",
"array"
] | fdb90831da06408bb674ab777754e67025604bed | https://github.com/phossa/phossa-config/blob/fdb90831da06408bb674ab777754e67025604bed/src/Phossa/Config/Reference/ReferenceTrait.php#L231-L268 | train |
agentmedia/phine-core | src/Core/Logic/Util/PathUtil.php | PathUtil.BundleFolder | static function BundleFolder($bundleName)
{
$packageBundles = self::PackageBundles();
if (isset($packageBundles[$bundleName])) {
return $packageBundles[$bundleName];
}
return Path::Combine(self::AppBundlesFolder(), $bundleName);
} | php | static function BundleFolder($bundleName)
{
$packageBundles = self::PackageBundles();
if (isset($packageBundles[$bundleName])) {
return $packageBundles[$bundleName];
}
return Path::Combine(self::AppBundlesFolder(), $bundleName);
} | [
"static",
"function",
"BundleFolder",
"(",
"$",
"bundleName",
")",
"{",
"$",
"packageBundles",
"=",
"self",
"::",
"PackageBundles",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"packageBundles",
"[",
"$",
"bundleName",
"]",
")",
")",
"{",
"return",
"$",
... | Gets the folder for the bundle
@param string $bundleName The name of the bundle
@return string Returns the bundle directory path | [
"Gets",
"the",
"folder",
"for",
"the",
"bundle"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/PathUtil.php#L27-L34 | train |
agentmedia/phine-core | src/Core/Logic/Util/PathUtil.php | PathUtil.Modules | static function Modules($bundleName, ModuleLocation $location)
{
$result = array();
$modulesFolder = Path::Combine(self::BundleFolder($bundleName), 'Modules');
$folder = Path::Combine($modulesFolder, (string)$location);
if (!Folder::Exists($folder)) {
return $result;
... | php | static function Modules($bundleName, ModuleLocation $location)
{
$result = array();
$modulesFolder = Path::Combine(self::BundleFolder($bundleName), 'Modules');
$folder = Path::Combine($modulesFolder, (string)$location);
if (!Folder::Exists($folder)) {
return $result;
... | [
"static",
"function",
"Modules",
"(",
"$",
"bundleName",
",",
"ModuleLocation",
"$",
"location",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"modulesFolder",
"=",
"Path",
"::",
"Combine",
"(",
"self",
"::",
"BundleFolder",
"(",
"$",
"bundl... | Gets all modules in a bundle
@param string $bundleName
@param ModuleLocation $location Backend or frontend
@return string[] Returns the module names | [
"Gets",
"all",
"modules",
"in",
"a",
"bundle"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/PathUtil.php#L100-L114 | train |
agentmedia/phine-core | src/Core/Logic/Util/PathUtil.php | PathUtil.BundleTranslationsFile | static function BundleTranslationsFile(ModuleBase $module, $lang)
{
$moduleTransFolder = self::ModuleTranslationsFolder($module);
$bundleTransFolder = Path::Directory($moduleTransFolder);
$file = Path::Combine($bundleTransFolder, $lang);
return Path::AddExtension($file, 'php');
} | php | static function BundleTranslationsFile(ModuleBase $module, $lang)
{
$moduleTransFolder = self::ModuleTranslationsFolder($module);
$bundleTransFolder = Path::Directory($moduleTransFolder);
$file = Path::Combine($bundleTransFolder, $lang);
return Path::AddExtension($file, 'php');
} | [
"static",
"function",
"BundleTranslationsFile",
"(",
"ModuleBase",
"$",
"module",
",",
"$",
"lang",
")",
"{",
"$",
"moduleTransFolder",
"=",
"self",
"::",
"ModuleTranslationsFolder",
"(",
"$",
"module",
")",
";",
"$",
"bundleTransFolder",
"=",
"Path",
"::",
"D... | Gets the bundle translations file
@param ModuleBase $module
@param string $lang
@return string Returns the bundle translations file | [
"Gets",
"the",
"bundle",
"translations",
"file"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/PathUtil.php#L182-L188 | train |
agentmedia/phine-core | src/Core/Logic/Util/PathUtil.php | PathUtil.ModuleTranslationsFolder | static function ModuleTranslationsFolder(ModuleBase $module)
{
$class = new \ReflectionClass($module);
$classFile = Str::Replace('\\', '/', $class->getFileName());
return Str::Replace('/Modules/', '/Translations/', Path::RemoveExtension($classFile));
} | php | static function ModuleTranslationsFolder(ModuleBase $module)
{
$class = new \ReflectionClass($module);
$classFile = Str::Replace('\\', '/', $class->getFileName());
return Str::Replace('/Modules/', '/Translations/', Path::RemoveExtension($classFile));
} | [
"static",
"function",
"ModuleTranslationsFolder",
"(",
"ModuleBase",
"$",
"module",
")",
"{",
"$",
"class",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"module",
")",
";",
"$",
"classFile",
"=",
"Str",
"::",
"Replace",
"(",
"'\\\\'",
",",
"'/'",
",",
... | Gets the translations folder for a module
@param ModuleBase $module
@return string Returns the folder of the module translationss | [
"Gets",
"the",
"translations",
"folder",
"for",
"a",
"module"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/PathUtil.php#L194-L199 | train |
agentmedia/phine-core | src/Core/Logic/Util/PathUtil.php | PathUtil.ModuleTranslationsFile | static function ModuleTranslationsFile(ModuleBase $module, $lang)
{
$folder = self::ModuleTranslationsFolder($module);
$file = Path::Combine($folder, $lang);
return Path::AddExtension($file, 'php');
} | php | static function ModuleTranslationsFile(ModuleBase $module, $lang)
{
$folder = self::ModuleTranslationsFolder($module);
$file = Path::Combine($folder, $lang);
return Path::AddExtension($file, 'php');
} | [
"static",
"function",
"ModuleTranslationsFile",
"(",
"ModuleBase",
"$",
"module",
",",
"$",
"lang",
")",
"{",
"$",
"folder",
"=",
"self",
"::",
"ModuleTranslationsFolder",
"(",
"$",
"module",
")",
";",
"$",
"file",
"=",
"Path",
"::",
"Combine",
"(",
"$",
... | Gets the translations file for a module
@param ModuleBase $module The module
@param string $lang The desired language
@return string Returns the file with specific translations for a module | [
"Gets",
"the",
"translations",
"file",
"for",
"a",
"module"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/PathUtil.php#L207-L212 | train |
agentmedia/phine-core | src/Core/Logic/Util/PathUtil.php | PathUtil.ModuleCustomTemplatesFolder | static function ModuleCustomTemplatesFolder(TemplateModule $module)
{
$parentFolder = Path::Combine(PHINE_PATH, 'App/Phine/ModuleTemplates');
$bundleFolder = Path::Combine($parentFolder, $module->MyBundle());
return Path::Combine($bundleFolder, $module->MyName());
} | php | static function ModuleCustomTemplatesFolder(TemplateModule $module)
{
$parentFolder = Path::Combine(PHINE_PATH, 'App/Phine/ModuleTemplates');
$bundleFolder = Path::Combine($parentFolder, $module->MyBundle());
return Path::Combine($bundleFolder, $module->MyName());
} | [
"static",
"function",
"ModuleCustomTemplatesFolder",
"(",
"TemplateModule",
"$",
"module",
")",
"{",
"$",
"parentFolder",
"=",
"Path",
"::",
"Combine",
"(",
"PHINE_PATH",
",",
"'App/Phine/ModuleTemplates'",
")",
";",
"$",
"bundleFolder",
"=",
"Path",
"::",
"Combin... | Gets the folder for
@param TemplateModule $module
@return string | [
"Gets",
"the",
"folder",
"for"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/PathUtil.php#L220-L225 | train |
agentmedia/phine-core | src/Core/Logic/Util/PathUtil.php | PathUtil.LayoutTemplate | static function LayoutTemplate(Layout $layout)
{
$folder = Path::Combine(PHINE_PATH, 'App/Phine/LayoutTemplates');
$file = Path::Combine($folder, $layout->GetName());
return Path::AddExtension($file, 'phtml');
} | php | static function LayoutTemplate(Layout $layout)
{
$folder = Path::Combine(PHINE_PATH, 'App/Phine/LayoutTemplates');
$file = Path::Combine($folder, $layout->GetName());
return Path::AddExtension($file, 'phtml');
} | [
"static",
"function",
"LayoutTemplate",
"(",
"Layout",
"$",
"layout",
")",
"{",
"$",
"folder",
"=",
"Path",
"::",
"Combine",
"(",
"PHINE_PATH",
",",
"'App/Phine/LayoutTemplates'",
")",
";",
"$",
"file",
"=",
"Path",
"::",
"Combine",
"(",
"$",
"folder",
","... | The template file for a page layout
@param Layout $layout The page layout
@return string Returns the layout template path | [
"The",
"template",
"file",
"for",
"a",
"page",
"layout"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/PathUtil.php#L232-L237 | train |
agentmedia/phine-core | src/Core/Logic/Util/PathUtil.php | PathUtil.SitemapCacheFile | static function SitemapCacheFile(Site $site)
{
$cacheFolder = Path::Combine(PHINE_PATH, 'App/Phine/Cache/Sitemap');
$filename = Path::AddExtension($site->GetID(), 'xml');
return Path::Combine($cacheFolder, $filename);
} | php | static function SitemapCacheFile(Site $site)
{
$cacheFolder = Path::Combine(PHINE_PATH, 'App/Phine/Cache/Sitemap');
$filename = Path::AddExtension($site->GetID(), 'xml');
return Path::Combine($cacheFolder, $filename);
} | [
"static",
"function",
"SitemapCacheFile",
"(",
"Site",
"$",
"site",
")",
"{",
"$",
"cacheFolder",
"=",
"Path",
"::",
"Combine",
"(",
"PHINE_PATH",
",",
"'App/Phine/Cache/Sitemap'",
")",
";",
"$",
"filename",
"=",
"Path",
"::",
"AddExtension",
"(",
"$",
"site... | The name of the cache file of the
@param Site $site The site
@return string Returns the full file path of the sitemap cache file | [
"The",
"name",
"of",
"the",
"cache",
"file",
"of",
"the"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/PathUtil.php#L337-L342 | train |
agentmedia/phine-core | src/Core/Logic/Util/PathUtil.php | PathUtil.ContentCacheFile | static function ContentCacheFile(FrontendModule $module)
{
$file = $module->Content()->GetID();
$cacheKey = $module->CacheKey();
if ($cacheKey)
{
if (!ctype_alnum($cacheKey))
{
throw new \Exception(Trans('Core.CacheKey.Error.NotAlphaNumeric'));... | php | static function ContentCacheFile(FrontendModule $module)
{
$file = $module->Content()->GetID();
$cacheKey = $module->CacheKey();
if ($cacheKey)
{
if (!ctype_alnum($cacheKey))
{
throw new \Exception(Trans('Core.CacheKey.Error.NotAlphaNumeric'));... | [
"static",
"function",
"ContentCacheFile",
"(",
"FrontendModule",
"$",
"module",
")",
"{",
"$",
"file",
"=",
"$",
"module",
"->",
"Content",
"(",
")",
"->",
"GetID",
"(",
")",
";",
"$",
"cacheKey",
"=",
"$",
"module",
"->",
"CacheKey",
"(",
")",
";",
... | The name of the cache file
@param FrontendModule $module
@return string The name of the cache file, it needn't exist yet
@throws \Exception Raises an error in case the cache key is not alphanumeric | [
"The",
"name",
"of",
"the",
"cache",
"file"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/PathUtil.php#L349-L363 | train |
Kris-Kuiper/sFire-Framework | src/MVC/View.php | View.process | public function process($file) {
ob_start();
extract($this -> viewmodel -> getVariables(), EXTR_REFS);
include($file);
$this -> output = ob_get_clean();
return $this;
} | php | public function process($file) {
ob_start();
extract($this -> viewmodel -> getVariables(), EXTR_REFS);
include($file);
$this -> output = ob_get_clean();
return $this;
} | [
"public",
"function",
"process",
"(",
"$",
"file",
")",
"{",
"ob_start",
"(",
")",
";",
"extract",
"(",
"$",
"this",
"->",
"viewmodel",
"->",
"getVariables",
"(",
")",
",",
"EXTR_REFS",
")",
";",
"include",
"(",
"$",
"file",
")",
";",
"$",
"this",
... | Converts template code to output string
@param string $file
@return sFire\MVC\View | [
"Converts",
"template",
"code",
"to",
"output",
"string"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/MVC/View.php#L74-L82 | train |
Kris-Kuiper/sFire-Framework | src/MVC/View.php | View.escapeJs | public function escapeJs($string, $encoding = 'utf-8') {
$current = Escape :: getEncoding();
Escape :: setEncoding($encoding);
$result = Escape :: js($string);
Escape :: setEncoding($current);
return $result;
} | php | public function escapeJs($string, $encoding = 'utf-8') {
$current = Escape :: getEncoding();
Escape :: setEncoding($encoding);
$result = Escape :: js($string);
Escape :: setEncoding($current);
return $result;
} | [
"public",
"function",
"escapeJs",
"(",
"$",
"string",
",",
"$",
"encoding",
"=",
"'utf-8'",
")",
"{",
"$",
"current",
"=",
"Escape",
"::",
"getEncoding",
"(",
")",
";",
"Escape",
"::",
"setEncoding",
"(",
"$",
"encoding",
")",
";",
"$",
"result",
"=",
... | Escape a string for the Javascript context.
@param string $string
@return string | [
"Escape",
"a",
"string",
"for",
"the",
"Javascript",
"context",
"."
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/MVC/View.php#L131-L139 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.