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
rovangju/carbon-fy
src/CarbonExt/FiscalYear/Calculator.php
Calculator.get
public function get(Carbon $dt = NULL) { if (!$dt) { $dt = new Carbon(); } /* Disregard times */ $dt->setTime(0, 0, 0); /* FY is based on the -end- of the FY, thus we will work backward to determine if we need to 'rollup' the FY from the input year */ $fyStart = Carbon::create($dt->year, $this->month, $this->day, 0, 0, 0); $fyEnd = clone $fyStart; $fyEnd->addYear()->subDay(); if (!$dt->between($fyStart, $fyEnd, TRUE)) { $fyEnd->year($dt->year); } return $fyEnd; }
php
public function get(Carbon $dt = NULL) { if (!$dt) { $dt = new Carbon(); } /* Disregard times */ $dt->setTime(0, 0, 0); /* FY is based on the -end- of the FY, thus we will work backward to determine if we need to 'rollup' the FY from the input year */ $fyStart = Carbon::create($dt->year, $this->month, $this->day, 0, 0, 0); $fyEnd = clone $fyStart; $fyEnd->addYear()->subDay(); if (!$dt->between($fyStart, $fyEnd, TRUE)) { $fyEnd->year($dt->year); } return $fyEnd; }
[ "public", "function", "get", "(", "Carbon", "$", "dt", "=", "NULL", ")", "{", "if", "(", "!", "$", "dt", ")", "{", "$", "dt", "=", "new", "Carbon", "(", ")", ";", "}", "/* Disregard times */", "$", "dt", "->", "setTime", "(", "0", ",", "0", ","...
Get the FY end date @param Carbon $dt Date to determine FY for @return Carbon Carbon instance set to the end of the FY for the input
[ "Get", "the", "FY", "end", "date" ]
f8a59c24edf7874837c65a888d8a2632bd1a99f7
https://github.com/rovangju/carbon-fy/blob/f8a59c24edf7874837c65a888d8a2632bd1a99f7/src/CarbonExt/FiscalYear/Calculator.php#L33-L54
train
Riimu/Kit-BaseConversion
src/NumberBase.php
NumberBase.buildDigitList
private function buildDigitList($digitList) { if (is_int($digitList)) { return new IntegerDigitList($digitList); } elseif (is_string($digitList)) { return new StringDigitList($digitList); } elseif (is_array($digitList)) { return new ArrayDigitList($digitList); } throw new \InvalidArgumentException('Unexpected number base type'); }
php
private function buildDigitList($digitList) { if (is_int($digitList)) { return new IntegerDigitList($digitList); } elseif (is_string($digitList)) { return new StringDigitList($digitList); } elseif (is_array($digitList)) { return new ArrayDigitList($digitList); } throw new \InvalidArgumentException('Unexpected number base type'); }
[ "private", "function", "buildDigitList", "(", "$", "digitList", ")", "{", "if", "(", "is_int", "(", "$", "digitList", ")", ")", "{", "return", "new", "IntegerDigitList", "(", "$", "digitList", ")", ";", "}", "elseif", "(", "is_string", "(", "$", "digitLi...
Returns an appropriate type of digit list based on the parameter. @param int|string|array $digitList List of digits @return IntegerDigitList|StringDigitList|ArrayDigitList The built digit list
[ "Returns", "an", "appropriate", "type", "of", "digit", "list", "based", "on", "the", "parameter", "." ]
e0f486759590b69126c83622edd309217f783324
https://github.com/Riimu/Kit-BaseConversion/blob/e0f486759590b69126c83622edd309217f783324/src/NumberBase.php#L51-L62
train
Riimu/Kit-BaseConversion
src/NumberBase.php
NumberBase.hasDigit
public function hasDigit($digit) { try { $this->digits->getValue($digit); } catch (DigitList\InvalidDigitException $ex) { return false; } return true; }
php
public function hasDigit($digit) { try { $this->digits->getValue($digit); } catch (DigitList\InvalidDigitException $ex) { return false; } return true; }
[ "public", "function", "hasDigit", "(", "$", "digit", ")", "{", "try", "{", "$", "this", "->", "digits", "->", "getValue", "(", "$", "digit", ")", ";", "}", "catch", "(", "DigitList", "\\", "InvalidDigitException", "$", "ex", ")", "{", "return", "false"...
Tells if the given digit is part of this numeral system. @param mixed $digit The digit to look up @return bool True if the digit exists, false is not
[ "Tells", "if", "the", "given", "digit", "is", "part", "of", "this", "numeral", "system", "." ]
e0f486759590b69126c83622edd309217f783324
https://github.com/Riimu/Kit-BaseConversion/blob/e0f486759590b69126c83622edd309217f783324/src/NumberBase.php#L105-L114
train
Riimu/Kit-BaseConversion
src/NumberBase.php
NumberBase.getValues
public function getValues(array $digits) { $values = []; foreach ($digits as $digit) { $values[] = $this->digits->getValue($digit); } return $values; }
php
public function getValues(array $digits) { $values = []; foreach ($digits as $digit) { $values[] = $this->digits->getValue($digit); } return $values; }
[ "public", "function", "getValues", "(", "array", "$", "digits", ")", "{", "$", "values", "=", "[", "]", ";", "foreach", "(", "$", "digits", "as", "$", "digit", ")", "{", "$", "values", "[", "]", "=", "$", "this", "->", "digits", "->", "getValue", ...
Returns the decimal values for given digits. @param array $digits Array of digits to look up @return int[] Array of digit values @throws DigitList\InvalidDigitException If any of the digits is invalid
[ "Returns", "the", "decimal", "values", "for", "given", "digits", "." ]
e0f486759590b69126c83622edd309217f783324
https://github.com/Riimu/Kit-BaseConversion/blob/e0f486759590b69126c83622edd309217f783324/src/NumberBase.php#L133-L142
train
Riimu/Kit-BaseConversion
src/NumberBase.php
NumberBase.getDigits
public function getDigits(array $decimals) { $digits = []; foreach ($decimals as $decimal) { $digits[] = $this->digits->getDigit($decimal); } return $digits; }
php
public function getDigits(array $decimals) { $digits = []; foreach ($decimals as $decimal) { $digits[] = $this->digits->getDigit($decimal); } return $digits; }
[ "public", "function", "getDigits", "(", "array", "$", "decimals", ")", "{", "$", "digits", "=", "[", "]", ";", "foreach", "(", "$", "decimals", "as", "$", "decimal", ")", "{", "$", "digits", "[", "]", "=", "$", "this", "->", "digits", "->", "getDig...
Returns the digits representing the given decimal values. @param int[] $decimals Decimal values to look up @return array Array of digits that represent the given decimal values @throws \InvalidArgumentException If any of the decimal values is invalid
[ "Returns", "the", "digits", "representing", "the", "given", "decimal", "values", "." ]
e0f486759590b69126c83622edd309217f783324
https://github.com/Riimu/Kit-BaseConversion/blob/e0f486759590b69126c83622edd309217f783324/src/NumberBase.php#L161-L170
train
Riimu/Kit-BaseConversion
src/NumberBase.php
NumberBase.findCommonRadixRoot
public function findCommonRadixRoot(NumberBase $base) { $common = array_intersect($this->getRadixRoots(), $base->getRadixRoots()); return count($common) > 0 ? max($common) : false; }
php
public function findCommonRadixRoot(NumberBase $base) { $common = array_intersect($this->getRadixRoots(), $base->getRadixRoots()); return count($common) > 0 ? max($common) : false; }
[ "public", "function", "findCommonRadixRoot", "(", "NumberBase", "$", "base", ")", "{", "$", "common", "=", "array_intersect", "(", "$", "this", "->", "getRadixRoots", "(", ")", ",", "$", "base", "->", "getRadixRoots", "(", ")", ")", ";", "return", "count",...
Finds the largest integer root shared by the radix of both numeral systems. @param NumberBase $base Numeral system to compare against @return int|false Highest common integer root or false if none
[ "Finds", "the", "largest", "integer", "root", "shared", "by", "the", "radix", "of", "both", "numeral", "systems", "." ]
e0f486759590b69126c83622edd309217f783324
https://github.com/Riimu/Kit-BaseConversion/blob/e0f486759590b69126c83622edd309217f783324/src/NumberBase.php#L177-L182
train
Riimu/Kit-BaseConversion
src/NumberBase.php
NumberBase.getRadixRoots
private function getRadixRoots() { $radix = count($this->digits); $roots = [$radix]; for ($i = 2; ($root = (int) ($radix ** (1 / $i))) > 1; $i++) { if ($root ** $i === $radix) { $roots[] = $root; } } return $roots; }
php
private function getRadixRoots() { $radix = count($this->digits); $roots = [$radix]; for ($i = 2; ($root = (int) ($radix ** (1 / $i))) > 1; $i++) { if ($root ** $i === $radix) { $roots[] = $root; } } return $roots; }
[ "private", "function", "getRadixRoots", "(", ")", "{", "$", "radix", "=", "count", "(", "$", "this", "->", "digits", ")", ";", "$", "roots", "=", "[", "$", "radix", "]", ";", "for", "(", "$", "i", "=", "2", ";", "(", "$", "root", "=", "(", "i...
Returns all integer roots for the radix. @return int[] Array of integer roots for the radix
[ "Returns", "all", "integer", "roots", "for", "the", "radix", "." ]
e0f486759590b69126c83622edd309217f783324
https://github.com/Riimu/Kit-BaseConversion/blob/e0f486759590b69126c83622edd309217f783324/src/NumberBase.php#L188-L200
train
Riimu/Kit-BaseConversion
src/NumberBase.php
NumberBase.canonizeDigits
public function canonizeDigits(array $digits) { $result = $this->getDigits($this->getValues($digits)); return empty($result) ? [$this->digits->getDigit(0)] : $result; }
php
public function canonizeDigits(array $digits) { $result = $this->getDigits($this->getValues($digits)); return empty($result) ? [$this->digits->getDigit(0)] : $result; }
[ "public", "function", "canonizeDigits", "(", "array", "$", "digits", ")", "{", "$", "result", "=", "$", "this", "->", "getDigits", "(", "$", "this", "->", "getValues", "(", "$", "digits", ")", ")", ";", "return", "empty", "(", "$", "result", ")", "?"...
Replaces all values in the array with actual digits from the digit list. This method takes a list of digits and returns the digits properly capitalized and typed. This can be used to canonize numbers when dealing with case insensitive and loosely typed number bases. @param array $digits List of digits to canonize @return array Canonized list of digits @throws DigitList\InvalidDigitException If any of the digits are invalid
[ "Replaces", "all", "values", "in", "the", "array", "with", "actual", "digits", "from", "the", "digit", "list", "." ]
e0f486759590b69126c83622edd309217f783324
https://github.com/Riimu/Kit-BaseConversion/blob/e0f486759590b69126c83622edd309217f783324/src/NumberBase.php#L213-L218
train
Riimu/Kit-BaseConversion
src/NumberBase.php
NumberBase.splitString
public function splitString($string) { if ($this->digits->hasStringConflict()) { throw new \RuntimeException('The number base does not support string presentation'); } $pattern = $this->getDigitPattern(); if ((string) $string === '') { $digits = []; } elseif (is_int($pattern)) { $digits = str_split($string, $this->digitPattern); } else { preg_match_all($pattern, $string, $match); $digits = $match[0]; } return $this->canonizeDigits($digits); }
php
public function splitString($string) { if ($this->digits->hasStringConflict()) { throw new \RuntimeException('The number base does not support string presentation'); } $pattern = $this->getDigitPattern(); if ((string) $string === '') { $digits = []; } elseif (is_int($pattern)) { $digits = str_split($string, $this->digitPattern); } else { preg_match_all($pattern, $string, $match); $digits = $match[0]; } return $this->canonizeDigits($digits); }
[ "public", "function", "splitString", "(", "$", "string", ")", "{", "if", "(", "$", "this", "->", "digits", "->", "hasStringConflict", "(", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'The number base does not support string presentation'", ")", ...
Splits number string into individual digits. @param string $string String to split into array of digits @return array Array of digits @throws \RuntimeException If numeral system does not support strings
[ "Splits", "number", "string", "into", "individual", "digits", "." ]
e0f486759590b69126c83622edd309217f783324
https://github.com/Riimu/Kit-BaseConversion/blob/e0f486759590b69126c83622edd309217f783324/src/NumberBase.php#L226-L244
train
Riimu/Kit-BaseConversion
src/NumberBase.php
NumberBase.getDigitPattern
private function getDigitPattern() { if (!isset($this->digitPattern)) { $lengths = array_map('strlen', $this->digits->getDigits()); if (count(array_flip($lengths)) === 1) { $this->digitPattern = array_pop($lengths); } else { $this->digitPattern = sprintf( '(%s|.+)s%s', implode('|', array_map('preg_quote', $this->digits->getDigits())), $this->digits->isCaseSensitive() ? '' : 'i' ); } } return $this->digitPattern; }
php
private function getDigitPattern() { if (!isset($this->digitPattern)) { $lengths = array_map('strlen', $this->digits->getDigits()); if (count(array_flip($lengths)) === 1) { $this->digitPattern = array_pop($lengths); } else { $this->digitPattern = sprintf( '(%s|.+)s%s', implode('|', array_map('preg_quote', $this->digits->getDigits())), $this->digits->isCaseSensitive() ? '' : 'i' ); } } return $this->digitPattern; }
[ "private", "function", "getDigitPattern", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "digitPattern", ")", ")", "{", "$", "lengths", "=", "array_map", "(", "'strlen'", ",", "$", "this", "->", "digits", "->", "getDigits", "(", ")", ...
Creates and returns the pattern for splitting strings into digits. @return string|int Pattern to split strings into digits
[ "Creates", "and", "returns", "the", "pattern", "for", "splitting", "strings", "into", "digits", "." ]
e0f486759590b69126c83622edd309217f783324
https://github.com/Riimu/Kit-BaseConversion/blob/e0f486759590b69126c83622edd309217f783324/src/NumberBase.php#L250-L267
train
krystal-framework/krystal.framework
src/Krystal/Validate/ValidatorChain.php
ValidatorChain.isValid
public function isValid() { foreach ($this->validators as $validator) { if (!$validator->isValid()) { // Prepare error messages foreach ($validator->getErrors() as $name => $messages) { if (!isset($this->errors[$name])) { $this->errors[$name] = array(); } $this->errors[$name] = $messages; } } } return !$this->hasErrors(); }
php
public function isValid() { foreach ($this->validators as $validator) { if (!$validator->isValid()) { // Prepare error messages foreach ($validator->getErrors() as $name => $messages) { if (!isset($this->errors[$name])) { $this->errors[$name] = array(); } $this->errors[$name] = $messages; } } } return !$this->hasErrors(); }
[ "public", "function", "isValid", "(", ")", "{", "foreach", "(", "$", "this", "->", "validators", "as", "$", "validator", ")", "{", "if", "(", "!", "$", "validator", "->", "isValid", "(", ")", ")", "{", "// Prepare error messages", "foreach", "(", "$", ...
Runs the validation against all defined validators @return boolean
[ "Runs", "the", "validation", "against", "all", "defined", "validators" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Validate/ValidatorChain.php#L77-L93
train
cuevae/collection-json-php
src/Util/Href.php
Href.replace
public function replace( $key, $value ) { if($value === "" || is_null($value) || $value === false) { $this->url = preg_replace("#/{" . $key . "}.*$#", "", $this->getUrl()); } else { $this->url = str_replace("{" . $key . "}", $value, $this->getUrl()); } return $this; }
php
public function replace( $key, $value ) { if($value === "" || is_null($value) || $value === false) { $this->url = preg_replace("#/{" . $key . "}.*$#", "", $this->getUrl()); } else { $this->url = str_replace("{" . $key . "}", $value, $this->getUrl()); } return $this; }
[ "public", "function", "replace", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "$", "value", "===", "\"\"", "||", "is_null", "(", "$", "value", ")", "||", "$", "value", "===", "false", ")", "{", "$", "this", "->", "url", "=", "preg_rep...
Replace a substring for making URL templates @param $key @param $value @return Href
[ "Replace", "a", "substring", "for", "making", "URL", "templates" ]
d2d67eed0a4a8fb4e136d7cb9d7fa91937ee67b4
https://github.com/cuevae/collection-json-php/blob/d2d67eed0a4a8fb4e136d7cb9d7fa91937ee67b4/src/Util/Href.php#L76-L85
train
cuevae/collection-json-php
src/Util/Href.php
Href.validate
public function validate() { if (!$this->isValid( $this->getUrl() )) { throw new InvalidUrl( sprintf( '"%s" is not a valid url', $this->url ) ); } return $this; }
php
public function validate() { if (!$this->isValid( $this->getUrl() )) { throw new InvalidUrl( sprintf( '"%s" is not a valid url', $this->url ) ); } return $this; }
[ "public", "function", "validate", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isValid", "(", "$", "this", "->", "getUrl", "(", ")", ")", ")", "{", "throw", "new", "InvalidUrl", "(", "sprintf", "(", "'\"%s\" is not a valid url'", ",", "$", "this"...
Validate the url @return Href
[ "Validate", "the", "url" ]
d2d67eed0a4a8fb4e136d7cb9d7fa91937ee67b4
https://github.com/cuevae/collection-json-php/blob/d2d67eed0a4a8fb4e136d7cb9d7fa91937ee67b4/src/Util/Href.php#L92-L99
train
droath/project-x
src/Task/EventTaskBase.php
EventTaskBase.executeCommandHook
protected function executeCommandHook($method, $event_type) { foreach ($this->getCommandsByMethodEventType($method, $event_type) as $command) { if (is_string($command)) { $command = (new CommandHook()) ->setType('raw') ->setCommand($command); } elseif (is_array($command)) { $command = CommandHook::createWithData($command); } if (!$command instanceof CommandHookInterface) { continue; } switch ($command->getType()) { case 'symfony': $this->executeSymfonyCmdHook($command, $method); break; default: $this->executeEngineCmdHook($command); break; } } return $this; }
php
protected function executeCommandHook($method, $event_type) { foreach ($this->getCommandsByMethodEventType($method, $event_type) as $command) { if (is_string($command)) { $command = (new CommandHook()) ->setType('raw') ->setCommand($command); } elseif (is_array($command)) { $command = CommandHook::createWithData($command); } if (!$command instanceof CommandHookInterface) { continue; } switch ($command->getType()) { case 'symfony': $this->executeSymfonyCmdHook($command, $method); break; default: $this->executeEngineCmdHook($command); break; } } return $this; }
[ "protected", "function", "executeCommandHook", "(", "$", "method", ",", "$", "event_type", ")", "{", "foreach", "(", "$", "this", "->", "getCommandsByMethodEventType", "(", "$", "method", ",", "$", "event_type", ")", "as", "$", "command", ")", "{", "if", "...
Execute command hook. @param $method The task method command. @param $event_type The event type on which to execute. @return $this @throws \Psr\Container\ContainerExceptionInterface @throws \Psr\Container\NotFoundExceptionInterface
[ "Execute", "command", "hook", "." ]
85a7a4879bd041f4c5cb565356646e5f5e2435b7
https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/EventTaskBase.php#L39-L65
train
droath/project-x
src/Task/EventTaskBase.php
EventTaskBase.executeEngineCmdHook
protected function executeEngineCmdHook(CommandHookInterface $hook_command) { $options = $hook_command->getOptions(); // Determine the service the command should be ran inside. $service = isset($options['service']) ? $options['service'] : null; // Determine if the command should be ran locally. $localhost = (boolean) isset($options['localhost']) ? $options['localhost'] : !isset($service); $command = $this->resolveHookCommand($hook_command); return $this->executeEngineCommand($command, $service, [], false, $localhost); }
php
protected function executeEngineCmdHook(CommandHookInterface $hook_command) { $options = $hook_command->getOptions(); // Determine the service the command should be ran inside. $service = isset($options['service']) ? $options['service'] : null; // Determine if the command should be ran locally. $localhost = (boolean) isset($options['localhost']) ? $options['localhost'] : !isset($service); $command = $this->resolveHookCommand($hook_command); return $this->executeEngineCommand($command, $service, [], false, $localhost); }
[ "protected", "function", "executeEngineCmdHook", "(", "CommandHookInterface", "$", "hook_command", ")", "{", "$", "options", "=", "$", "hook_command", "->", "getOptions", "(", ")", ";", "// Determine the service the command should be ran inside.", "$", "service", "=", "...
Execute engine command hook. @param CommandHookInterface $hook_command The command hook object. @return \Robo\Result|\Robo\ResultData
[ "Execute", "engine", "command", "hook", "." ]
85a7a4879bd041f4c5cb565356646e5f5e2435b7
https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/EventTaskBase.php#L75-L92
train
droath/project-x
src/Task/EventTaskBase.php
EventTaskBase.resolveHookCommand
protected function resolveHookCommand(CommandHookInterface $command_hook) { $command = null; switch ($command_hook->getType()) { case 'raw': $command = $command_hook->getCommand(); break; case 'engine': $command = $this->getEngineCommand($command_hook); break; case 'project': $command = $this->getProjectCommand($command_hook); break; } return isset($command) ? $command : false; }
php
protected function resolveHookCommand(CommandHookInterface $command_hook) { $command = null; switch ($command_hook->getType()) { case 'raw': $command = $command_hook->getCommand(); break; case 'engine': $command = $this->getEngineCommand($command_hook); break; case 'project': $command = $this->getProjectCommand($command_hook); break; } return isset($command) ? $command : false; }
[ "protected", "function", "resolveHookCommand", "(", "CommandHookInterface", "$", "command_hook", ")", "{", "$", "command", "=", "null", ";", "switch", "(", "$", "command_hook", "->", "getType", "(", ")", ")", "{", "case", "'raw'", ":", "$", "command", "=", ...
Resolve hook command. @param CommandHookInterface $command_hook The command hook object. @return bool|CommandBuilder
[ "Resolve", "hook", "command", "." ]
85a7a4879bd041f4c5cb565356646e5f5e2435b7
https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/EventTaskBase.php#L102-L119
train
droath/project-x
src/Task/EventTaskBase.php
EventTaskBase.executeSymfonyCmdHook
protected function executeSymfonyCmdHook(CommandHookInterface $command_hook, $method) { $command = $command_hook->getCommand(); $container = ProjectX::getContainer(); $application = $container->get('application'); try { $info = $this->getCommandInfo($method); $command = $application->find($command); if ($command->getName() === $info->getName()) { throw new \Exception(sprintf( 'Unable to call the %s command hook due to it ' . 'invoking the parent method.', $command->getName() )); } } catch (CommandNotFoundException $exception) { throw new CommandHookRuntimeException(sprintf( 'Unable to find %s command in the project-x command ' . 'hook.', $command )); } catch (\Exception $exception) { throw new CommandHookRuntimeException($exception->getMessage()); } $exec = $this->taskSymfonyCommand($command); $definition = $command->getDefinition(); // Support symfony command options. if ($command_hook->hasOptions()) { foreach ($command_hook->getOptions() as $option => $value) { if (is_numeric($option)) { $option = $value; $value = null; } if (!$definition->hasOption($option)) { continue; } $exec->opt($option, $value); } } // Support symfony command arguments. if ($command_hook->hasArguments()) { foreach ($command_hook->getArguments() as $arg => $value) { if (!isset($value) || !$definition->hasArgument($arg)) { continue; } $exec->arg($arg, $value); } } return $exec->run(); }
php
protected function executeSymfonyCmdHook(CommandHookInterface $command_hook, $method) { $command = $command_hook->getCommand(); $container = ProjectX::getContainer(); $application = $container->get('application'); try { $info = $this->getCommandInfo($method); $command = $application->find($command); if ($command->getName() === $info->getName()) { throw new \Exception(sprintf( 'Unable to call the %s command hook due to it ' . 'invoking the parent method.', $command->getName() )); } } catch (CommandNotFoundException $exception) { throw new CommandHookRuntimeException(sprintf( 'Unable to find %s command in the project-x command ' . 'hook.', $command )); } catch (\Exception $exception) { throw new CommandHookRuntimeException($exception->getMessage()); } $exec = $this->taskSymfonyCommand($command); $definition = $command->getDefinition(); // Support symfony command options. if ($command_hook->hasOptions()) { foreach ($command_hook->getOptions() as $option => $value) { if (is_numeric($option)) { $option = $value; $value = null; } if (!$definition->hasOption($option)) { continue; } $exec->opt($option, $value); } } // Support symfony command arguments. if ($command_hook->hasArguments()) { foreach ($command_hook->getArguments() as $arg => $value) { if (!isset($value) || !$definition->hasArgument($arg)) { continue; } $exec->arg($arg, $value); } } return $exec->run(); }
[ "protected", "function", "executeSymfonyCmdHook", "(", "CommandHookInterface", "$", "command_hook", ",", "$", "method", ")", "{", "$", "command", "=", "$", "command_hook", "->", "getCommand", "(", ")", ";", "$", "container", "=", "ProjectX", "::", "getContainer"...
Execute symfony command hook. @param CommandHookInterface $command_hook @param $method @return \Robo\Result
[ "Execute", "symfony", "command", "hook", "." ]
85a7a4879bd041f4c5cb565356646e5f5e2435b7
https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/EventTaskBase.php#L129-L184
train
droath/project-x
src/Task/EventTaskBase.php
EventTaskBase.getProjectCommand
protected function getProjectCommand(CommandHookInterface $command_hook) { $method = $command_hook->getCommand(); $project = $this->getProjectInstance(); if (!method_exists($project, $method)) { throw new CommandHookRuntimeException( sprintf("The %s method doesn't exist on the project.", $method) ); } $args = array_merge( $command_hook->getOptions(), $command_hook->getArguments() ); return call_user_func_array([$project, $method], [$args]); }
php
protected function getProjectCommand(CommandHookInterface $command_hook) { $method = $command_hook->getCommand(); $project = $this->getProjectInstance(); if (!method_exists($project, $method)) { throw new CommandHookRuntimeException( sprintf("The %s method doesn't exist on the project.", $method) ); } $args = array_merge( $command_hook->getOptions(), $command_hook->getArguments() ); return call_user_func_array([$project, $method], [$args]); }
[ "protected", "function", "getProjectCommand", "(", "CommandHookInterface", "$", "command_hook", ")", "{", "$", "method", "=", "$", "command_hook", "->", "getCommand", "(", ")", ";", "$", "project", "=", "$", "this", "->", "getProjectInstance", "(", ")", ";", ...
Get project command. @param CommandHookInterface $command_hook @return CommandBuilder
[ "Get", "project", "command", "." ]
85a7a4879bd041f4c5cb565356646e5f5e2435b7
https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/EventTaskBase.php#L193-L209
train
droath/project-x
src/Task/EventTaskBase.php
EventTaskBase.getEngineCommand
protected function getEngineCommand(CommandHookInterface $command_hook) { $method = $command_hook->getCommand(); $engine = $this->getEngineInstance(); if (!method_exists($engine, $method)) { throw new CommandHookRuntimeException( sprintf("The %s method doesn't exist on the environment engine.", $method) ); } $args = array_merge( $command_hook->getOptions(), $command_hook->getArguments() ); return call_user_func_array([$engine, $method], [$args]); }
php
protected function getEngineCommand(CommandHookInterface $command_hook) { $method = $command_hook->getCommand(); $engine = $this->getEngineInstance(); if (!method_exists($engine, $method)) { throw new CommandHookRuntimeException( sprintf("The %s method doesn't exist on the environment engine.", $method) ); } $args = array_merge( $command_hook->getOptions(), $command_hook->getArguments() ); return call_user_func_array([$engine, $method], [$args]); }
[ "protected", "function", "getEngineCommand", "(", "CommandHookInterface", "$", "command_hook", ")", "{", "$", "method", "=", "$", "command_hook", "->", "getCommand", "(", ")", ";", "$", "engine", "=", "$", "this", "->", "getEngineInstance", "(", ")", ";", "i...
Get environment engine command. @param CommandHookInterface $command_hook @return CommandBuilder
[ "Get", "environment", "engine", "command", "." ]
85a7a4879bd041f4c5cb565356646e5f5e2435b7
https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/EventTaskBase.php#L218-L234
train
droath/project-x
src/Task/EventTaskBase.php
EventTaskBase.getCommandsByMethodEventType
protected function getCommandsByMethodEventType($method, $event_type) { $hooks = ProjectX::getProjectConfig()->getCommandHooks(); if (empty($hooks)) { return []; } $info = $this->getCommandInfo($method); list($command, $action) = explode(':', $info->getName()); if (!isset($hooks[$command][$action][$event_type])) { return []; } return $hooks[$command][$action][$event_type]; }
php
protected function getCommandsByMethodEventType($method, $event_type) { $hooks = ProjectX::getProjectConfig()->getCommandHooks(); if (empty($hooks)) { return []; } $info = $this->getCommandInfo($method); list($command, $action) = explode(':', $info->getName()); if (!isset($hooks[$command][$action][$event_type])) { return []; } return $hooks[$command][$action][$event_type]; }
[ "protected", "function", "getCommandsByMethodEventType", "(", "$", "method", ",", "$", "event_type", ")", "{", "$", "hooks", "=", "ProjectX", "::", "getProjectConfig", "(", ")", "->", "getCommandHooks", "(", ")", ";", "if", "(", "empty", "(", "$", "hooks", ...
Get commands by method event type. @param $method The executing method. @param $event_type The event type that's being executed. @return array An array of commands defined in project-x command hooks.
[ "Get", "commands", "by", "method", "event", "type", "." ]
85a7a4879bd041f4c5cb565356646e5f5e2435b7
https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/EventTaskBase.php#L247-L261
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.setDriversOrder
public function setDriversOrder(array $driversOrder) { foreach ($driversOrder as $driver) { if (!in_array($driver, $this->supportedDrivers)) { throw new RedisProxyException('Driver "' . $driver . '" is not supported'); } } $this->driversOrder = $driversOrder; return $this; }
php
public function setDriversOrder(array $driversOrder) { foreach ($driversOrder as $driver) { if (!in_array($driver, $this->supportedDrivers)) { throw new RedisProxyException('Driver "' . $driver . '" is not supported'); } } $this->driversOrder = $driversOrder; return $this; }
[ "public", "function", "setDriversOrder", "(", "array", "$", "driversOrder", ")", "{", "foreach", "(", "$", "driversOrder", "as", "$", "driver", ")", "{", "if", "(", "!", "in_array", "(", "$", "driver", ",", "$", "this", "->", "supportedDrivers", ")", ")"...
Set driver priorities - default is 1. redis, 2. predis @param array $driversOrder @return RedisProxy @throws RedisProxyException if some driver is not supported
[ "Set", "driver", "priorities", "-", "default", "is", "1", ".", "redis", "2", ".", "predis" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L102-L111
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.exists
public function exists($key) { $this->init(); $result = $this->driver->exists($key); return (bool)$result; }
php
public function exists($key) { $this->init(); $result = $this->driver->exists($key); return (bool)$result; }
[ "public", "function", "exists", "(", "$", "key", ")", "{", "$", "this", "->", "init", "(", ")", ";", "$", "result", "=", "$", "this", "->", "driver", "->", "exists", "(", "$", "key", ")", ";", "return", "(", "bool", ")", "$", "result", ";", "}"...
Determine if a key exists @param string $key @return boolean
[ "Determine", "if", "a", "key", "exists" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L231-L236
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.get
public function get($key) { $this->init(); $result = $this->driver->get($key); return $this->convertFalseToNull($result); }
php
public function get($key) { $this->init(); $result = $this->driver->get($key); return $this->convertFalseToNull($result); }
[ "public", "function", "get", "(", "$", "key", ")", "{", "$", "this", "->", "init", "(", ")", ";", "$", "result", "=", "$", "this", "->", "driver", "->", "get", "(", "$", "key", ")", ";", "return", "$", "this", "->", "convertFalseToNull", "(", "$"...
Get the value of a key @param string $key @return string|null null if key not set
[ "Get", "the", "value", "of", "a", "key" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L255-L260
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.getset
public function getset($key, $value) { $this->init(); $result = $this->driver->getset($key, $value); return $this->convertFalseToNull($result); }
php
public function getset($key, $value) { $this->init(); $result = $this->driver->getset($key, $value); return $this->convertFalseToNull($result); }
[ "public", "function", "getset", "(", "$", "key", ",", "$", "value", ")", "{", "$", "this", "->", "init", "(", ")", ";", "$", "result", "=", "$", "this", "->", "driver", "->", "getset", "(", "$", "key", ",", "$", "value", ")", ";", "return", "$"...
Set the string value of a key and return its old value @param string $key @param string $value @return string|null null if key was not set before
[ "Set", "the", "string", "value", "of", "a", "key", "and", "return", "its", "old", "value" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L268-L273
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.expire
public function expire($key, $seconds) { $this->init(); $result = $this->driver->expire($key, $seconds); return (bool)$result; }
php
public function expire($key, $seconds) { $this->init(); $result = $this->driver->expire($key, $seconds); return (bool)$result; }
[ "public", "function", "expire", "(", "$", "key", ",", "$", "seconds", ")", "{", "$", "this", "->", "init", "(", ")", ";", "$", "result", "=", "$", "this", "->", "driver", "->", "expire", "(", "$", "key", ",", "$", "seconds", ")", ";", "return", ...
Set a key's time to live in seconds @param string $key @param int $seconds @return boolean true if the timeout was set, false if key does not exist or the timeout could not be set
[ "Set", "a", "key", "s", "time", "to", "live", "in", "seconds" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L281-L286
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.pexpire
public function pexpire($key, $miliseconds) { $this->init(); $result = $this->driver->pexpire($key, $miliseconds); return (bool)$result; }
php
public function pexpire($key, $miliseconds) { $this->init(); $result = $this->driver->pexpire($key, $miliseconds); return (bool)$result; }
[ "public", "function", "pexpire", "(", "$", "key", ",", "$", "miliseconds", ")", "{", "$", "this", "->", "init", "(", ")", ";", "$", "result", "=", "$", "this", "->", "driver", "->", "pexpire", "(", "$", "key", ",", "$", "miliseconds", ")", ";", "...
Set a key's time to live in milliseconds @param string $key @param int $miliseconds @return boolean true if the timeout was set, false if key does not exist or the timeout could not be set
[ "Set", "a", "key", "s", "time", "to", "live", "in", "milliseconds" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L294-L299
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.expireat
public function expireat($key, $timestamp) { $this->init(); $result = $this->driver->expireat($key, $timestamp); return (bool)$result; }
php
public function expireat($key, $timestamp) { $this->init(); $result = $this->driver->expireat($key, $timestamp); return (bool)$result; }
[ "public", "function", "expireat", "(", "$", "key", ",", "$", "timestamp", ")", "{", "$", "this", "->", "init", "(", ")", ";", "$", "result", "=", "$", "this", "->", "driver", "->", "expireat", "(", "$", "key", ",", "$", "timestamp", ")", ";", "re...
Set the expiration for a key as a UNIX timestamp @param string $key @param int $timestamp @return boolean true if the timeout was set, false if key does not exist or the timeout could not be set
[ "Set", "the", "expiration", "for", "a", "key", "as", "a", "UNIX", "timestamp" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L307-L312
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.pexpireat
public function pexpireat($key, $milisecondsTimestamp) { $this->init(); $result = $this->driver->pexpireat($key, $milisecondsTimestamp); return (bool)$result; }
php
public function pexpireat($key, $milisecondsTimestamp) { $this->init(); $result = $this->driver->pexpireat($key, $milisecondsTimestamp); return (bool)$result; }
[ "public", "function", "pexpireat", "(", "$", "key", ",", "$", "milisecondsTimestamp", ")", "{", "$", "this", "->", "init", "(", ")", ";", "$", "result", "=", "$", "this", "->", "driver", "->", "pexpireat", "(", "$", "key", ",", "$", "milisecondsTimesta...
Set the expiration for a key as a UNIX timestamp specified in milliseconds @param string $key @param int $milisecondsTimestamp @return boolean true if the timeout was set, false if key does not exist or the timeout could not be set
[ "Set", "the", "expiration", "for", "a", "key", "as", "a", "UNIX", "timestamp", "specified", "in", "milliseconds" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L320-L325
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.psetex
public function psetex($key, $miliseconds, $value) { $this->init(); $result = $this->driver->psetex($key, $miliseconds, $value); if ($result == '+OK') { return true; } return $this->transformResult($result); }
php
public function psetex($key, $miliseconds, $value) { $this->init(); $result = $this->driver->psetex($key, $miliseconds, $value); if ($result == '+OK') { return true; } return $this->transformResult($result); }
[ "public", "function", "psetex", "(", "$", "key", ",", "$", "miliseconds", ",", "$", "value", ")", "{", "$", "this", "->", "init", "(", ")", ";", "$", "result", "=", "$", "this", "->", "driver", "->", "psetex", "(", "$", "key", ",", "$", "miliseco...
Set the value and expiration in milliseconds of a key @param string $key @param int $miliseconds @param string $value @return boolean
[ "Set", "the", "value", "and", "expiration", "in", "milliseconds", "of", "a", "key" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L334-L342
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.persist
public function persist($key) { $this->init(); $result = $this->driver->persist($key); return (bool)$result; }
php
public function persist($key) { $this->init(); $result = $this->driver->persist($key); return (bool)$result; }
[ "public", "function", "persist", "(", "$", "key", ")", "{", "$", "this", "->", "init", "(", ")", ";", "$", "result", "=", "$", "this", "->", "driver", "->", "persist", "(", "$", "key", ")", ";", "return", "(", "bool", ")", "$", "result", ";", "...
Remove the expiration from a key @param string $key @return boolean
[ "Remove", "the", "expiration", "from", "a", "key" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L349-L354
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.setnx
public function setnx($key, $value) { $this->init(); $result = $this->driver->setnx($key, $value); return (bool)$result; }
php
public function setnx($key, $value) { $this->init(); $result = $this->driver->setnx($key, $value); return (bool)$result; }
[ "public", "function", "setnx", "(", "$", "key", ",", "$", "value", ")", "{", "$", "this", "->", "init", "(", ")", ";", "$", "result", "=", "$", "this", "->", "driver", "->", "setnx", "(", "$", "key", ",", "$", "value", ")", ";", "return", "(", ...
Set the value of a key, only if the key does not exist @param string $key @param string $value @return boolean true if the key was set, false if the key was not set
[ "Set", "the", "value", "of", "a", "key", "only", "if", "the", "key", "does", "not", "exist" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L362-L367
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.incrby
public function incrby($key, $increment = 1) { $this->init(); return $this->driver->incrby($key, (int)$increment); }
php
public function incrby($key, $increment = 1) { $this->init(); return $this->driver->incrby($key, (int)$increment); }
[ "public", "function", "incrby", "(", "$", "key", ",", "$", "increment", "=", "1", ")", "{", "$", "this", "->", "init", "(", ")", ";", "return", "$", "this", "->", "driver", "->", "incrby", "(", "$", "key", ",", "(", "int", ")", "$", "increment", ...
Increment the integer value of a key by the given amount @param string $key @param integer $increment @return integer
[ "Increment", "the", "integer", "value", "of", "a", "key", "by", "the", "given", "amount" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L408-L412
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.incrbyfloat
public function incrbyfloat($key, $increment = 1) { $this->init(); return $this->driver->incrbyfloat($key, $increment); }
php
public function incrbyfloat($key, $increment = 1) { $this->init(); return $this->driver->incrbyfloat($key, $increment); }
[ "public", "function", "incrbyfloat", "(", "$", "key", ",", "$", "increment", "=", "1", ")", "{", "$", "this", "->", "init", "(", ")", ";", "return", "$", "this", "->", "driver", "->", "incrbyfloat", "(", "$", "key", ",", "$", "increment", ")", ";",...
Increment the float value of a key by the given amount @param string $key @param float $increment @return float
[ "Increment", "the", "float", "value", "of", "a", "key", "by", "the", "given", "amount" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L420-L424
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.decrby
public function decrby($key, $decrement = 1) { $this->init(); return $this->driver->decrby($key, (int)$decrement); }
php
public function decrby($key, $decrement = 1) { $this->init(); return $this->driver->decrby($key, (int)$decrement); }
[ "public", "function", "decrby", "(", "$", "key", ",", "$", "decrement", "=", "1", ")", "{", "$", "this", "->", "init", "(", ")", ";", "return", "$", "this", "->", "driver", "->", "decrby", "(", "$", "key", ",", "(", "int", ")", "$", "decrement", ...
Decrement the integer value of a key by the given number @param string $key @param integer $decrement @return integer
[ "Decrement", "the", "integer", "value", "of", "a", "key", "by", "the", "given", "number" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L443-L447
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.dump
public function dump($key) { $this->init(); $result = $this->driver->dump($key); return $this->convertFalseToNull($result); }
php
public function dump($key) { $this->init(); $result = $this->driver->dump($key); return $this->convertFalseToNull($result); }
[ "public", "function", "dump", "(", "$", "key", ")", "{", "$", "this", "->", "init", "(", ")", ";", "$", "result", "=", "$", "this", "->", "driver", "->", "dump", "(", "$", "key", ")", ";", "return", "$", "this", "->", "convertFalseToNull", "(", "...
Return a serialized version of the value stored at the specified key @param string $key @return string|null serialized value, null if key doesn't exist
[ "Return", "a", "serialized", "version", "of", "the", "value", "stored", "at", "the", "specified", "key" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L465-L470
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.mset
public function mset(...$dictionary) { $this->init(); if (is_array($dictionary[0])) { $result = $this->driver->mset(...$dictionary); return $this->transformResult($result); } $dictionary = $this->prepareKeyValue($dictionary, 'mset'); $result = $this->driver->mset($dictionary); return $this->transformResult($result); }
php
public function mset(...$dictionary) { $this->init(); if (is_array($dictionary[0])) { $result = $this->driver->mset(...$dictionary); return $this->transformResult($result); } $dictionary = $this->prepareKeyValue($dictionary, 'mset'); $result = $this->driver->mset($dictionary); return $this->transformResult($result); }
[ "public", "function", "mset", "(", "...", "$", "dictionary", ")", "{", "$", "this", "->", "init", "(", ")", ";", "if", "(", "is_array", "(", "$", "dictionary", "[", "0", "]", ")", ")", "{", "$", "result", "=", "$", "this", "->", "driver", "->", ...
Set multiple values to multiple keys @param array $dictionary @return boolean true on success @throws RedisProxyException if number of arguments is wrong
[ "Set", "multiple", "values", "to", "multiple", "keys" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L478-L488
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.hdel
public function hdel($key, ...$fields) { $fields = $this->prepareArguments('hdel', ...$fields); $this->init(); return $this->driver->hdel($key, ...$fields); }
php
public function hdel($key, ...$fields) { $fields = $this->prepareArguments('hdel', ...$fields); $this->init(); return $this->driver->hdel($key, ...$fields); }
[ "public", "function", "hdel", "(", "$", "key", ",", "...", "$", "fields", ")", "{", "$", "fields", "=", "$", "this", "->", "prepareArguments", "(", "'hdel'", ",", "...", "$", "fields", ")", ";", "$", "this", "->", "init", "(", ")", ";", "return", ...
Delete one or more hash fields, returns number of deleted fields @param string $key @param array $fields @return int
[ "Delete", "one", "or", "more", "hash", "fields", "returns", "number", "of", "deleted", "fields" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L546-L551
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.hincrby
public function hincrby($key, $field, $increment = 1) { $this->init(); return $this->driver->hincrby($key, $field, (int)$increment); }
php
public function hincrby($key, $field, $increment = 1) { $this->init(); return $this->driver->hincrby($key, $field, (int)$increment); }
[ "public", "function", "hincrby", "(", "$", "key", ",", "$", "field", ",", "$", "increment", "=", "1", ")", "{", "$", "this", "->", "init", "(", ")", ";", "return", "$", "this", "->", "driver", "->", "hincrby", "(", "$", "key", ",", "$", "field", ...
Increment the integer value of hash field by given number @param string $key @param string $field @param int $increment @return int
[ "Increment", "the", "integer", "value", "of", "hash", "field", "by", "given", "number" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L560-L564
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.hincrbyfloat
public function hincrbyfloat($key, $field, $increment = 1) { $this->init(); return $this->driver->hincrbyfloat($key, $field, $increment); }
php
public function hincrbyfloat($key, $field, $increment = 1) { $this->init(); return $this->driver->hincrbyfloat($key, $field, $increment); }
[ "public", "function", "hincrbyfloat", "(", "$", "key", ",", "$", "field", ",", "$", "increment", "=", "1", ")", "{", "$", "this", "->", "init", "(", ")", ";", "return", "$", "this", "->", "driver", "->", "hincrbyfloat", "(", "$", "key", ",", "$", ...
Increment the float value of hash field by given amount @param string $key @param string $field @param float $increment @return float
[ "Increment", "the", "float", "value", "of", "hash", "field", "by", "given", "amount" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L573-L577
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.hmset
public function hmset($key, ...$dictionary) { $this->init(); if (is_array($dictionary[0])) { $result = $this->driver->hmset($key, ...$dictionary); return $this->transformResult($result); } $dictionary = $this->prepareKeyValue($dictionary, 'hmset'); $result = $this->driver->hmset($key, $dictionary); return $this->transformResult($result); }
php
public function hmset($key, ...$dictionary) { $this->init(); if (is_array($dictionary[0])) { $result = $this->driver->hmset($key, ...$dictionary); return $this->transformResult($result); } $dictionary = $this->prepareKeyValue($dictionary, 'hmset'); $result = $this->driver->hmset($key, $dictionary); return $this->transformResult($result); }
[ "public", "function", "hmset", "(", "$", "key", ",", "...", "$", "dictionary", ")", "{", "$", "this", "->", "init", "(", ")", ";", "if", "(", "is_array", "(", "$", "dictionary", "[", "0", "]", ")", ")", "{", "$", "result", "=", "$", "this", "->...
Set multiple values to multiple hash fields @param string $key @param array $dictionary @return boolean true on success @throws RedisProxyException if number of arguments is wrong
[ "Set", "multiple", "values", "to", "multiple", "hash", "fields" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L586-L596
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.hmget
public function hmget($key, ...$fields) { $fields = array_unique($this->prepareArguments('hmget', ...$fields)); $this->init(); $values = []; foreach ($this->driver->hmget($key, $fields) as $value) { $values[] = $this->convertFalseToNull($value); } return array_combine($fields, $values); }
php
public function hmget($key, ...$fields) { $fields = array_unique($this->prepareArguments('hmget', ...$fields)); $this->init(); $values = []; foreach ($this->driver->hmget($key, $fields) as $value) { $values[] = $this->convertFalseToNull($value); } return array_combine($fields, $values); }
[ "public", "function", "hmget", "(", "$", "key", ",", "...", "$", "fields", ")", "{", "$", "fields", "=", "array_unique", "(", "$", "this", "->", "prepareArguments", "(", "'hmget'", ",", "...", "$", "fields", ")", ")", ";", "$", "this", "->", "init", ...
Multi hash get @param string $key @param array $fields @return array Returns the values for all specified fields. For every field that does not hold a string value or does not exist, null is returned
[ "Multi", "hash", "get" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L604-L613
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.sadd
public function sadd($key, ...$members) { $members = $this->prepareArguments('sadd', ...$members); $this->init(); return $this->driver->sadd($key, ...$members); }
php
public function sadd($key, ...$members) { $members = $this->prepareArguments('sadd', ...$members); $this->init(); return $this->driver->sadd($key, ...$members); }
[ "public", "function", "sadd", "(", "$", "key", ",", "...", "$", "members", ")", "{", "$", "members", "=", "$", "this", "->", "prepareArguments", "(", "'sadd'", ",", "...", "$", "members", ")", ";", "$", "this", "->", "init", "(", ")", ";", "return"...
Add one or more members to a set @param string $key @param array $members @return int number of new members added to set
[ "Add", "one", "or", "more", "members", "to", "a", "set" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L643-L648
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.spop
public function spop($key, $count = 1) { $this->init(); if ($count == 1 || $count === null) { $result = $this->driver->spop($key); return $this->convertFalseToNull($result); } $members = []; for ($i = 0; $i < $count; ++$i) { $member = $this->driver->spop($key); if (!$member) { break; } $members[] = $member; } return empty($members) ? null : $members; }
php
public function spop($key, $count = 1) { $this->init(); if ($count == 1 || $count === null) { $result = $this->driver->spop($key); return $this->convertFalseToNull($result); } $members = []; for ($i = 0; $i < $count; ++$i) { $member = $this->driver->spop($key); if (!$member) { break; } $members[] = $member; } return empty($members) ? null : $members; }
[ "public", "function", "spop", "(", "$", "key", ",", "$", "count", "=", "1", ")", "{", "$", "this", "->", "init", "(", ")", ";", "if", "(", "$", "count", "==", "1", "||", "$", "count", "===", "null", ")", "{", "$", "result", "=", "$", "this", ...
Remove and return one or multiple random members from a set @param string $key @param int $count number of members @return mixed string if $count is null or 1 and $key exists, array if $count > 1 and $key exists, null if $key doesn't exist
[ "Remove", "and", "return", "one", "or", "multiple", "random", "members", "from", "a", "set" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L656-L673
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.sscan
public function sscan($key, &$iterator, $pattern = null, $count = null) { if ((string)$iterator === '0') { return null; } $this->init(); if ($this->actualDriver() === self::DRIVER_PREDIS) { $returned = $this->driver->sscan($key, $iterator, ['match' => $pattern, 'count' => $count]); $iterator = $returned[0]; return $returned[1]; } return $this->driver->sscan($key, $iterator, $pattern, $count); }
php
public function sscan($key, &$iterator, $pattern = null, $count = null) { if ((string)$iterator === '0') { return null; } $this->init(); if ($this->actualDriver() === self::DRIVER_PREDIS) { $returned = $this->driver->sscan($key, $iterator, ['match' => $pattern, 'count' => $count]); $iterator = $returned[0]; return $returned[1]; } return $this->driver->sscan($key, $iterator, $pattern, $count); }
[ "public", "function", "sscan", "(", "$", "key", ",", "&", "$", "iterator", ",", "$", "pattern", "=", "null", ",", "$", "count", "=", "null", ")", "{", "if", "(", "(", "string", ")", "$", "iterator", "===", "'0'", ")", "{", "return", "null", ";", ...
Incrementally iterate Set elements @param string $key @param mixed $iterator iterator / cursor, use $iterator = null for start scanning, when $iterator is changed to 0 or '0', scanning is finished @param string $pattern pattern for member's values, use * as wild card @param int $count @return array|boolean|null list of found members, returns null if $iterator is 0 or '0'
[ "Incrementally", "iterate", "Set", "elements" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L683-L695
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.rpush
public function rpush($key, ...$elements) { $elements = $this->prepareArguments('rpush', ...$elements); $this->init(); return $this->driver->rpush($key, ...$elements); }
php
public function rpush($key, ...$elements) { $elements = $this->prepareArguments('rpush', ...$elements); $this->init(); return $this->driver->rpush($key, ...$elements); }
[ "public", "function", "rpush", "(", "$", "key", ",", "...", "$", "elements", ")", "{", "$", "elements", "=", "$", "this", "->", "prepareArguments", "(", "'rpush'", ",", "...", "$", "elements", ")", ";", "$", "this", "->", "init", "(", ")", ";", "re...
Append one or multiple values to a list @param string $key @param array $elements @return int the length of the list after the push operations
[ "Append", "one", "or", "multiple", "values", "to", "a", "list" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L716-L721
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.lpop
public function lpop($key) { $this->init(); $result = $this->driver->lpop($key); return $this->convertFalseToNull($result); }
php
public function lpop($key) { $this->init(); $result = $this->driver->lpop($key); return $this->convertFalseToNull($result); }
[ "public", "function", "lpop", "(", "$", "key", ")", "{", "$", "this", "->", "init", "(", ")", ";", "$", "result", "=", "$", "this", "->", "driver", "->", "lpop", "(", "$", "key", ")", ";", "return", "$", "this", "->", "convertFalseToNull", "(", "...
Remove and get the first element in a list @param string $key @return string|null
[ "Remove", "and", "get", "the", "first", "element", "in", "a", "list" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L728-L733
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.rpop
public function rpop($key) { $this->init(); $result = $this->driver->rpop($key); return $this->convertFalseToNull($result); }
php
public function rpop($key) { $this->init(); $result = $this->driver->rpop($key); return $this->convertFalseToNull($result); }
[ "public", "function", "rpop", "(", "$", "key", ")", "{", "$", "this", "->", "init", "(", ")", ";", "$", "result", "=", "$", "this", "->", "driver", "->", "rpop", "(", "$", "key", ")", ";", "return", "$", "this", "->", "convertFalseToNull", "(", "...
Remove and get the last element in a list @param string $key @return string|null
[ "Remove", "and", "get", "the", "last", "element", "in", "a", "list" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L740-L745
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.zadd
public function zadd($key, ...$dictionary) { $this->init(); if (is_array($dictionary[0])) { $return = 0; foreach ($dictionary[0] as $member => $score) { $res = $this->zadd($key, $score, $member); $return += $res; } return $return; } return $this->driver->zadd($key, ...$dictionary); }
php
public function zadd($key, ...$dictionary) { $this->init(); if (is_array($dictionary[0])) { $return = 0; foreach ($dictionary[0] as $member => $score) { $res = $this->zadd($key, $score, $member); $return += $res; } return $return; } return $this->driver->zadd($key, ...$dictionary); }
[ "public", "function", "zadd", "(", "$", "key", ",", "...", "$", "dictionary", ")", "{", "$", "this", "->", "init", "(", ")", ";", "if", "(", "is_array", "(", "$", "dictionary", "[", "0", "]", ")", ")", "{", "$", "return", "=", "0", ";", "foreac...
Add one or more members to a sorted set, or update its score if it already exists @param string $key @param array $dictionary (score1, member1[, score2, member2]) or associative array: [member1 => score1, member2 => score2] @return int
[ "Add", "one", "or", "more", "members", "to", "a", "sorted", "set", "or", "update", "its", "score", "if", "it", "already", "exists" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L766-L778
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.zrevrange
public function zrevrange($key, $start, $stop, $withscores = false) { $this->init(); if ($this->actualDriver() === self::DRIVER_PREDIS) { return $this->driver->zrevrange($key, $start, $stop, ['WITHSCORES' => $withscores]); } return $this->driver->zrevrange($key, $start, $stop, $withscores); }
php
public function zrevrange($key, $start, $stop, $withscores = false) { $this->init(); if ($this->actualDriver() === self::DRIVER_PREDIS) { return $this->driver->zrevrange($key, $start, $stop, ['WITHSCORES' => $withscores]); } return $this->driver->zrevrange($key, $start, $stop, $withscores); }
[ "public", "function", "zrevrange", "(", "$", "key", ",", "$", "start", ",", "$", "stop", ",", "$", "withscores", "=", "false", ")", "{", "$", "this", "->", "init", "(", ")", ";", "if", "(", "$", "this", "->", "actualDriver", "(", ")", "===", "sel...
Return a range of members in a sorted set, by index, with scores ordered from high to low @param string $key @param int $start @param int $stop @param boolean $withscores @return array
[ "Return", "a", "range", "of", "members", "in", "a", "sorted", "set", "by", "index", "with", "scores", "ordered", "from", "high", "to", "low" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L827-L834
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.convertFalseToNull
private function convertFalseToNull($result) { return $this->actualDriver() === self::DRIVER_REDIS && $result === false ? null : $result; }
php
private function convertFalseToNull($result) { return $this->actualDriver() === self::DRIVER_REDIS && $result === false ? null : $result; }
[ "private", "function", "convertFalseToNull", "(", "$", "result", ")", "{", "return", "$", "this", "->", "actualDriver", "(", ")", "===", "self", "::", "DRIVER_REDIS", "&&", "$", "result", "===", "false", "?", "null", ":", "$", "result", ";", "}" ]
Returns null instead of false for Redis driver @param mixed $result @return mixed
[ "Returns", "null", "instead", "of", "false", "for", "Redis", "driver" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L867-L870
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.transformResult
private function transformResult($result) { if ($this->actualDriver() === self::DRIVER_PREDIS && $result instanceof Status) { $result = $result->getPayload() === 'OK'; } return $result; }
php
private function transformResult($result) { if ($this->actualDriver() === self::DRIVER_PREDIS && $result instanceof Status) { $result = $result->getPayload() === 'OK'; } return $result; }
[ "private", "function", "transformResult", "(", "$", "result", ")", "{", "if", "(", "$", "this", "->", "actualDriver", "(", ")", "===", "self", "::", "DRIVER_PREDIS", "&&", "$", "result", "instanceof", "Status", ")", "{", "$", "result", "=", "$", "result"...
Transforms Predis result Payload to boolean @param mixed $result @return mixed
[ "Transforms", "Predis", "result", "Payload", "to", "boolean" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L877-L883
train
lulco/redis-proxy
src/RedisProxy.php
RedisProxy.prepareKeyValue
private function prepareKeyValue(array $dictionary, $command) { $keys = array_values(array_filter($dictionary, function ($key) { return $key % 2 == 0; }, ARRAY_FILTER_USE_KEY)); $values = array_values(array_filter($dictionary, function ($key) { return $key % 2 == 1; }, ARRAY_FILTER_USE_KEY)); if (count($keys) != count($values)) { throw new RedisProxyException("Wrong number of arguments for $command command"); } return array_combine($keys, $values); }
php
private function prepareKeyValue(array $dictionary, $command) { $keys = array_values(array_filter($dictionary, function ($key) { return $key % 2 == 0; }, ARRAY_FILTER_USE_KEY)); $values = array_values(array_filter($dictionary, function ($key) { return $key % 2 == 1; }, ARRAY_FILTER_USE_KEY)); if (count($keys) != count($values)) { throw new RedisProxyException("Wrong number of arguments for $command command"); } return array_combine($keys, $values); }
[ "private", "function", "prepareKeyValue", "(", "array", "$", "dictionary", ",", "$", "command", ")", "{", "$", "keys", "=", "array_values", "(", "array_filter", "(", "$", "dictionary", ",", "function", "(", "$", "key", ")", "{", "return", "$", "key", "%"...
Create array from input array - odd keys are used as keys, even keys are used as values @param array $dictionary @param string $command @return array @throws RedisProxyException if number of keys is not the same as number of values
[ "Create", "array", "from", "input", "array", "-", "odd", "keys", "are", "used", "as", "keys", "even", "keys", "are", "used", "as", "values" ]
968d28b7b26673c6100ad8f3180241181b8207ab
https://github.com/lulco/redis-proxy/blob/968d28b7b26673c6100ad8f3180241181b8207ab/src/RedisProxy.php#L892-L905
train
krystal-framework/krystal.framework
src/Krystal/Stdlib/Dumper.php
Dumper.dump
public static function dump($variable, $exit = true) { if (is_object($variable) && method_exists($variable, '__toString')) { echo $variable; } else { if (is_bool($variable)) { var_dump($variable); } else { $text = sprintf('<pre>%s</pre>', print_r($variable, true)); print $text; } } if ($exit === true) { exit(); } }
php
public static function dump($variable, $exit = true) { if (is_object($variable) && method_exists($variable, '__toString')) { echo $variable; } else { if (is_bool($variable)) { var_dump($variable); } else { $text = sprintf('<pre>%s</pre>', print_r($variable, true)); print $text; } } if ($exit === true) { exit(); } }
[ "public", "static", "function", "dump", "(", "$", "variable", ",", "$", "exit", "=", "true", ")", "{", "if", "(", "is_object", "(", "$", "variable", ")", "&&", "method_exists", "(", "$", "variable", ",", "'__toString'", ")", ")", "{", "echo", "$", "v...
Dumps a variable @param mixed $variable @param boolean $exit Whether to terminate script execution @return void
[ "Dumps", "a", "variable" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Stdlib/Dumper.php#L23-L40
train
manusreload/GLFramework
src/Bootstrap.php
Bootstrap.router
public static function router($directory, $config = 'config.yml') { $request = Server::get('PHP_SELF'); $root = Server::get('DOCUMENT_ROOT'); $file = $root . $request; if(file_exists($file) && !is_dir($file)) { return false; } else { Bootstrap::start($directory, $config); return true; } }
php
public static function router($directory, $config = 'config.yml') { $request = Server::get('PHP_SELF'); $root = Server::get('DOCUMENT_ROOT'); $file = $root . $request; if(file_exists($file) && !is_dir($file)) { return false; } else { Bootstrap::start($directory, $config); return true; } }
[ "public", "static", "function", "router", "(", "$", "directory", ",", "$", "config", "=", "'config.yml'", ")", "{", "$", "request", "=", "Server", "::", "get", "(", "'PHP_SELF'", ")", ";", "$", "root", "=", "Server", "::", "get", "(", "'DOCUMENT_ROOT'", ...
Simple script router @param $directory @param string $config @return bool
[ "Simple", "script", "router" ]
6867bdf22482cff4e92adbba6849818860228104
https://github.com/manusreload/GLFramework/blob/6867bdf22482cff4e92adbba6849818860228104/src/Bootstrap.php#L177-L192
train
manusreload/GLFramework
src/Bootstrap.php
Bootstrap.init
public function init() { Profiler::start('init', 'init'); $this->initTime = microtime(true); $this->init = true; Log::d('Initializing framework...'); // $this->register_error_handler(); date_default_timezone_set('Europe/Madrid'); $this->setupLanguage(); Profiler::stop('init'); $this->manager = new ModuleManager($this->config, $this->directory); $this->manager->init(); Log::d('Module manager initialized'); $this->inited = true; // Log::d('Modules initialized: ' . count($this->manager->getModules())); // Log::d(array_map(function ($a) { // return $a->title; // }, $this->manager->getModules())); }
php
public function init() { Profiler::start('init', 'init'); $this->initTime = microtime(true); $this->init = true; Log::d('Initializing framework...'); // $this->register_error_handler(); date_default_timezone_set('Europe/Madrid'); $this->setupLanguage(); Profiler::stop('init'); $this->manager = new ModuleManager($this->config, $this->directory); $this->manager->init(); Log::d('Module manager initialized'); $this->inited = true; // Log::d('Modules initialized: ' . count($this->manager->getModules())); // Log::d(array_map(function ($a) { // return $a->title; // }, $this->manager->getModules())); }
[ "public", "function", "init", "(", ")", "{", "Profiler", "::", "start", "(", "'init'", ",", "'init'", ")", ";", "$", "this", "->", "initTime", "=", "microtime", "(", "true", ")", ";", "$", "this", "->", "init", "=", "true", ";", "Log", "::", "d", ...
Inicializar la apliacion de forma interna
[ "Inicializar", "la", "apliacion", "de", "forma", "interna" ]
6867bdf22482cff4e92adbba6849818860228104
https://github.com/manusreload/GLFramework/blob/6867bdf22482cff4e92adbba6849818860228104/src/Bootstrap.php#L243-L263
train
manusreload/GLFramework
src/Bootstrap.php
Bootstrap.install
public function install() { define('GL_INSTALL', true); $this->init(); echo '<pre>'; $fail = false; $db = new DatabaseManager(); if ($db->connectAndSelect()) { $this->setDatabase($db); $this->log('Connection to database ok'); $this->log('Installing Database...'); $models = $this->getModels(); foreach ($models as $model) { $instance = new $model(null); if ($instance instanceof Model) { $diff = $instance->getStructureDifferences($db, isset($_GET['drop'])); $this->log('Installing table \'' . $instance->getTableName() . '\' generated by ' . get_class($instance) . '...', 2); foreach ($diff as $action) { $this->log('Action: ' . $action['sql'] . '...', 3, false); if (isset($_GET['exec'])) { try { DBStructure::runAction($db, $instance, $action); $this->log('[OK]', 0); } catch (\Exception $ex) { $this->log('[FAIL]', 0); $fail = true; } } echo "\n"; } } } if (!isset($_GET['exec'])) { $this->log('Please <a href="?exec">click here</a> to make this changes in the database.'); } else { $db2 = new DBStructure(); $db2->setDatabaseUpdate(); $this->log('All done site ready for develop/production!'); } } else { if ($db->getConnection() !== null) { if (isset($_GET['create_database'])) { if ($db->exec('CREATE DATABASE ' . $this->config['database']['database'])) { echo 'Database created successful! Please reload the navigator'; } else { echo 'Can not create the database!'; } } else { echo 'Can\'t select the database <a href="install.php?create_database">Try to create database</a>'; } } else { echo 'Cannot connect to database'; } } }
php
public function install() { define('GL_INSTALL', true); $this->init(); echo '<pre>'; $fail = false; $db = new DatabaseManager(); if ($db->connectAndSelect()) { $this->setDatabase($db); $this->log('Connection to database ok'); $this->log('Installing Database...'); $models = $this->getModels(); foreach ($models as $model) { $instance = new $model(null); if ($instance instanceof Model) { $diff = $instance->getStructureDifferences($db, isset($_GET['drop'])); $this->log('Installing table \'' . $instance->getTableName() . '\' generated by ' . get_class($instance) . '...', 2); foreach ($diff as $action) { $this->log('Action: ' . $action['sql'] . '...', 3, false); if (isset($_GET['exec'])) { try { DBStructure::runAction($db, $instance, $action); $this->log('[OK]', 0); } catch (\Exception $ex) { $this->log('[FAIL]', 0); $fail = true; } } echo "\n"; } } } if (!isset($_GET['exec'])) { $this->log('Please <a href="?exec">click here</a> to make this changes in the database.'); } else { $db2 = new DBStructure(); $db2->setDatabaseUpdate(); $this->log('All done site ready for develop/production!'); } } else { if ($db->getConnection() !== null) { if (isset($_GET['create_database'])) { if ($db->exec('CREATE DATABASE ' . $this->config['database']['database'])) { echo 'Database created successful! Please reload the navigator'; } else { echo 'Can not create the database!'; } } else { echo 'Can\'t select the database <a href="install.php?create_database">Try to create database</a>'; } } else { echo 'Cannot connect to database'; } } }
[ "public", "function", "install", "(", ")", "{", "define", "(", "'GL_INSTALL'", ",", "true", ")", ";", "$", "this", "->", "init", "(", ")", ";", "echo", "'<pre>'", ";", "$", "fail", "=", "false", ";", "$", "db", "=", "new", "DatabaseManager", "(", "...
Instala la base de datos con los modelos actualmente cargados en el init @deprecated Since 0.2.0 @throws \Exception
[ "Instala", "la", "base", "de", "datos", "con", "los", "modelos", "actualmente", "cargados", "en", "el", "init" ]
6867bdf22482cff4e92adbba6849818860228104
https://github.com/manusreload/GLFramework/blob/6867bdf22482cff4e92adbba6849818860228104/src/Bootstrap.php#L396-L453
train
krystal-framework/krystal.framework
src/Krystal/InstanceManager/InstanceBuilder.php
InstanceBuilder.build
public function build($class, array $args) { // Normalize class name $class = $this->normalizeClassName($class); if (isset($this->cache[$class])) { return $this->cache[$class]; } else { if (class_exists($class, true)) { $instance = $this->getInstance($class, $args); $this->cache[$class] = $instance; return $instance; } else { throw new RuntimeException(sprintf( 'Can not build non-existing class "%s". The class does not exist or it does not follow PSR-0', $class )); } } }
php
public function build($class, array $args) { // Normalize class name $class = $this->normalizeClassName($class); if (isset($this->cache[$class])) { return $this->cache[$class]; } else { if (class_exists($class, true)) { $instance = $this->getInstance($class, $args); $this->cache[$class] = $instance; return $instance; } else { throw new RuntimeException(sprintf( 'Can not build non-existing class "%s". The class does not exist or it does not follow PSR-0', $class )); } } }
[ "public", "function", "build", "(", "$", "class", ",", "array", "$", "args", ")", "{", "// Normalize class name", "$", "class", "=", "$", "this", "->", "normalizeClassName", "(", "$", "class", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "cach...
Builds an instance of a class passing arguments to its constructor @param string $class PSR-0 compliant class name @param array $args Arguments to be passed to class's constructor @throws \RuntimeException If attempting to build non-existing class @return object
[ "Builds", "an", "instance", "of", "a", "class", "passing", "arguments", "to", "its", "constructor" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/InstanceManager/InstanceBuilder.php#L34-L53
train
krystal-framework/krystal.framework
src/Krystal/InstanceManager/InstanceBuilder.php
InstanceBuilder.getInstance
private function getInstance($class, array $args) { // Hack to avoid Reflection for most cases switch (count($args)) { case 0: return new $class; case 1: return new $class($args[0]); case 2: return new $class($args[0], $args[1]); case 3: return new $class($args[0], $args[1], $args[2]); case 4: return new $class($args[0], $args[1], $args[2], $args[3]); case 5: return new $class($args[0], $args[1], $args[2], $args[3], $args[4]); case 6: return new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]); default: $reflection = new ReflectionClass(); return $reflection->newInstanceArgs($args); } }
php
private function getInstance($class, array $args) { // Hack to avoid Reflection for most cases switch (count($args)) { case 0: return new $class; case 1: return new $class($args[0]); case 2: return new $class($args[0], $args[1]); case 3: return new $class($args[0], $args[1], $args[2]); case 4: return new $class($args[0], $args[1], $args[2], $args[3]); case 5: return new $class($args[0], $args[1], $args[2], $args[3], $args[4]); case 6: return new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]); default: $reflection = new ReflectionClass(); return $reflection->newInstanceArgs($args); } }
[ "private", "function", "getInstance", "(", "$", "class", ",", "array", "$", "args", ")", "{", "// Hack to avoid Reflection for most cases", "switch", "(", "count", "(", "$", "args", ")", ")", "{", "case", "0", ":", "return", "new", "$", "class", ";", "case...
Builds and returns an instance of a class @param string $class PSR-0 compliant class name @param array $args Arguments to be passed to class's constructor @return object
[ "Builds", "and", "returns", "an", "instance", "of", "a", "class" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/InstanceManager/InstanceBuilder.php#L76-L98
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.locateApacheServer
public function locateApacheServer() : bool { if ($this->getApacheCtl()) { $this->getApacheInfo(); $this->getApacheInstancesPath(); $this->getPHPModule(); } return $this->apachectl !== false && $this->apache_config_path !== false; }
php
public function locateApacheServer() : bool { if ($this->getApacheCtl()) { $this->getApacheInfo(); $this->getApacheInstancesPath(); $this->getPHPModule(); } return $this->apachectl !== false && $this->apache_config_path !== false; }
[ "public", "function", "locateApacheServer", "(", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "getApacheCtl", "(", ")", ")", "{", "$", "this", "->", "getApacheInfo", "(", ")", ";", "$", "this", "->", "getApacheInstancesPath", "(", ")", ";", "$"...
Locates Apache HTTP Server instance running in the S.O. @return bool Returns true if success.
[ "Locates", "Apache", "HTTP", "Server", "instance", "running", "in", "the", "S", ".", "O", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L80-L89
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.getApacheCtl
public function getApacheCtl() { if ($this->apachectl === false) { $shell = new CNabuShell(); $response = array(); if ($shell->exec('whereis apachectl', null, $response) && count($response) === 1) { $parts = preg_split('/\\s/', preg_replace('/^apachectl: /', '', $response[0])); $this->apachectl = $parts[0]; } } return $this->apachectl; }
php
public function getApacheCtl() { if ($this->apachectl === false) { $shell = new CNabuShell(); $response = array(); if ($shell->exec('whereis apachectl', null, $response) && count($response) === 1) { $parts = preg_split('/\\s/', preg_replace('/^apachectl: /', '', $response[0])); $this->apachectl = $parts[0]; } } return $this->apachectl; }
[ "public", "function", "getApacheCtl", "(", ")", "{", "if", "(", "$", "this", "->", "apachectl", "===", "false", ")", "{", "$", "shell", "=", "new", "CNabuShell", "(", ")", ";", "$", "response", "=", "array", "(", ")", ";", "if", "(", "$", "shell", ...
Locates the Apache Control Application full path installed in the S.O. @return string|false Returns the full path if success or false if error.
[ "Locates", "the", "Apache", "Control", "Application", "full", "path", "installed", "in", "the", "S", ".", "O", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L95-L107
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.getApacheInfo
public function getApacheInfo() { if ($this->apachectl !== false) { $shell = new CNabuShell(); $response = array(); if ($shell->exec($this->apachectl, array('-V' => ''), $response)) { $this->parseApacheInfo($response); } } }
php
public function getApacheInfo() { if ($this->apachectl !== false) { $shell = new CNabuShell(); $response = array(); if ($shell->exec($this->apachectl, array('-V' => ''), $response)) { $this->parseApacheInfo($response); } } }
[ "public", "function", "getApacheInfo", "(", ")", "{", "if", "(", "$", "this", "->", "apachectl", "!==", "false", ")", "{", "$", "shell", "=", "new", "CNabuShell", "(", ")", ";", "$", "response", "=", "array", "(", ")", ";", "if", "(", "$", "shell",...
Gets Apache Information about installed Apache HTTP Server.
[ "Gets", "Apache", "Information", "about", "installed", "Apache", "HTTP", "Server", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L112-L121
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.parseApacheInfo
private function parseApacheInfo(array $data = null) { $this->apache_info = null; if (is_array($data) && count($data) > 0) { foreach ($data as $line) { $this->interpretApacheInfoData($line) || $this->interpretApacheInfoVariable($line); } } }
php
private function parseApacheInfo(array $data = null) { $this->apache_info = null; if (is_array($data) && count($data) > 0) { foreach ($data as $line) { $this->interpretApacheInfoData($line) || $this->interpretApacheInfoVariable($line); } } }
[ "private", "function", "parseApacheInfo", "(", "array", "$", "data", "=", "null", ")", "{", "$", "this", "->", "apache_info", "=", "null", ";", "if", "(", "is_array", "(", "$", "data", ")", "&&", "count", "(", "$", "data", ")", ">", "0", ")", "{", ...
Parse Apache Information lines to get valid values. @param array|null $data Array of lines to parse.
[ "Parse", "Apache", "Information", "lines", "to", "get", "valid", "values", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L127-L137
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.getApacheInstancesPath
public function getApacheInstancesPath() { if ($this->apache_config_path === false && is_array($this->apache_compiles) && array_key_exists('SERVER_CONFIG_FILE', $this->apache_compiles) ) { $config_file = $this->apache_compiles['SERVER_CONFIG_FILE']; if (is_file($config_file)) { $base_path = dirname($config_file); if (is_dir($base_path . DIRECTORY_SEPARATOR . 'other')) { $this->apache_config_path = $base_path . DIRECTORY_SEPARATOR . 'other'; } elseif (is_dir($base_path . DIRECTORY_SEPARATOR . 'conf.d')) { $this->apache_config_path = $base_path . DIRECTORY_SEPARATOR . 'conf.d'; } } elseif (array_key_exists('HTTPD_ROOT', $this->apache_compiles)) { $base_path = preg_replace('/"$/', '', preg_replace('/^"/', '', $this->apache_compiles['HTTPD_ROOT'])); if (is_dir($base_path . DIRECTORY_SEPARATOR . 'conf.d')) { $this->apache_config_path = $base_path . DIRECTORY_SEPARATOR . 'conf.d'; } elseif (is_dir($base_path . DIRECTORY_SEPARATOR . 'other')) { $this->apache_config_path = $base_path . DIRECTORY_SEPARATOR . 'other'; } } } return $this->apache_config_path; }
php
public function getApacheInstancesPath() { if ($this->apache_config_path === false && is_array($this->apache_compiles) && array_key_exists('SERVER_CONFIG_FILE', $this->apache_compiles) ) { $config_file = $this->apache_compiles['SERVER_CONFIG_FILE']; if (is_file($config_file)) { $base_path = dirname($config_file); if (is_dir($base_path . DIRECTORY_SEPARATOR . 'other')) { $this->apache_config_path = $base_path . DIRECTORY_SEPARATOR . 'other'; } elseif (is_dir($base_path . DIRECTORY_SEPARATOR . 'conf.d')) { $this->apache_config_path = $base_path . DIRECTORY_SEPARATOR . 'conf.d'; } } elseif (array_key_exists('HTTPD_ROOT', $this->apache_compiles)) { $base_path = preg_replace('/"$/', '', preg_replace('/^"/', '', $this->apache_compiles['HTTPD_ROOT'])); if (is_dir($base_path . DIRECTORY_SEPARATOR . 'conf.d')) { $this->apache_config_path = $base_path . DIRECTORY_SEPARATOR . 'conf.d'; } elseif (is_dir($base_path . DIRECTORY_SEPARATOR . 'other')) { $this->apache_config_path = $base_path . DIRECTORY_SEPARATOR . 'other'; } } } return $this->apache_config_path; }
[ "public", "function", "getApacheInstancesPath", "(", ")", "{", "if", "(", "$", "this", "->", "apache_config_path", "===", "false", "&&", "is_array", "(", "$", "this", "->", "apache_compiles", ")", "&&", "array_key_exists", "(", "'SERVER_CONFIG_FILE'", ",", "$", ...
Get the Apache Instances Path. @return string|false Returns the path if exists or false elsewhere.
[ "Get", "the", "Apache", "Instances", "Path", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L189-L214
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.interpretApacheInfoVariable
private function interpretApacheInfoVariable(string $line) { $content = preg_split('/^\\s+-D\\s+/', $line, 2); if (count($content) === 2) { $parts = preg_split('/=/', $content[1], 2); if (count($parts) === 2) { $this->apache_compiles[$parts[0]] = str_replace('"', '', $parts[1]); } elseif (count($parts) === 1) { $this->apache_compiles[$content[1]] = true; } } }
php
private function interpretApacheInfoVariable(string $line) { $content = preg_split('/^\\s+-D\\s+/', $line, 2); if (count($content) === 2) { $parts = preg_split('/=/', $content[1], 2); if (count($parts) === 2) { $this->apache_compiles[$parts[0]] = str_replace('"', '', $parts[1]); } elseif (count($parts) === 1) { $this->apache_compiles[$content[1]] = true; } } }
[ "private", "function", "interpretApacheInfoVariable", "(", "string", "$", "line", ")", "{", "$", "content", "=", "preg_split", "(", "'/^\\\\s+-D\\\\s+/'", ",", "$", "line", ",", "2", ")", ";", "if", "(", "count", "(", "$", "content", ")", "===", "2", ")"...
Interpret Apache Infromation Variable line. @param string $line Line of Intormation to be interpreted.
[ "Interpret", "Apache", "Infromation", "Variable", "line", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L220-L231
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.getServerVersion
public function getServerVersion() : string { return (is_array($this->apache_info) && array_key_exists('server-version', $this->apache_info)) ? $this->apache_info['server-version'] : 'Unknown' ; }
php
public function getServerVersion() : string { return (is_array($this->apache_info) && array_key_exists('server-version', $this->apache_info)) ? $this->apache_info['server-version'] : 'Unknown' ; }
[ "public", "function", "getServerVersion", "(", ")", ":", "string", "{", "return", "(", "is_array", "(", "$", "this", "->", "apache_info", ")", "&&", "array_key_exists", "(", "'server-version'", ",", "$", "this", "->", "apache_info", ")", ")", "?", "$", "th...
Gets the Apache HTTP Server Version. @return string Returns the version string or 'Unknown' if no version is available.
[ "Gets", "the", "Apache", "HTTP", "Server", "Version", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L237-L243
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.createStandaloneConfiguration
public function createStandaloneConfiguration() : bool { $retval = false; if ($this->apache_config_path) { $file = new CApacheStandaloneFile($this, $this->nb_server, $this->nb_site); $file->create(); $file->exportToFile($this->apache_config_path . DIRECTORY_SEPARATOR . self::APACHE_CONFIG_FILENAME); $retval = true; } return $retval; }
php
public function createStandaloneConfiguration() : bool { $retval = false; if ($this->apache_config_path) { $file = new CApacheStandaloneFile($this, $this->nb_server, $this->nb_site); $file->create(); $file->exportToFile($this->apache_config_path . DIRECTORY_SEPARATOR . self::APACHE_CONFIG_FILENAME); $retval = true; } return $retval; }
[ "public", "function", "createStandaloneConfiguration", "(", ")", ":", "bool", "{", "$", "retval", "=", "false", ";", "if", "(", "$", "this", "->", "apache_config_path", ")", "{", "$", "file", "=", "new", "CApacheStandaloneFile", "(", "$", "this", ",", "$",...
Creates the Standalone Configuration files. @return bool Return true if success.
[ "Creates", "the", "Standalone", "Configuration", "files", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L272-L284
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.createHostedConfiguration
public function createHostedConfiguration() : bool { $retval = false; if ($this->apache_config_path) { $index_list = $this->nb_server->getSitesIndex(); $index_list->iterate( function ($site_key, $nb_site) { $this->createHostedFile($nb_site); return true; } ); $this->createHostedIndex($index_list); $retval = true; } return $retval; }
php
public function createHostedConfiguration() : bool { $retval = false; if ($this->apache_config_path) { $index_list = $this->nb_server->getSitesIndex(); $index_list->iterate( function ($site_key, $nb_site) { $this->createHostedFile($nb_site); return true; } ); $this->createHostedIndex($index_list); $retval = true; } return $retval; }
[ "public", "function", "createHostedConfiguration", "(", ")", ":", "bool", "{", "$", "retval", "=", "false", ";", "if", "(", "$", "this", "->", "apache_config_path", ")", "{", "$", "index_list", "=", "$", "this", "->", "nb_server", "->", "getSitesIndex", "(...
Creates the Hosted Configuration files. @return bool Return true if success.
[ "Creates", "the", "Hosted", "Configuration", "files", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L290-L308
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.createClusteredConfiguration
public function createClusteredConfiguration() { $retval = false; if ($this->apache_config_path) { $index_list = $this->nb_server->getSitesIndex(); $index_list->iterate( function ($site_key, $nb_site) { $this->createSiteFolders($nb_site); $this->createClusteredFile($nb_site); return true; } ); $this->createClusteredIndex($index_list); $retval = true; } return $retval; }
php
public function createClusteredConfiguration() { $retval = false; if ($this->apache_config_path) { $index_list = $this->nb_server->getSitesIndex(); $index_list->iterate( function ($site_key, $nb_site) { $this->createSiteFolders($nb_site); $this->createClusteredFile($nb_site); return true; } ); $this->createClusteredIndex($index_list); $retval = true; } return $retval; }
[ "public", "function", "createClusteredConfiguration", "(", ")", "{", "$", "retval", "=", "false", ";", "if", "(", "$", "this", "->", "apache_config_path", ")", "{", "$", "index_list", "=", "$", "this", "->", "nb_server", "->", "getSitesIndex", "(", ")", ";...
Creates the Clustered Configuration files. @return bool Return true if success.
[ "Creates", "the", "Clustered", "Configuration", "files", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L314-L333
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.createHostedIndex
private function createHostedIndex(CNabuSiteList $index_list) { $index = new CApacheHostedIndex($this, $index_list); $index->create(); $index->exportToFile($this->apache_config_path . DIRECTORY_SEPARATOR . self::APACHE_CONFIG_FILENAME); }
php
private function createHostedIndex(CNabuSiteList $index_list) { $index = new CApacheHostedIndex($this, $index_list); $index->create(); $index->exportToFile($this->apache_config_path . DIRECTORY_SEPARATOR . self::APACHE_CONFIG_FILENAME); }
[ "private", "function", "createHostedIndex", "(", "CNabuSiteList", "$", "index_list", ")", "{", "$", "index", "=", "new", "CApacheHostedIndex", "(", "$", "this", ",", "$", "index_list", ")", ";", "$", "index", "->", "create", "(", ")", ";", "$", "index", ...
Create Hosted hosts index file. @param CNabuSiteList $index_list List of Sites to be listed.
[ "Create", "Hosted", "hosts", "index", "file", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L339-L344
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.createClusteredIndex
private function createClusteredIndex(CNabuSiteList $index_list) { $index = new CApacheClusteredIndex($this, $index_list); $index->create(); $index->exportToFile($this->apache_config_path . DIRECTORY_SEPARATOR . self::APACHE_CONFIG_FILENAME); }
php
private function createClusteredIndex(CNabuSiteList $index_list) { $index = new CApacheClusteredIndex($this, $index_list); $index->create(); $index->exportToFile($this->apache_config_path . DIRECTORY_SEPARATOR . self::APACHE_CONFIG_FILENAME); }
[ "private", "function", "createClusteredIndex", "(", "CNabuSiteList", "$", "index_list", ")", "{", "$", "index", "=", "new", "CApacheClusteredIndex", "(", "$", "this", ",", "$", "index_list", ")", ";", "$", "index", "->", "create", "(", ")", ";", "$", "inde...
Create Clustered hosts index file. @param CNabuSiteList $index_list List of Sites to be listed.
[ "Create", "Clustered", "hosts", "index", "file", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L350-L355
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.createHostedFile
private function createHostedFile(CNabuSite $nb_site) { $file = new CApacheHostedFile($this, $this->nb_server, $nb_site); $file->create(); $path = $this->nb_server->getVirtualHostsPath() . DIRECTORY_SEPARATOR . $nb_site->getBasePath() . NABU_VHOST_CONFIG_FOLDER . DIRECTORY_SEPARATOR . $this->nb_server->getKey() ; if (!is_dir($path)) { mkdir($path, 0755, true); } if (!is_dir($path)) { throw new ENabuCoreException(ENabuCoreException::ERROR_FOLDER_NOT_FOUND, array($path)); } $filename = $path . DIRECTORY_SEPARATOR . NABU_VHOST_CONFIG_FILENAME; $file->exportToFile($filename); }
php
private function createHostedFile(CNabuSite $nb_site) { $file = new CApacheHostedFile($this, $this->nb_server, $nb_site); $file->create(); $path = $this->nb_server->getVirtualHostsPath() . DIRECTORY_SEPARATOR . $nb_site->getBasePath() . NABU_VHOST_CONFIG_FOLDER . DIRECTORY_SEPARATOR . $this->nb_server->getKey() ; if (!is_dir($path)) { mkdir($path, 0755, true); } if (!is_dir($path)) { throw new ENabuCoreException(ENabuCoreException::ERROR_FOLDER_NOT_FOUND, array($path)); } $filename = $path . DIRECTORY_SEPARATOR . NABU_VHOST_CONFIG_FILENAME; $file->exportToFile($filename); }
[ "private", "function", "createHostedFile", "(", "CNabuSite", "$", "nb_site", ")", "{", "$", "file", "=", "new", "CApacheHostedFile", "(", "$", "this", ",", "$", "this", "->", "nb_server", ",", "$", "nb_site", ")", ";", "$", "file", "->", "create", "(", ...
Create Hosted per Site file configuration. @param CNabuSite $nb_site Site to create configuration.
[ "Create", "Hosted", "per", "Site", "file", "configuration", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L361-L380
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.createClusteredFile
private function createClusteredFile(CNabuSite $nb_site) { $file = new CApacheClusteredFile($this, $this->nb_server, $nb_site); $file->create(); $path = self::NABU_APACHE_ETC_PATH . DIRECTORY_SEPARATOR . $nb_site->getBasePath(); if (!is_dir($path)) { mkdir($path, 0755, true); } if (!is_dir($path)) { throw new ENabuCoreException(ENabuCoreException::ERROR_FOLDER_NOT_FOUND, array($path)); } $filename = $path . DIRECTORY_SEPARATOR . NABU_VHOST_CONFIG_FILENAME; $file->exportToFile($filename); }
php
private function createClusteredFile(CNabuSite $nb_site) { $file = new CApacheClusteredFile($this, $this->nb_server, $nb_site); $file->create(); $path = self::NABU_APACHE_ETC_PATH . DIRECTORY_SEPARATOR . $nb_site->getBasePath(); if (!is_dir($path)) { mkdir($path, 0755, true); } if (!is_dir($path)) { throw new ENabuCoreException(ENabuCoreException::ERROR_FOLDER_NOT_FOUND, array($path)); } $filename = $path . DIRECTORY_SEPARATOR . NABU_VHOST_CONFIG_FILENAME; $file->exportToFile($filename); }
[ "private", "function", "createClusteredFile", "(", "CNabuSite", "$", "nb_site", ")", "{", "$", "file", "=", "new", "CApacheClusteredFile", "(", "$", "this", ",", "$", "this", "->", "nb_server", ",", "$", "nb_site", ")", ";", "$", "file", "->", "create", ...
Create Clustered per Site file configuration. @param CNabuSite $nb_site Site to create configuration.
[ "Create", "Clustered", "per", "Site", "file", "configuration", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L386-L400
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.validatePath
private function validatePath(string $path) : string { if (!is_dir($path) && !mkdir($path, 0755, true)) { throw new ENabuCoreException(ENabuCoreException::ERROR_HOST_PATH_NOT_FOUND, array($path)); } return $path; }
php
private function validatePath(string $path) : string { if (!is_dir($path) && !mkdir($path, 0755, true)) { throw new ENabuCoreException(ENabuCoreException::ERROR_HOST_PATH_NOT_FOUND, array($path)); } return $path; }
[ "private", "function", "validatePath", "(", "string", "$", "path", ")", ":", "string", "{", "if", "(", "!", "is_dir", "(", "$", "path", ")", "&&", "!", "mkdir", "(", "$", "path", ",", "0755", ",", "true", ")", ")", "{", "throw", "new", "ENabuCoreEx...
Validates a path to ensure that it exists and is available. If not exists tries to create it. @param string $path Path to validate. @return string Returns the path for convenience. @throws ENabuCoreException Raises an exception if the path does not exists.
[ "Validates", "a", "path", "to", "ensure", "that", "it", "exists", "and", "is", "available", ".", "If", "not", "exists", "tries", "to", "create", "it", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L408-L415
train
nabu-3/provider-apache-httpd
servers/CApacheHTTPServerInterface.php
CApacheHTTPServerInterface.createSiteFolders
public function createSiteFolders(CNabuSite $nb_site) : bool { $vhosts_path = $this->validatePath($this->nb_server->getVirtualHostsPath()); $vlib_path = $this->validatePath($this->nb_server->getVirtualLibrariesPath()); $vcache_path = $this->validatePath($this->nb_server->getVirtualCachePath()); $nb_cluster_user = $nb_site->getClusterUser(); if ($nb_cluster_user === null) { throw new ENabuCoreException(ENabuCoreException::ERROR_OBJECT_EXPECTED); } $nb_cluster_user_group = $nb_cluster_user->getGroup(); if ($nb_cluster_user_group === null) { throw new ENabuCoreException(ENabuCoreException::ERROR_OBJECT_EXPECTED); } $owner_name = $nb_cluster_user->getOSNick(); $owner_group = $nb_cluster_user_group->getOSNick(); $vhosts_path = $nb_site->getVirtualHostPath($this->nb_server); if (!is_dir($vhosts_path)) { if (!mkdir($vhosts_path, 0755, true)) { throw new ENabuCoreException(ENabuCoreException::ERROR_HOST_PATH_NOT_FOUND, array($vhosts_path)); } else { chown($vhosts_path, $owner_name); chgrp($vhosts_path, $owner_group); } } $vlib_path = $nb_site->getVirtualLibrariesPath($this->nb_server); if (!is_dir($vlib_path)) { if (!mkdir($vlib_path, 0755, true)) { throw new ENabuCoreException(ENabuCoreException::ERROR_HOST_PATH_NOT_FOUND, array($vlib_path)); } else { chown($vlib_path, APACHE_HTTPD_SYS_USER); chgrp($vlib_path, $owner_group); } } $vcache_path = $nb_site->getVirtualCachePath($this->nb_server); if (!is_dir($vcache_path)) { if (!mkdir($vcache_path, 0755, true)) { throw new ENabuCoreException(ENabuCoreException::ERROR_HOST_PATH_NOT_FOUND, array($vcache_path)); } else { chown($vcache_path, APACHE_HTTPD_SYS_USER); chgrp($vcache_path, $owner_group); } } return true; }
php
public function createSiteFolders(CNabuSite $nb_site) : bool { $vhosts_path = $this->validatePath($this->nb_server->getVirtualHostsPath()); $vlib_path = $this->validatePath($this->nb_server->getVirtualLibrariesPath()); $vcache_path = $this->validatePath($this->nb_server->getVirtualCachePath()); $nb_cluster_user = $nb_site->getClusterUser(); if ($nb_cluster_user === null) { throw new ENabuCoreException(ENabuCoreException::ERROR_OBJECT_EXPECTED); } $nb_cluster_user_group = $nb_cluster_user->getGroup(); if ($nb_cluster_user_group === null) { throw new ENabuCoreException(ENabuCoreException::ERROR_OBJECT_EXPECTED); } $owner_name = $nb_cluster_user->getOSNick(); $owner_group = $nb_cluster_user_group->getOSNick(); $vhosts_path = $nb_site->getVirtualHostPath($this->nb_server); if (!is_dir($vhosts_path)) { if (!mkdir($vhosts_path, 0755, true)) { throw new ENabuCoreException(ENabuCoreException::ERROR_HOST_PATH_NOT_FOUND, array($vhosts_path)); } else { chown($vhosts_path, $owner_name); chgrp($vhosts_path, $owner_group); } } $vlib_path = $nb_site->getVirtualLibrariesPath($this->nb_server); if (!is_dir($vlib_path)) { if (!mkdir($vlib_path, 0755, true)) { throw new ENabuCoreException(ENabuCoreException::ERROR_HOST_PATH_NOT_FOUND, array($vlib_path)); } else { chown($vlib_path, APACHE_HTTPD_SYS_USER); chgrp($vlib_path, $owner_group); } } $vcache_path = $nb_site->getVirtualCachePath($this->nb_server); if (!is_dir($vcache_path)) { if (!mkdir($vcache_path, 0755, true)) { throw new ENabuCoreException(ENabuCoreException::ERROR_HOST_PATH_NOT_FOUND, array($vcache_path)); } else { chown($vcache_path, APACHE_HTTPD_SYS_USER); chgrp($vcache_path, $owner_group); } } return true; }
[ "public", "function", "createSiteFolders", "(", "CNabuSite", "$", "nb_site", ")", ":", "bool", "{", "$", "vhosts_path", "=", "$", "this", "->", "validatePath", "(", "$", "this", "->", "nb_server", "->", "getVirtualHostsPath", "(", ")", ")", ";", "$", "vlib...
Create Site Folders for the requested Site. @param CNabuSite $nb_site Site instance to create folders. @return bool Returns true if all required folders exists. @throws ENabuCoreException Raises an exception if a folder cannot be available. @todo Refactor this method to use CNabuHTTPFileSystem
[ "Create", "Site", "Folders", "for", "the", "requested", "Site", "." ]
122f6190f9fb25baae12f4efb70f01241c1417c8
https://github.com/nabu-3/provider-apache-httpd/blob/122f6190f9fb25baae12f4efb70f01241c1417c8/servers/CApacheHTTPServerInterface.php#L424-L470
train
i-lateral/silverstripe-checkout
code/control/Checkout_Controller.php
Checkout_Controller.index
public function index() { // If we are using simple checkout, skip if (Checkout::config()->simple_checkout) { return $this->redirect($this->Link('finish')); } // If we have turned off login, or member logged in if (!(Checkout::config()->login_form) || Member::currentUserID()) { return $this->redirect($this->Link('billing')); } $this->customise(array( 'Title' => _t('Checkout.SignIn', "Sign in"), "Login" => true, 'LoginForm' => $this->LoginForm() )); $this->extend("onBeforeIndex"); return $this->renderWith(array( 'Checkout', 'Page' )); }
php
public function index() { // If we are using simple checkout, skip if (Checkout::config()->simple_checkout) { return $this->redirect($this->Link('finish')); } // If we have turned off login, or member logged in if (!(Checkout::config()->login_form) || Member::currentUserID()) { return $this->redirect($this->Link('billing')); } $this->customise(array( 'Title' => _t('Checkout.SignIn', "Sign in"), "Login" => true, 'LoginForm' => $this->LoginForm() )); $this->extend("onBeforeIndex"); return $this->renderWith(array( 'Checkout', 'Page' )); }
[ "public", "function", "index", "(", ")", "{", "// If we are using simple checkout, skip", "if", "(", "Checkout", "::", "config", "(", ")", "->", "simple_checkout", ")", "{", "return", "$", "this", "->", "redirect", "(", "$", "this", "->", "Link", "(", "'fini...
If user logged in, redirect to billing info, else show login, register or "checkout as guest" options.
[ "If", "user", "logged", "in", "redirect", "to", "billing", "info", "else", "show", "login", "register", "or", "checkout", "as", "guest", "options", "." ]
2089b57ac2b7feb86dccde8a6864ae70ce463497
https://github.com/i-lateral/silverstripe-checkout/blob/2089b57ac2b7feb86dccde8a6864ae70ce463497/code/control/Checkout_Controller.php#L78-L102
train
i-lateral/silverstripe-checkout
code/control/Checkout_Controller.php
Checkout_Controller.billing
public function billing() { $form = $this->BillingForm(); // If we are using simple checkout, skip if (Checkout::config()->simple_checkout) { return $this->redirect($this->Link('finish')); } // Check permissions for guest checkout if (!Member::currentUserID() && !Checkout::config()->guest_checkout) { return $this->redirect($this->Link('index')); } // Pre populate form with member info if (Member::currentUserID()) { $form->loadDataFrom(Member::currentUser()); } $this->customise(array( 'Title' => _t('Checkout.BillingDetails', "Billing Details"), 'Form' => $form )); $this->extend("onBeforeBilling"); return $this->renderWith(array( 'Checkout_billing', 'Checkout', 'Page' )); }
php
public function billing() { $form = $this->BillingForm(); // If we are using simple checkout, skip if (Checkout::config()->simple_checkout) { return $this->redirect($this->Link('finish')); } // Check permissions for guest checkout if (!Member::currentUserID() && !Checkout::config()->guest_checkout) { return $this->redirect($this->Link('index')); } // Pre populate form with member info if (Member::currentUserID()) { $form->loadDataFrom(Member::currentUser()); } $this->customise(array( 'Title' => _t('Checkout.BillingDetails', "Billing Details"), 'Form' => $form )); $this->extend("onBeforeBilling"); return $this->renderWith(array( 'Checkout_billing', 'Checkout', 'Page' )); }
[ "public", "function", "billing", "(", ")", "{", "$", "form", "=", "$", "this", "->", "BillingForm", "(", ")", ";", "// If we are using simple checkout, skip", "if", "(", "Checkout", "::", "config", "(", ")", "->", "simple_checkout", ")", "{", "return", "$", ...
Catch the default dilling information of the visitor @return array
[ "Catch", "the", "default", "dilling", "information", "of", "the", "visitor" ]
2089b57ac2b7feb86dccde8a6864ae70ce463497
https://github.com/i-lateral/silverstripe-checkout/blob/2089b57ac2b7feb86dccde8a6864ae70ce463497/code/control/Checkout_Controller.php#L110-L141
train
i-lateral/silverstripe-checkout
code/control/Checkout_Controller.php
Checkout_Controller.delivery
public function delivery() { $cart = ShoppingCart::get(); // If we are using simple checkout, skip if (Checkout::config()->simple_checkout) { return $this->redirect($this->Link('finish')); } // If customer is collecting, skip if ($cart->isCollection()) { return $this->redirect($this->Link('finish')); } // If cart is not deliverable, also skip if (!$cart->isDeliverable()) { return $this->redirect($this->Link('finish')); } // Check permissions for guest checkout if (!Member::currentUserID() && !Checkout::config()->guest_checkout) { return $this->redirect($this->Link('index')); } $this->customise(array( 'Title' => _t('Checkout.DeliveryDetails', "Delivery Details"), 'Form' => $this->DeliveryForm() )); $this->extend("onBeforeDelivery"); return $this->renderWith(array( 'Checkout_delivery', 'Checkout', 'Page' )); }
php
public function delivery() { $cart = ShoppingCart::get(); // If we are using simple checkout, skip if (Checkout::config()->simple_checkout) { return $this->redirect($this->Link('finish')); } // If customer is collecting, skip if ($cart->isCollection()) { return $this->redirect($this->Link('finish')); } // If cart is not deliverable, also skip if (!$cart->isDeliverable()) { return $this->redirect($this->Link('finish')); } // Check permissions for guest checkout if (!Member::currentUserID() && !Checkout::config()->guest_checkout) { return $this->redirect($this->Link('index')); } $this->customise(array( 'Title' => _t('Checkout.DeliveryDetails', "Delivery Details"), 'Form' => $this->DeliveryForm() )); $this->extend("onBeforeDelivery"); return $this->renderWith(array( 'Checkout_delivery', 'Checkout', 'Page' )); }
[ "public", "function", "delivery", "(", ")", "{", "$", "cart", "=", "ShoppingCart", "::", "get", "(", ")", ";", "// If we are using simple checkout, skip", "if", "(", "Checkout", "::", "config", "(", ")", "->", "simple_checkout", ")", "{", "return", "$", "thi...
Use to catch the users delivery details, if different to their billing details @var array
[ "Use", "to", "catch", "the", "users", "delivery", "details", "if", "different", "to", "their", "billing", "details" ]
2089b57ac2b7feb86dccde8a6864ae70ce463497
https://github.com/i-lateral/silverstripe-checkout/blob/2089b57ac2b7feb86dccde8a6864ae70ce463497/code/control/Checkout_Controller.php#L150-L186
train
i-lateral/silverstripe-checkout
code/control/Checkout_Controller.php
Checkout_Controller.finish
public function finish() { // Check the users details are set, if not, send them to the cart $billing_data = Session::get("Checkout.BillingDetailsForm.data"); $delivery_data = Session::get("Checkout.DeliveryDetailsForm.data"); if (!Checkout::config()->simple_checkout && !is_array($billing_data) && !is_array($delivery_data)) { return $this->redirect($this->Link('index')); } // Check permissions for guest checkout if (!Member::currentUserID() && !Checkout::config()->guest_checkout) { return $this->redirect($this->Link('index')); } if (Checkout::config()->simple_checkout) { $title = _t('Checkout.SelectPaymentMethod', "Select Payment Method"); } else { $title = _t('Checkout.SeelctPostagePayment', "Select Postage and Payment Method"); } $this->customise(array( 'Title' => $title, 'Form' => $this->PostagePaymentForm() )); $this->extend("onBeforeFinish"); return $this->renderWith(array( 'Checkout_finish', 'Checkout', 'Page' )); }
php
public function finish() { // Check the users details are set, if not, send them to the cart $billing_data = Session::get("Checkout.BillingDetailsForm.data"); $delivery_data = Session::get("Checkout.DeliveryDetailsForm.data"); if (!Checkout::config()->simple_checkout && !is_array($billing_data) && !is_array($delivery_data)) { return $this->redirect($this->Link('index')); } // Check permissions for guest checkout if (!Member::currentUserID() && !Checkout::config()->guest_checkout) { return $this->redirect($this->Link('index')); } if (Checkout::config()->simple_checkout) { $title = _t('Checkout.SelectPaymentMethod', "Select Payment Method"); } else { $title = _t('Checkout.SeelctPostagePayment', "Select Postage and Payment Method"); } $this->customise(array( 'Title' => $title, 'Form' => $this->PostagePaymentForm() )); $this->extend("onBeforeFinish"); return $this->renderWith(array( 'Checkout_finish', 'Checkout', 'Page' )); }
[ "public", "function", "finish", "(", ")", "{", "// Check the users details are set, if not, send them to the cart", "$", "billing_data", "=", "Session", "::", "get", "(", "\"Checkout.BillingDetailsForm.data\"", ")", ";", "$", "delivery_data", "=", "Session", "::", "get", ...
Final step, allowing user to select postage and payment method @return array
[ "Final", "step", "allowing", "user", "to", "select", "postage", "and", "payment", "method" ]
2089b57ac2b7feb86dccde8a6864ae70ce463497
https://github.com/i-lateral/silverstripe-checkout/blob/2089b57ac2b7feb86dccde8a6864ae70ce463497/code/control/Checkout_Controller.php#L263-L296
train
i-lateral/silverstripe-checkout
code/control/Checkout_Controller.php
Checkout_Controller.LoginForm
public function LoginForm() { $form = CheckoutLoginForm::create($this, 'LoginForm'); $form->setAttribute("action", $this->Link("LoginForm")); $form ->Fields() ->add(HiddenField::create("BackURL")->setValue($this->Link())); $form ->Actions() ->dataFieldByName('action_dologin') ->addExtraClass("btn btn-primary"); $this->extend("updateLoginForm", $form); return $form; }
php
public function LoginForm() { $form = CheckoutLoginForm::create($this, 'LoginForm'); $form->setAttribute("action", $this->Link("LoginForm")); $form ->Fields() ->add(HiddenField::create("BackURL")->setValue($this->Link())); $form ->Actions() ->dataFieldByName('action_dologin') ->addExtraClass("btn btn-primary"); $this->extend("updateLoginForm", $form); return $form; }
[ "public", "function", "LoginForm", "(", ")", "{", "$", "form", "=", "CheckoutLoginForm", "::", "create", "(", "$", "this", ",", "'LoginForm'", ")", ";", "$", "form", "->", "setAttribute", "(", "\"action\"", ",", "$", "this", "->", "Link", "(", "\"LoginFo...
Generate a login form @return MemberLoginForm
[ "Generate", "a", "login", "form" ]
2089b57ac2b7feb86dccde8a6864ae70ce463497
https://github.com/i-lateral/silverstripe-checkout/blob/2089b57ac2b7feb86dccde8a6864ae70ce463497/code/control/Checkout_Controller.php#L303-L320
train
i-lateral/silverstripe-checkout
code/control/Checkout_Controller.php
Checkout_Controller.BillingForm
public function BillingForm() { $form = BillingDetailsForm::create($this, 'BillingForm'); $data = Session::get("Checkout.BillingDetailsForm.data"); if (is_array($data)) { $form->loadDataFrom($data); } elseif($member = Member::currentUser()) { // Fill email, phone, etc $form->loadDataFrom($member); // Then fill with Address info if($member->DefaultAddress()) { $form->loadDataFrom($member->DefaultAddress()); } } $this->extend("updateBillingForm", $form); return $form; }
php
public function BillingForm() { $form = BillingDetailsForm::create($this, 'BillingForm'); $data = Session::get("Checkout.BillingDetailsForm.data"); if (is_array($data)) { $form->loadDataFrom($data); } elseif($member = Member::currentUser()) { // Fill email, phone, etc $form->loadDataFrom($member); // Then fill with Address info if($member->DefaultAddress()) { $form->loadDataFrom($member->DefaultAddress()); } } $this->extend("updateBillingForm", $form); return $form; }
[ "public", "function", "BillingForm", "(", ")", "{", "$", "form", "=", "BillingDetailsForm", "::", "create", "(", "$", "this", ",", "'BillingForm'", ")", ";", "$", "data", "=", "Session", "::", "get", "(", "\"Checkout.BillingDetailsForm.data\"", ")", ";", "if...
Form to capture the users billing details @return BillingDetailsForm
[ "Form", "to", "capture", "the", "users", "billing", "details" ]
2089b57ac2b7feb86dccde8a6864ae70ce463497
https://github.com/i-lateral/silverstripe-checkout/blob/2089b57ac2b7feb86dccde8a6864ae70ce463497/code/control/Checkout_Controller.php#L327-L347
train
i-lateral/silverstripe-checkout
code/control/Checkout_Controller.php
Checkout_Controller.DeliveryForm
public function DeliveryForm() { $form = DeliveryDetailsForm::create($this, 'DeliveryForm'); $data = Session::get("Checkout.DeliveryDetailsForm.data"); if (is_array($data)) { $form->loadDataFrom($data); } $this->extend("updateDeliveryForm", $form); return $form; }
php
public function DeliveryForm() { $form = DeliveryDetailsForm::create($this, 'DeliveryForm'); $data = Session::get("Checkout.DeliveryDetailsForm.data"); if (is_array($data)) { $form->loadDataFrom($data); } $this->extend("updateDeliveryForm", $form); return $form; }
[ "public", "function", "DeliveryForm", "(", ")", "{", "$", "form", "=", "DeliveryDetailsForm", "::", "create", "(", "$", "this", ",", "'DeliveryForm'", ")", ";", "$", "data", "=", "Session", "::", "get", "(", "\"Checkout.DeliveryDetailsForm.data\"", ")", ";", ...
Form to capture users delivery details @return DeliveryDetailsForm
[ "Form", "to", "capture", "users", "delivery", "details" ]
2089b57ac2b7feb86dccde8a6864ae70ce463497
https://github.com/i-lateral/silverstripe-checkout/blob/2089b57ac2b7feb86dccde8a6864ae70ce463497/code/control/Checkout_Controller.php#L354-L366
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.getFullColumnName
public static function getFullColumnName($column, $table = null) { // Get target table name if ($table === null) { // Make sure, the getTableName() is defined in calling class if (method_exists(get_called_class(), 'getTableName')) { $table = static::getTableName(); } else { throw new LogicException( sprintf('The method getTableName() is not declared in %s, therefore a full column name cannot be generated', get_called_class()) ); } } return sprintf('%s.%s', $table, $column); }
php
public static function getFullColumnName($column, $table = null) { // Get target table name if ($table === null) { // Make sure, the getTableName() is defined in calling class if (method_exists(get_called_class(), 'getTableName')) { $table = static::getTableName(); } else { throw new LogicException( sprintf('The method getTableName() is not declared in %s, therefore a full column name cannot be generated', get_called_class()) ); } } return sprintf('%s.%s', $table, $column); }
[ "public", "static", "function", "getFullColumnName", "(", "$", "column", ",", "$", "table", "=", "null", ")", "{", "// Get target table name", "if", "(", "$", "table", "===", "null", ")", "{", "// Make sure, the getTableName() is defined in calling class", "if", "("...
Returns full column name prepending table name @param string $column Column name @param string $table Table name. By default getTableName() is called @throws \LogicException if the getTableName() isn't defined in descending class @return string
[ "Returns", "full", "column", "name", "prepending", "table", "name" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L94-L109
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.getWithPrefix
protected static function getWithPrefix($table) { $prefix = static::$prefix; if (is_null($prefix) || empty($prefix)) { // If prefix is null, then no need to prepend a redundant _ return $table; } return sprintf('%s_%s', $prefix, $table); }
php
protected static function getWithPrefix($table) { $prefix = static::$prefix; if (is_null($prefix) || empty($prefix)) { // If prefix is null, then no need to prepend a redundant _ return $table; } return sprintf('%s_%s', $prefix, $table); }
[ "protected", "static", "function", "getWithPrefix", "(", "$", "table", ")", "{", "$", "prefix", "=", "static", "::", "$", "prefix", ";", "if", "(", "is_null", "(", "$", "prefix", ")", "||", "empty", "(", "$", "prefix", ")", ")", "{", "// If prefix is n...
Returns table name with a prefix @param string $table @return string
[ "Returns", "table", "name", "with", "a", "prefix" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L132-L142
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.executeSqlFromFile
final protected function executeSqlFromFile($file) { if (is_file($file)) { return $this->executeSqlFromString(file_get_contents($file)); } else { throw new RuntimeException(sprintf('Can not read file at "%s"', $file)); } }
php
final protected function executeSqlFromFile($file) { if (is_file($file)) { return $this->executeSqlFromString(file_get_contents($file)); } else { throw new RuntimeException(sprintf('Can not read file at "%s"', $file)); } }
[ "final", "protected", "function", "executeSqlFromFile", "(", "$", "file", ")", "{", "if", "(", "is_file", "(", "$", "file", ")", ")", "{", "return", "$", "this", "->", "executeSqlFromString", "(", "file_get_contents", "(", "$", "file", ")", ")", ";", "}"...
Executes raw SQL from a file @param string $file @throws \RuntimeException On reading failure @return boolean
[ "Executes", "raw", "SQL", "from", "a", "file" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L151-L158
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.valueExists
final protected function valueExists($column, $value) { $this->validateShortcutData(); return (bool) $this->db->select() ->count($column) ->from(static::getTableName()) ->whereEquals($column, $value) ->queryScalar(); }
php
final protected function valueExists($column, $value) { $this->validateShortcutData(); return (bool) $this->db->select() ->count($column) ->from(static::getTableName()) ->whereEquals($column, $value) ->queryScalar(); }
[ "final", "protected", "function", "valueExists", "(", "$", "column", ",", "$", "value", ")", "{", "$", "this", "->", "validateShortcutData", "(", ")", ";", "return", "(", "bool", ")", "$", "this", "->", "db", "->", "select", "(", ")", "->", "count", ...
Determines whether column value already exists @param string $column Column name @param string $value Column value to be checked @return boolean
[ "Determines", "whether", "column", "value", "already", "exists" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L190-L199
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.deleteByPks
final public function deleteByPks(array $ids) { foreach ($ids as $id) { if (!$this->deleteByPk($id)) { return false; } } return true; }
php
final public function deleteByPks(array $ids) { foreach ($ids as $id) { if (!$this->deleteByPk($id)) { return false; } } return true; }
[ "final", "public", "function", "deleteByPks", "(", "array", "$", "ids", ")", "{", "foreach", "(", "$", "ids", "as", "$", "id", ")", "{", "if", "(", "!", "$", "this", "->", "deleteByPk", "(", "$", "id", ")", ")", "{", "return", "false", ";", "}", ...
Deletes rows by their associated primary keys @param array $ids @return boolean
[ "Deletes", "rows", "by", "their", "associated", "primary", "keys" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L219-L228
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.findColumnByPk
final public function findColumnByPk($id, $column) { $this->validateShortcutData(); return $this->fetchOneColumn($column, $this->getPk(), $id); }
php
final public function findColumnByPk($id, $column) { $this->validateShortcutData(); return $this->fetchOneColumn($column, $this->getPk(), $id); }
[ "final", "public", "function", "findColumnByPk", "(", "$", "id", ",", "$", "column", ")", "{", "$", "this", "->", "validateShortcutData", "(", ")", ";", "return", "$", "this", "->", "fetchOneColumn", "(", "$", "column", ",", "$", "this", "->", "getPk", ...
Returns column's value by provided PK @param string $id PK's value @param string $column @return boolean
[ "Returns", "column", "s", "value", "by", "provided", "PK" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L249-L253
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.getLastPk
final public function getLastPk($table = null) { if ($table === null) { $this->validateShortcutData(); $table = static::getTableName(); } return $this->db->select() ->max($this->getPk()) ->from($table) ->queryScalar(); }
php
final public function getLastPk($table = null) { if ($table === null) { $this->validateShortcutData(); $table = static::getTableName(); } return $this->db->select() ->max($this->getPk()) ->from($table) ->queryScalar(); }
[ "final", "public", "function", "getLastPk", "(", "$", "table", "=", "null", ")", "{", "if", "(", "$", "table", "===", "null", ")", "{", "$", "this", "->", "validateShortcutData", "(", ")", ";", "$", "table", "=", "static", "::", "getTableName", "(", ...
Returns last primary key @param string $table Optional table name override @return integer
[ "Returns", "last", "primary", "key" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L261-L272
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.syncWithJunction
final public function syncWithJunction($table, $masterValue, array $slaves, $masterColumn = self::PARAM_JUNCTION_MASTER_COLUMN, $slaveColumn = self::PARAM_JUNCTION_SLAVE_COLUMN) { // Remove previous ones $this->removeFromJunction($table, $masterValue, $masterColumn); // And insert new ones $this->insertIntoJunction($table, $masterValue, $slaves, $masterColumn, $slaveColumn); return true; }
php
final public function syncWithJunction($table, $masterValue, array $slaves, $masterColumn = self::PARAM_JUNCTION_MASTER_COLUMN, $slaveColumn = self::PARAM_JUNCTION_SLAVE_COLUMN) { // Remove previous ones $this->removeFromJunction($table, $masterValue, $masterColumn); // And insert new ones $this->insertIntoJunction($table, $masterValue, $slaves, $masterColumn, $slaveColumn); return true; }
[ "final", "public", "function", "syncWithJunction", "(", "$", "table", ",", "$", "masterValue", ",", "array", "$", "slaves", ",", "$", "masterColumn", "=", "self", "::", "PARAM_JUNCTION_MASTER_COLUMN", ",", "$", "slaveColumn", "=", "self", "::", "PARAM_JUNCTION_S...
Synchronizes a junction table @param string $table Junction table name @param string $masterColumn Master column name @param string $masterValue Master value (shared for slaves) @param string $slaveColumn Slave column name @param array $slaves A collection of slave values @return boolean
[ "Synchronizes", "a", "junction", "table" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L284-L293
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.removeFromJunction
final public function removeFromJunction($table, $masterValue, $masterColumn = self::PARAM_JUNCTION_MASTER_COLUMN) { // Support for multiple removal if (!is_array($masterValue)) { $masterValue = array($masterValue); } return $this->db->delete() ->from($table) ->whereIn($masterColumn, $masterValue) ->execute(); }
php
final public function removeFromJunction($table, $masterValue, $masterColumn = self::PARAM_JUNCTION_MASTER_COLUMN) { // Support for multiple removal if (!is_array($masterValue)) { $masterValue = array($masterValue); } return $this->db->delete() ->from($table) ->whereIn($masterColumn, $masterValue) ->execute(); }
[ "final", "public", "function", "removeFromJunction", "(", "$", "table", ",", "$", "masterValue", ",", "$", "masterColumn", "=", "self", "::", "PARAM_JUNCTION_MASTER_COLUMN", ")", "{", "// Support for multiple removal", "if", "(", "!", "is_array", "(", "$", "master...
Removes all records from junction table associated with master's key @param string $table Junction table name @param string|array $masterValue Master value (shared for slaves) @param string $masterColumn Master column name @return boolean
[ "Removes", "all", "records", "from", "junction", "table", "associated", "with", "master", "s", "key" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L303-L314
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.insertIntoJunction
final public function insertIntoJunction($table, $masterValue, array $slaves, $masterColumn = self::PARAM_JUNCTION_MASTER_COLUMN, $slaveColumn = self::PARAM_JUNCTION_SLAVE_COLUMN) { // Avoid executing empty query if (!empty($slaves)) { return $this->db->insertIntoJunction($table, array($masterColumn, $slaveColumn), $masterValue, $slaves) ->execute(); } else { return false; } }
php
final public function insertIntoJunction($table, $masterValue, array $slaves, $masterColumn = self::PARAM_JUNCTION_MASTER_COLUMN, $slaveColumn = self::PARAM_JUNCTION_SLAVE_COLUMN) { // Avoid executing empty query if (!empty($slaves)) { return $this->db->insertIntoJunction($table, array($masterColumn, $slaveColumn), $masterValue, $slaves) ->execute(); } else { return false; } }
[ "final", "public", "function", "insertIntoJunction", "(", "$", "table", ",", "$", "masterValue", ",", "array", "$", "slaves", ",", "$", "masterColumn", "=", "self", "::", "PARAM_JUNCTION_MASTER_COLUMN", ",", "$", "slaveColumn", "=", "self", "::", "PARAM_JUNCTION...
Inserts a record into junction table @param string $table Junction table name @param string $masterValue @param array $slaves @param string $masterColumn Master column name @param string $slaveColumn Slave column name @return boolean
[ "Inserts", "a", "record", "into", "junction", "table" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L326-L335
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.getMasterIdsFromJunction
final public function getMasterIdsFromJunction($table, $value, $masterColumn = self::PARAM_JUNCTION_MASTER_COLUMN, $slaveColumn = self::PARAM_JUNCTION_SLAVE_COLUMN) { return $this->getIdsFromJunction($table, $masterColumn, $slaveColumn, $value); }
php
final public function getMasterIdsFromJunction($table, $value, $masterColumn = self::PARAM_JUNCTION_MASTER_COLUMN, $slaveColumn = self::PARAM_JUNCTION_SLAVE_COLUMN) { return $this->getIdsFromJunction($table, $masterColumn, $slaveColumn, $value); }
[ "final", "public", "function", "getMasterIdsFromJunction", "(", "$", "table", ",", "$", "value", ",", "$", "masterColumn", "=", "self", "::", "PARAM_JUNCTION_MASTER_COLUMN", ",", "$", "slaveColumn", "=", "self", "::", "PARAM_JUNCTION_SLAVE_COLUMN", ")", "{", "retu...
Fetches master values associated with a slave in junction table @param string $table Junction table name @param string $value Slave value @param string $masterColumn Master column name @param string $slaveColumn Slave column name @return array
[ "Fetches", "master", "values", "associated", "with", "a", "slave", "in", "junction", "table" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L346-L349
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.getIdsFromJunction
private function getIdsFromJunction($table, $column, $key, $value) { return $this->db->select($column) ->from($table) ->whereEquals($key, $value) ->queryAll($column); }
php
private function getIdsFromJunction($table, $column, $key, $value) { return $this->db->select($column) ->from($table) ->whereEquals($key, $value) ->queryAll($column); }
[ "private", "function", "getIdsFromJunction", "(", "$", "table", ",", "$", "column", ",", "$", "key", ",", "$", "value", ")", "{", "return", "$", "this", "->", "db", "->", "select", "(", "$", "column", ")", "->", "from", "(", "$", "table", ")", "->"...
Fetches values from junction table @param string $table Junction table name @param string $column Column to be selected @param string $key @param string $value @return array
[ "Fetches", "values", "from", "junction", "table" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L374-L380
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.getColumnSumWithAverages
final protected function getColumnSumWithAverages(array $columns, array $averages, array $constraints, $precision = 2) { $db = $this->db->select(); foreach ($columns as $column) { $db->sum($column, $column); } foreach ($averages as $average) { $db->avg($average, $average); } $db->from(static::getTableName()); if (!empty($constraints)) { // Iteration counter $iteration = 0; foreach ($constraints as $key => $value) { if ($iteration === 0) { $db->whereEquals($key, $value); } else { $db->andWhereEquals($key, $value); } $iteration++; } } $data = $db->queryAll(); if (isset($data[0])) { return Math::roundCollection($data[0], $precision); } else { // No results return array(); } }
php
final protected function getColumnSumWithAverages(array $columns, array $averages, array $constraints, $precision = 2) { $db = $this->db->select(); foreach ($columns as $column) { $db->sum($column, $column); } foreach ($averages as $average) { $db->avg($average, $average); } $db->from(static::getTableName()); if (!empty($constraints)) { // Iteration counter $iteration = 0; foreach ($constraints as $key => $value) { if ($iteration === 0) { $db->whereEquals($key, $value); } else { $db->andWhereEquals($key, $value); } $iteration++; } } $data = $db->queryAll(); if (isset($data[0])) { return Math::roundCollection($data[0], $precision); } else { // No results return array(); } }
[ "final", "protected", "function", "getColumnSumWithAverages", "(", "array", "$", "columns", ",", "array", "$", "averages", ",", "array", "$", "constraints", ",", "$", "precision", "=", "2", ")", "{", "$", "db", "=", "$", "this", "->", "db", "->", "select...
Counts the sum of a column by district id @param string $columns @param array $averages @param array $constraints @param integer $precision Float precision @return string
[ "Counts", "the", "sum", "of", "a", "column", "by", "district", "id" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L391-L428
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.persistRecord
private function persistRecord(array $data, array $fillable = array(), $set) { if (!empty($fillable) && !ArrayUtils::keysExist($data, $fillable)) { throw new LogicException('Can not persist the entity due to fillable protection. Make sure all fillable keys exist in the entity'); } $this->validateShortcutData(); if (isset($data[$this->getPk()]) && $data[$this->getPk()]) { $result = $this->db->update(static::getTableName(), $data) ->whereEquals($this->getPk(), $data[$this->getPk()]) ->execute(); return $set === true ? $data : $result; } else { // Do not insert primary key if present if (array_key_exists($this->getPk(), $data)) { unset($data[$this->getPk()]); } // Insert a new row without PK $result = $this->db->insert(static::getTableName(), $data) ->execute(); if ($set === true) { // Append a PK in result-set now $data[$this->getPk()] = $this->getMaxId(); return $data; } else { return $result; } } }
php
private function persistRecord(array $data, array $fillable = array(), $set) { if (!empty($fillable) && !ArrayUtils::keysExist($data, $fillable)) { throw new LogicException('Can not persist the entity due to fillable protection. Make sure all fillable keys exist in the entity'); } $this->validateShortcutData(); if (isset($data[$this->getPk()]) && $data[$this->getPk()]) { $result = $this->db->update(static::getTableName(), $data) ->whereEquals($this->getPk(), $data[$this->getPk()]) ->execute(); return $set === true ? $data : $result; } else { // Do not insert primary key if present if (array_key_exists($this->getPk(), $data)) { unset($data[$this->getPk()]); } // Insert a new row without PK $result = $this->db->insert(static::getTableName(), $data) ->execute(); if ($set === true) { // Append a PK in result-set now $data[$this->getPk()] = $this->getMaxId(); return $data; } else { return $result; } } }
[ "private", "function", "persistRecord", "(", "array", "$", "data", ",", "array", "$", "fillable", "=", "array", "(", ")", ",", "$", "set", ")", "{", "if", "(", "!", "empty", "(", "$", "fillable", ")", "&&", "!", "ArrayUtils", "::", "keysExist", "(", ...
Persists a row @param array $data @param array $fillable Optional fillable protection @param boolean $set Whether to return a set or not @throws \LogicException if failed on keys existence validation @return array|boolean
[ "Persists", "a", "row" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L482-L515
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.persistMany
final public function persistMany(array $collection, array $fillable = array()) { foreach ($collection as $item) { $this->persist($item, $fillable); } return true; }
php
final public function persistMany(array $collection, array $fillable = array()) { foreach ($collection as $item) { $this->persist($item, $fillable); } return true; }
[ "final", "public", "function", "persistMany", "(", "array", "$", "collection", ",", "array", "$", "fillable", "=", "array", "(", ")", ")", "{", "foreach", "(", "$", "collection", "as", "$", "item", ")", "{", "$", "this", "->", "persist", "(", "$", "i...
Inserts or updates many records at once @param array $collection @param array $fillable Optional fillable protection @throws \LogicException if failed on keys existence validation @return boolean
[ "Inserts", "or", "updates", "many", "records", "at", "once" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L551-L558
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.updateColumns
final public function updateColumns(array $data, array $allowedColumns = array()) { foreach ($data as $column => $values) { foreach ($values as $id => $value) { // Protection. Update only defined columns if (!empty($allowedColumns) && !in_array($column, $allowedColumns)) { continue; } $this->updateColumnByPk($id, $column, $value); } } return true; }
php
final public function updateColumns(array $data, array $allowedColumns = array()) { foreach ($data as $column => $values) { foreach ($values as $id => $value) { // Protection. Update only defined columns if (!empty($allowedColumns) && !in_array($column, $allowedColumns)) { continue; } $this->updateColumnByPk($id, $column, $value); } } return true; }
[ "final", "public", "function", "updateColumns", "(", "array", "$", "data", ",", "array", "$", "allowedColumns", "=", "array", "(", ")", ")", "{", "foreach", "(", "$", "data", "as", "$", "column", "=>", "$", "values", ")", "{", "foreach", "(", "$", "v...
Update multiple columns at once @param array $data @param array $allowedColumns Optional protection for columns to be updated (purely for protection purposes) @return boolean
[ "Update", "multiple", "columns", "at", "once" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L580-L594
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.updateColumnsByPk
final public function updateColumnsByPk($pk, $data) { $this->validateShortcutData(); return $this->db->update(static::getTableName(), $data) ->whereEquals($this->getPk(), $pk) ->execute(); }
php
final public function updateColumnsByPk($pk, $data) { $this->validateShortcutData(); return $this->db->update(static::getTableName(), $data) ->whereEquals($this->getPk(), $pk) ->execute(); }
[ "final", "public", "function", "updateColumnsByPk", "(", "$", "pk", ",", "$", "data", ")", "{", "$", "this", "->", "validateShortcutData", "(", ")", ";", "return", "$", "this", "->", "db", "->", "update", "(", "static", "::", "getTableName", "(", ")", ...
Updates column values by a primary key @param string $pk @param array $data Columns and their values to be updated @return boolean
[ "Updates", "column", "values", "by", "a", "primary", "key" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L603-L610
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.isPrimaryKeyValue
final public function isPrimaryKeyValue($value) { $column = $this->getPk(); return (bool) $this->db->select($column) ->from(static::getTableName()) ->whereEquals($column, $value) ->query($column); }
php
final public function isPrimaryKeyValue($value) { $column = $this->getPk(); return (bool) $this->db->select($column) ->from(static::getTableName()) ->whereEquals($column, $value) ->query($column); }
[ "final", "public", "function", "isPrimaryKeyValue", "(", "$", "value", ")", "{", "$", "column", "=", "$", "this", "->", "getPk", "(", ")", ";", "return", "(", "bool", ")", "$", "this", "->", "db", "->", "select", "(", "$", "column", ")", "->", "fro...
Checks whether PK value exists @param string $value PK's value @return boolean
[ "Checks", "whether", "PK", "value", "exists" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L618-L626
train
krystal-framework/krystal.framework
src/Krystal/Db/Sql/AbstractMapper.php
AbstractMapper.fetchOneColumn
final public function fetchOneColumn($column, $key, $value) { $this->validateShortcutData(); return $this->db->select($column) ->from(static::getTableName()) ->whereEquals($key, $value) ->query($column); }
php
final public function fetchOneColumn($column, $key, $value) { $this->validateShortcutData(); return $this->db->select($column) ->from(static::getTableName()) ->whereEquals($key, $value) ->query($column); }
[ "final", "public", "function", "fetchOneColumn", "(", "$", "column", ",", "$", "key", ",", "$", "value", ")", "{", "$", "this", "->", "validateShortcutData", "(", ")", ";", "return", "$", "this", "->", "db", "->", "select", "(", "$", "column", ")", "...
Fetches one column @param string $column @param string $key @param string $value @return array
[ "Fetches", "one", "column" ]
a5ff72384f3efbe74f390538793feb7d522b9c39
https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Db/Sql/AbstractMapper.php#L636-L644
train