repository_name
stringlengths 5
67
| func_path_in_repository
stringlengths 4
234
| func_name
stringlengths 0
314
| whole_func_string
stringlengths 52
3.87M
| language
stringclasses 6
values | func_code_string
stringlengths 52
3.87M
| func_code_tokens
listlengths 15
672k
| func_documentation_string
stringlengths 1
47.2k
| func_documentation_tokens
listlengths 1
3.92k
| split_name
stringclasses 1
value | func_code_url
stringlengths 85
339
|
---|---|---|---|---|---|---|---|---|---|---|
Lansoweb/LosBase | src/LosBase/DBAL/Types/BrPriceType.php | BrPriceType.convertToDatabaseValue | public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if ($value === null) {
return;
}
$formatter = new \NumberFormatter('pt_BR', \NumberFormatter::DECIMAL);
$formatted = $formatter->parse($value);
return $formatted;
} | php | public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if ($value === null) {
return;
}
$formatter = new \NumberFormatter('pt_BR', \NumberFormatter::DECIMAL);
$formatted = $formatter->parse($value);
return $formatted;
} | [
"public",
"function",
"convertToDatabaseValue",
"(",
"$",
"value",
",",
"AbstractPlatform",
"$",
"platform",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
";",
"}",
"$",
"formatter",
"=",
"new",
"\\",
"NumberFormatter",
"(",
"'pt_BR'",
",",
"\\",
"NumberFormatter",
"::",
"DECIMAL",
")",
";",
"$",
"formatted",
"=",
"$",
"formatter",
"->",
"parse",
"(",
"$",
"value",
")",
";",
"return",
"$",
"formatted",
";",
"}"
]
| @param string|int|float|null $value
@param Doctrine\DBAL\Platforms\AbstractPlatform $platform
@return mixed | [
"@param",
"string|int|float|null",
"$value",
"@param",
"Doctrine",
"\\",
"DBAL",
"\\",
"Platforms",
"\\",
"AbstractPlatform",
"$platform"
]
| train | https://github.com/Lansoweb/LosBase/blob/90e18a53d29c1bd841c149dca43aa365eecc656d/src/LosBase/DBAL/Types/BrPriceType.php#L16-L26 |
Lansoweb/LosBase | src/LosBase/DBAL/Types/BrPriceType.php | BrPriceType.convertToPHPValue | public function convertToPHPValue($value, AbstractPlatform $platform)
{
if ($value === null) {
return;
}
$formatted = \number_format($value, 2, ',', '.');
return $formatted;
} | php | public function convertToPHPValue($value, AbstractPlatform $platform)
{
if ($value === null) {
return;
}
$formatted = \number_format($value, 2, ',', '.');
return $formatted;
} | [
"public",
"function",
"convertToPHPValue",
"(",
"$",
"value",
",",
"AbstractPlatform",
"$",
"platform",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
";",
"}",
"$",
"formatted",
"=",
"\\",
"number_format",
"(",
"$",
"value",
",",
"2",
",",
"','",
",",
"'.'",
")",
";",
"return",
"$",
"formatted",
";",
"}"
]
| @param string $value
@param DoctrineDBALPlatformsAbstractPlatform $platform
@return string|null
@throws DoctrineDBALTypesConversionException | [
"@param",
"string",
"$value",
"@param",
"DoctrineDBALPlatformsAbstractPlatform",
"$platform"
]
| train | https://github.com/Lansoweb/LosBase/blob/90e18a53d29c1bd841c149dca43aa365eecc656d/src/LosBase/DBAL/Types/BrPriceType.php#L36-L44 |
Lansoweb/LosBase | src/LosBase/DBAL/Types/BrPriceType.php | BrPriceType.getSQLDeclaration | public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
$fieldDeclaration['precision'] = (!isset($fieldDeclaration['precision']) || empty($fieldDeclaration['precision'])) ? 9 : $fieldDeclaration['precision'];
$fieldDeclaration['scale'] = (!isset($fieldDeclaration['scale']) || empty($fieldDeclaration['scale'])) ? 2 : $fieldDeclaration['scale'];
return $platform->getDecimalTypeDeclarationSQL($fieldDeclaration);
} | php | public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
$fieldDeclaration['precision'] = (!isset($fieldDeclaration['precision']) || empty($fieldDeclaration['precision'])) ? 9 : $fieldDeclaration['precision'];
$fieldDeclaration['scale'] = (!isset($fieldDeclaration['scale']) || empty($fieldDeclaration['scale'])) ? 2 : $fieldDeclaration['scale'];
return $platform->getDecimalTypeDeclarationSQL($fieldDeclaration);
} | [
"public",
"function",
"getSQLDeclaration",
"(",
"array",
"$",
"fieldDeclaration",
",",
"AbstractPlatform",
"$",
"platform",
")",
"{",
"$",
"fieldDeclaration",
"[",
"'precision'",
"]",
"=",
"(",
"!",
"isset",
"(",
"$",
"fieldDeclaration",
"[",
"'precision'",
"]",
")",
"||",
"empty",
"(",
"$",
"fieldDeclaration",
"[",
"'precision'",
"]",
")",
")",
"?",
"9",
":",
"$",
"fieldDeclaration",
"[",
"'precision'",
"]",
";",
"$",
"fieldDeclaration",
"[",
"'scale'",
"]",
"=",
"(",
"!",
"isset",
"(",
"$",
"fieldDeclaration",
"[",
"'scale'",
"]",
")",
"||",
"empty",
"(",
"$",
"fieldDeclaration",
"[",
"'scale'",
"]",
")",
")",
"?",
"2",
":",
"$",
"fieldDeclaration",
"[",
"'scale'",
"]",
";",
"return",
"$",
"platform",
"->",
"getDecimalTypeDeclarationSQL",
"(",
"$",
"fieldDeclaration",
")",
";",
"}"
]
| {@inheritdoc} | [
"{"
]
| train | https://github.com/Lansoweb/LosBase/blob/90e18a53d29c1bd841c149dca43aa365eecc656d/src/LosBase/DBAL/Types/BrPriceType.php#L49-L55 |
PeekAndPoke/psi | src/Operation/FullSet/GroupByOperation.php | GroupByOperation.apply | public function apply(\Iterator $set)
{
$ret = [];
$func = $this->function;
foreach ($set as $key => $item) {
$group = $func($item, $key);
$ret[$group][] = $item;
}
return new \ArrayIterator($ret);
} | php | public function apply(\Iterator $set)
{
$ret = [];
$func = $this->function;
foreach ($set as $key => $item) {
$group = $func($item, $key);
$ret[$group][] = $item;
}
return new \ArrayIterator($ret);
} | [
"public",
"function",
"apply",
"(",
"\\",
"Iterator",
"$",
"set",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"$",
"func",
"=",
"$",
"this",
"->",
"function",
";",
"foreach",
"(",
"$",
"set",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"$",
"group",
"=",
"$",
"func",
"(",
"$",
"item",
",",
"$",
"key",
")",
";",
"$",
"ret",
"[",
"$",
"group",
"]",
"[",
"]",
"=",
"$",
"item",
";",
"}",
"return",
"new",
"\\",
"ArrayIterator",
"(",
"$",
"ret",
")",
";",
"}"
]
| {@inheritdoc} | [
"{"
]
| train | https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/Operation/FullSet/GroupByOperation.php#L21-L33 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Http/Response.php | Zend_Http_Response.getHeader | public function getHeader($header)
{
$header = ucwords(strtolower($header));
if (! is_string($header) || ! isset($this->headers[$header])) return null;
return $this->headers[$header];
} | php | public function getHeader($header)
{
$header = ucwords(strtolower($header));
if (! is_string($header) || ! isset($this->headers[$header])) return null;
return $this->headers[$header];
} | [
"public",
"function",
"getHeader",
"(",
"$",
"header",
")",
"{",
"$",
"header",
"=",
"ucwords",
"(",
"strtolower",
"(",
"$",
"header",
")",
")",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"header",
")",
"||",
"!",
"isset",
"(",
"$",
"this",
"->",
"headers",
"[",
"$",
"header",
"]",
")",
")",
"return",
"null",
";",
"return",
"$",
"this",
"->",
"headers",
"[",
"$",
"header",
"]",
";",
"}"
]
| Get a specific header as string, or null if it is not set
@param string$header
@return string|array|null | [
"Get",
"a",
"specific",
"header",
"as",
"string",
"or",
"null",
"if",
"it",
"is",
"not",
"set"
]
| train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Http/Response.php#L350-L356 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Http/Response.php | Zend_Http_Response.getHeadersAsString | public function getHeadersAsString($status_line = true, $br = "\n")
{
$str = '';
if ($status_line) {
$str = "HTTP/{$this->version} {$this->code} {$this->message}{$br}";
}
// Iterate over the headers and stringify them
foreach ($this->headers as $name => $value)
{
if (is_string($value))
$str .= "{$name}: {$value}{$br}";
elseif (is_array($value)) {
foreach ($value as $subval) {
$str .= "{$name}: {$subval}{$br}";
}
}
}
return $str;
} | php | public function getHeadersAsString($status_line = true, $br = "\n")
{
$str = '';
if ($status_line) {
$str = "HTTP/{$this->version} {$this->code} {$this->message}{$br}";
}
// Iterate over the headers and stringify them
foreach ($this->headers as $name => $value)
{
if (is_string($value))
$str .= "{$name}: {$value}{$br}";
elseif (is_array($value)) {
foreach ($value as $subval) {
$str .= "{$name}: {$subval}{$br}";
}
}
}
return $str;
} | [
"public",
"function",
"getHeadersAsString",
"(",
"$",
"status_line",
"=",
"true",
",",
"$",
"br",
"=",
"\"\\n\"",
")",
"{",
"$",
"str",
"=",
"''",
";",
"if",
"(",
"$",
"status_line",
")",
"{",
"$",
"str",
"=",
"\"HTTP/{$this->version} {$this->code} {$this->message}{$br}\"",
";",
"}",
"// Iterate over the headers and stringify them",
"foreach",
"(",
"$",
"this",
"->",
"headers",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"$",
"str",
".=",
"\"{$name}: {$value}{$br}\"",
";",
"elseif",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"foreach",
"(",
"$",
"value",
"as",
"$",
"subval",
")",
"{",
"$",
"str",
".=",
"\"{$name}: {$subval}{$br}\"",
";",
"}",
"}",
"}",
"return",
"$",
"str",
";",
"}"
]
| Get all headers as string
@param boolean $status_line Whether to return the first status line (IE "HTTP 200 OK")
@param string $br Line breaks (eg. "\n", "\r\n", "<br />")
@return string | [
"Get",
"all",
"headers",
"as",
"string"
]
| train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Http/Response.php#L365-L387 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Http/Response.php | Zend_Http_Response.decodeChunkedBody | public static function decodeChunkedBody($body)
{
$decBody = '';
while (trim($body)) {
if (! preg_match("/^([\da-fA-F]+)[^\r\n]*\r\n/sm", $body, $m)) {
require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception("Error parsing body - doesn't seem to be a chunked message");
}
$length = hexdec(trim($m[1]));
$cut = strlen($m[0]);
$decBody .= substr($body, $cut, $length);
$body = substr($body, $cut + $length + 2);
}
return $decBody;
} | php | public static function decodeChunkedBody($body)
{
$decBody = '';
while (trim($body)) {
if (! preg_match("/^([\da-fA-F]+)[^\r\n]*\r\n/sm", $body, $m)) {
require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception("Error parsing body - doesn't seem to be a chunked message");
}
$length = hexdec(trim($m[1]));
$cut = strlen($m[0]);
$decBody .= substr($body, $cut, $length);
$body = substr($body, $cut + $length + 2);
}
return $decBody;
} | [
"public",
"static",
"function",
"decodeChunkedBody",
"(",
"$",
"body",
")",
"{",
"$",
"decBody",
"=",
"''",
";",
"while",
"(",
"trim",
"(",
"$",
"body",
")",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"\"/^([\\da-fA-F]+)[^\\r\\n]*\\r\\n/sm\"",
",",
"$",
"body",
",",
"$",
"m",
")",
")",
"{",
"require_once",
"'Zend/Http/Exception.php'",
";",
"throw",
"new",
"Zend_Http_Exception",
"(",
"\"Error parsing body - doesn't seem to be a chunked message\"",
")",
";",
"}",
"$",
"length",
"=",
"hexdec",
"(",
"trim",
"(",
"$",
"m",
"[",
"1",
"]",
")",
")",
";",
"$",
"cut",
"=",
"strlen",
"(",
"$",
"m",
"[",
"0",
"]",
")",
";",
"$",
"decBody",
".=",
"substr",
"(",
"$",
"body",
",",
"$",
"cut",
",",
"$",
"length",
")",
";",
"$",
"body",
"=",
"substr",
"(",
"$",
"body",
",",
"$",
"cut",
"+",
"$",
"length",
"+",
"2",
")",
";",
"}",
"return",
"$",
"decBody",
";",
"}"
]
| Decode a "chunked" transfer-encoded body and return the decoded text
@param string $body
@return string | [
"Decode",
"a",
"chunked",
"transfer",
"-",
"encoded",
"body",
"and",
"return",
"the",
"decoded",
"text"
]
| train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Http/Response.php#L550-L568 |
ClanCats/Core | src/classes/CCError/Inspector.php | CCError_Inspector.trace | public function trace( $add_self = false )
{
if ( is_null( $this->trace ) )
{
$this->trace = array();
if ( $add_self )
{
$this->trace[] = new CCError_Trace( array(
'file' => $this->exception->getFile(),
'line' => $this->exception->getLine(),
'class' => $this->exception_name(),
));
}
foreach( $this->exception->getTrace() as $trace )
{
$this->trace[] = new CCError_Trace( $trace );
}
}
return $this->trace;
} | php | public function trace( $add_self = false )
{
if ( is_null( $this->trace ) )
{
$this->trace = array();
if ( $add_self )
{
$this->trace[] = new CCError_Trace( array(
'file' => $this->exception->getFile(),
'line' => $this->exception->getLine(),
'class' => $this->exception_name(),
));
}
foreach( $this->exception->getTrace() as $trace )
{
$this->trace[] = new CCError_Trace( $trace );
}
}
return $this->trace;
} | [
"public",
"function",
"trace",
"(",
"$",
"add_self",
"=",
"false",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"trace",
")",
")",
"{",
"$",
"this",
"->",
"trace",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"add_self",
")",
"{",
"$",
"this",
"->",
"trace",
"[",
"]",
"=",
"new",
"CCError_Trace",
"(",
"array",
"(",
"'file'",
"=>",
"$",
"this",
"->",
"exception",
"->",
"getFile",
"(",
")",
",",
"'line'",
"=>",
"$",
"this",
"->",
"exception",
"->",
"getLine",
"(",
")",
",",
"'class'",
"=>",
"$",
"this",
"->",
"exception_name",
"(",
")",
",",
")",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"exception",
"->",
"getTrace",
"(",
")",
"as",
"$",
"trace",
")",
"{",
"$",
"this",
"->",
"trace",
"[",
"]",
"=",
"new",
"CCError_Trace",
"(",
"$",
"trace",
")",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"trace",
";",
"}"
]
| get the inspector trace
@param bool $add_self Adds the current exception also to trace. | [
"get",
"the",
"inspector",
"trace"
]
| train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCError/Inspector.php#L110-L132 |
ClanCats/Core | src/classes/CCError/Inspector.php | CCError_Inspector.tables | public function tables()
{
$tables = array();
foreach( static::$info_callbacks as $name => $callback )
{
$tables[$name] = call_user_func( $callback );
}
return array_merge( $tables , array(
'Server / request data' => $_SERVER,
'Get parameters' => $_GET,
'Post parameters' => $_POST,
'Cookies' => $_COOKIE,
'Files' => $_FILES,
));
} | php | public function tables()
{
$tables = array();
foreach( static::$info_callbacks as $name => $callback )
{
$tables[$name] = call_user_func( $callback );
}
return array_merge( $tables , array(
'Server / request data' => $_SERVER,
'Get parameters' => $_GET,
'Post parameters' => $_POST,
'Cookies' => $_COOKIE,
'Files' => $_FILES,
));
} | [
"public",
"function",
"tables",
"(",
")",
"{",
"$",
"tables",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"static",
"::",
"$",
"info_callbacks",
"as",
"$",
"name",
"=>",
"$",
"callback",
")",
"{",
"$",
"tables",
"[",
"$",
"name",
"]",
"=",
"call_user_func",
"(",
"$",
"callback",
")",
";",
"}",
"return",
"array_merge",
"(",
"$",
"tables",
",",
"array",
"(",
"'Server / request data'",
"=>",
"$",
"_SERVER",
",",
"'Get parameters'",
"=>",
"$",
"_GET",
",",
"'Post parameters'",
"=>",
"$",
"_POST",
",",
"'Cookies'",
"=>",
"$",
"_COOKIE",
",",
"'Files'",
"=>",
"$",
"_FILES",
",",
")",
")",
";",
"}"
]
| returns all debug tables
@return array | [
"returns",
"all",
"debug",
"tables"
]
| train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCError/Inspector.php#L139-L155 |
Ocramius/OcraDiCompiler | src/OcraDiCompiler/ServiceManager/Di/DiAbstractServiceFactory.php | DiAbstractServiceFactory.createServiceWithName | public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $serviceName, $requestedName)
{
$this->serviceLocator = $serviceLocator;
return $this->get($requestedName);
} | php | public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $serviceName, $requestedName)
{
$this->serviceLocator = $serviceLocator;
return $this->get($requestedName);
} | [
"public",
"function",
"createServiceWithName",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
",",
"$",
"serviceName",
",",
"$",
"requestedName",
")",
"{",
"$",
"this",
"->",
"serviceLocator",
"=",
"$",
"serviceLocator",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"requestedName",
")",
";",
"}"
]
| {@inheritDoc} | [
"{"
]
| train | https://github.com/Ocramius/OcraDiCompiler/blob/667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a/src/OcraDiCompiler/ServiceManager/Di/DiAbstractServiceFactory.php#L79-L84 |
Ocramius/OcraDiCompiler | src/OcraDiCompiler/ServiceManager/Di/DiAbstractServiceFactory.php | DiAbstractServiceFactory.get | public function get($name, array $params = array())
{
if (null === $this->serviceLocator) {
throw new DomainException('No ServiceLocator defined, use `createServiceWithName` instead of `get`');
}
if (self::USE_SL_BEFORE_DI === $this->useServiceLocator && $this->serviceLocator->has($name)) {
return $this->serviceLocator->get($name);
}
try {
return parent::get($name, $params);
} catch (ClassNotFoundException $e) {
if (self::USE_SL_AFTER_DI === $this->useServiceLocator && $this->serviceLocator->has($name)) {
return $this->serviceLocator->get($name);
}
throw new Exception\ServiceNotFoundException(
sprintf('Service %s was not found in this DI instance', $name),
null,
$e
);
}
} | php | public function get($name, array $params = array())
{
if (null === $this->serviceLocator) {
throw new DomainException('No ServiceLocator defined, use `createServiceWithName` instead of `get`');
}
if (self::USE_SL_BEFORE_DI === $this->useServiceLocator && $this->serviceLocator->has($name)) {
return $this->serviceLocator->get($name);
}
try {
return parent::get($name, $params);
} catch (ClassNotFoundException $e) {
if (self::USE_SL_AFTER_DI === $this->useServiceLocator && $this->serviceLocator->has($name)) {
return $this->serviceLocator->get($name);
}
throw new Exception\ServiceNotFoundException(
sprintf('Service %s was not found in this DI instance', $name),
null,
$e
);
}
} | [
"public",
"function",
"get",
"(",
"$",
"name",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"serviceLocator",
")",
"{",
"throw",
"new",
"DomainException",
"(",
"'No ServiceLocator defined, use `createServiceWithName` instead of `get`'",
")",
";",
"}",
"if",
"(",
"self",
"::",
"USE_SL_BEFORE_DI",
"===",
"$",
"this",
"->",
"useServiceLocator",
"&&",
"$",
"this",
"->",
"serviceLocator",
"->",
"has",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"this",
"->",
"serviceLocator",
"->",
"get",
"(",
"$",
"name",
")",
";",
"}",
"try",
"{",
"return",
"parent",
"::",
"get",
"(",
"$",
"name",
",",
"$",
"params",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"$",
"e",
")",
"{",
"if",
"(",
"self",
"::",
"USE_SL_AFTER_DI",
"===",
"$",
"this",
"->",
"useServiceLocator",
"&&",
"$",
"this",
"->",
"serviceLocator",
"->",
"has",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"this",
"->",
"serviceLocator",
"->",
"get",
"(",
"$",
"name",
")",
";",
"}",
"throw",
"new",
"Exception",
"\\",
"ServiceNotFoundException",
"(",
"sprintf",
"(",
"'Service %s was not found in this DI instance'",
",",
"$",
"name",
")",
",",
"null",
",",
"$",
"e",
")",
";",
"}",
"}"
]
| Overrides Zend\Di to allow the given serviceLocator's services to be reused by Di itself
{@inheritDoc} | [
"Overrides",
"Zend",
"\\",
"Di",
"to",
"allow",
"the",
"given",
"serviceLocator",
"s",
"services",
"to",
"be",
"reused",
"by",
"Di",
"itself"
]
| train | https://github.com/Ocramius/OcraDiCompiler/blob/667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a/src/OcraDiCompiler/ServiceManager/Di/DiAbstractServiceFactory.php#L91-L114 |
Ocramius/OcraDiCompiler | src/OcraDiCompiler/ServiceManager/Di/DiAbstractServiceFactory.php | DiAbstractServiceFactory.canCreateServiceWithName | public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
{
return $this->instanceManager->hasSharedInstance($requestedName)
|| $this->instanceManager->hasAlias($requestedName)
|| $this->instanceManager->hasConfig($requestedName)
|| $this->instanceManager->hasTypePreferences($requestedName)
|| $this->definitions->hasClass($requestedName);
} | php | public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
{
return $this->instanceManager->hasSharedInstance($requestedName)
|| $this->instanceManager->hasAlias($requestedName)
|| $this->instanceManager->hasConfig($requestedName)
|| $this->instanceManager->hasTypePreferences($requestedName)
|| $this->definitions->hasClass($requestedName);
} | [
"public",
"function",
"canCreateServiceWithName",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
",",
"$",
"name",
",",
"$",
"requestedName",
")",
"{",
"return",
"$",
"this",
"->",
"instanceManager",
"->",
"hasSharedInstance",
"(",
"$",
"requestedName",
")",
"||",
"$",
"this",
"->",
"instanceManager",
"->",
"hasAlias",
"(",
"$",
"requestedName",
")",
"||",
"$",
"this",
"->",
"instanceManager",
"->",
"hasConfig",
"(",
"$",
"requestedName",
")",
"||",
"$",
"this",
"->",
"instanceManager",
"->",
"hasTypePreferences",
"(",
"$",
"requestedName",
")",
"||",
"$",
"this",
"->",
"definitions",
"->",
"hasClass",
"(",
"$",
"requestedName",
")",
";",
"}"
]
| {@inheritDoc} | [
"{"
]
| train | https://github.com/Ocramius/OcraDiCompiler/blob/667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a/src/OcraDiCompiler/ServiceManager/Di/DiAbstractServiceFactory.php#L119-L126 |
webforge-labs/psc-cms | lib/Psc/Data/SetMeta.php | SetMeta.getFieldType | public function getFieldType($field) {
try {
$key = $this->getKey($field);
// dies kann auch einen verschachtelten Array von Types zurück geben, wenn der Schlüssel den man angibt noch Untertypen hat
return $this->types->get($key, DataInput::THROW_EXCEPTION, DataInput::THROW_EXCEPTION);
} catch (\Psc\DataInputException $e) {
$e = new FieldNotDefinedException(sprintf("Feld mit den Schluessel(n) '%s' ist nicht in Meta definiert. Vorhanden sind (Ebenen durch . getrennt): %s",
$key, implode(', ', $avFields = $this->getKeys())),
0, $e);
$e->field = explode(':',$key); // expand
$e->avaibleFields = $avFields;
throw $e;
}
} | php | public function getFieldType($field) {
try {
$key = $this->getKey($field);
// dies kann auch einen verschachtelten Array von Types zurück geben, wenn der Schlüssel den man angibt noch Untertypen hat
return $this->types->get($key, DataInput::THROW_EXCEPTION, DataInput::THROW_EXCEPTION);
} catch (\Psc\DataInputException $e) {
$e = new FieldNotDefinedException(sprintf("Feld mit den Schluessel(n) '%s' ist nicht in Meta definiert. Vorhanden sind (Ebenen durch . getrennt): %s",
$key, implode(', ', $avFields = $this->getKeys())),
0, $e);
$e->field = explode(':',$key); // expand
$e->avaibleFields = $avFields;
throw $e;
}
} | [
"public",
"function",
"getFieldType",
"(",
"$",
"field",
")",
"{",
"try",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getKey",
"(",
"$",
"field",
")",
";",
"// dies kann auch einen verschachtelten Array von Types zurück geben, wenn der Schlüssel den man angibt noch Untertypen hat",
"return",
"$",
"this",
"->",
"types",
"->",
"get",
"(",
"$",
"key",
",",
"DataInput",
"::",
"THROW_EXCEPTION",
",",
"DataInput",
"::",
"THROW_EXCEPTION",
")",
";",
"}",
"catch",
"(",
"\\",
"Psc",
"\\",
"DataInputException",
"$",
"e",
")",
"{",
"$",
"e",
"=",
"new",
"FieldNotDefinedException",
"(",
"sprintf",
"(",
"\"Feld mit den Schluessel(n) '%s' ist nicht in Meta definiert. Vorhanden sind (Ebenen durch . getrennt): %s\"",
",",
"$",
"key",
",",
"implode",
"(",
"', '",
",",
"$",
"avFields",
"=",
"$",
"this",
"->",
"getKeys",
"(",
")",
")",
")",
",",
"0",
",",
"$",
"e",
")",
";",
"$",
"e",
"->",
"field",
"=",
"explode",
"(",
"':'",
",",
"$",
"key",
")",
";",
"// expand",
"$",
"e",
"->",
"avaibleFields",
"=",
"$",
"avFields",
";",
"throw",
"$",
"e",
";",
"}",
"}"
]
| Gibt den Typ eines Feldes zurück
@param string|array wenn string dann ebenen mit . getrennt
@return Webforge\Types
@throws FieldNotDefinedException | [
"Gibt",
"den",
"Typ",
"eines",
"Feldes",
"zurück"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Data/SetMeta.php#L33-L48 |
webforge-labs/psc-cms | lib/Psc/Data/SetMeta.php | SetMeta.setFieldType | public function setFieldType($field, Type $type) {
$this->types->set($this->getKey($field), $type);
return $this;
} | php | public function setFieldType($field, Type $type) {
$this->types->set($this->getKey($field), $type);
return $this;
} | [
"public",
"function",
"setFieldType",
"(",
"$",
"field",
",",
"Type",
"$",
"type",
")",
"{",
"$",
"this",
"->",
"types",
"->",
"set",
"(",
"$",
"this",
"->",
"getKey",
"(",
"$",
"field",
")",
",",
"$",
"type",
")",
";",
"return",
"$",
"this",
";",
"}"
]
| Setzt den Typ für ein Feld
wenn das Feld nicht existiert, wird es angelegt
@param string|array wenn string dann ebenen mit . getrennt | [
"Setzt",
"den",
"Typ",
"für",
"ein",
"Feld"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Data/SetMeta.php#L63-L66 |
webforge-labs/psc-cms | lib/Psc/Data/SetMeta.php | SetMeta.getTypes | public function getTypes() {
$typesExport = array();
foreach ($this->types->toArray() as $key => $type) {
$typesExport[str_replace(':','.',$key)] = $type;
}
return $typesExport;
} | php | public function getTypes() {
$typesExport = array();
foreach ($this->types->toArray() as $key => $type) {
$typesExport[str_replace(':','.',$key)] = $type;
}
return $typesExport;
} | [
"public",
"function",
"getTypes",
"(",
")",
"{",
"$",
"typesExport",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"types",
"->",
"toArray",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"type",
")",
"{",
"$",
"typesExport",
"[",
"str_replace",
"(",
"':'",
",",
"'.'",
",",
"$",
"key",
")",
"]",
"=",
"$",
"type",
";",
"}",
"return",
"$",
"typesExport",
";",
"}"
]
| Gibt alle Typen zurück
@return array die Schlüssel des Arrays sind mit . getrennt (und umspannen alle Ebenen) | [
"Gibt",
"alle",
"Typen",
"zurück"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Data/SetMeta.php#L101-L107 |
kuria/event | src/ObservableTrait.php | ObservableTrait.on | function on(string $event, $callback, int $priority = 0): void
{
$this->getEventEmitter()->on($event, $callback, $priority);
} | php | function on(string $event, $callback, int $priority = 0): void
{
$this->getEventEmitter()->on($event, $callback, $priority);
} | [
"function",
"on",
"(",
"string",
"$",
"event",
",",
"$",
"callback",
",",
"int",
"$",
"priority",
"=",
"0",
")",
":",
"void",
"{",
"$",
"this",
"->",
"getEventEmitter",
"(",
")",
"->",
"on",
"(",
"$",
"event",
",",
"$",
"callback",
",",
"$",
"priority",
")",
";",
"}"
]
| Register a callback | [
"Register",
"a",
"callback"
]
| train | https://github.com/kuria/event/blob/9ee95e751270831d5aca04f3a34a2e03b786ff41/src/ObservableTrait.php#L19-L22 |
kuria/event | src/ObservableTrait.php | ObservableTrait.off | function off(string $event, $callback): bool
{
return $this->getEventEmitter()->off($event, $callback);
} | php | function off(string $event, $callback): bool
{
return $this->getEventEmitter()->off($event, $callback);
} | [
"function",
"off",
"(",
"string",
"$",
"event",
",",
"$",
"callback",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"getEventEmitter",
"(",
")",
"->",
"off",
"(",
"$",
"event",
",",
"$",
"callback",
")",
";",
"}"
]
| Unregister a callback | [
"Unregister",
"a",
"callback"
]
| train | https://github.com/kuria/event/blob/9ee95e751270831d5aca04f3a34a2e03b786ff41/src/ObservableTrait.php#L27-L30 |
kuria/event | src/ObservableTrait.php | ObservableTrait.emit | function emit(string $event, ...$args): void
{
// only emit if the event emitter has been initialized already
// (if it has not been initialized, there can be no listeners)
if ($this->eventEmitter) {
$this->eventEmitter->emit($event, ...$args);
}
} | php | function emit(string $event, ...$args): void
{
// only emit if the event emitter has been initialized already
// (if it has not been initialized, there can be no listeners)
if ($this->eventEmitter) {
$this->eventEmitter->emit($event, ...$args);
}
} | [
"function",
"emit",
"(",
"string",
"$",
"event",
",",
"...",
"$",
"args",
")",
":",
"void",
"{",
"// only emit if the event emitter has been initialized already",
"// (if it has not been initialized, there can be no listeners)",
"if",
"(",
"$",
"this",
"->",
"eventEmitter",
")",
"{",
"$",
"this",
"->",
"eventEmitter",
"->",
"emit",
"(",
"$",
"event",
",",
"...",
"$",
"args",
")",
";",
"}",
"}"
]
| Emit an event | [
"Emit",
"an",
"event"
]
| train | https://github.com/kuria/event/blob/9ee95e751270831d5aca04f3a34a2e03b786ff41/src/ObservableTrait.php#L51-L58 |
fubhy/graphql-php | src/Type/Definition/Types/AbstractType.php | AbstractType.getTypeOf | public function getTypeOf($value)
{
foreach ($this->getPossibleTypes() as $type) {
if ($isTypeOf = $type->isTypeOf($value)) {
return $type;
}
if (!isset($isTypeOf)) {
throw new \Exception(sprintf(
'Non-Object Type %s does not implement resolveType and Object ' .
'Type %s does not implement isTypeOf. There is no way to ' .
'determine if a value is of this type.', $this->getName(), $type->getName()
));
}
}
return NULL;
} | php | public function getTypeOf($value)
{
foreach ($this->getPossibleTypes() as $type) {
if ($isTypeOf = $type->isTypeOf($value)) {
return $type;
}
if (!isset($isTypeOf)) {
throw new \Exception(sprintf(
'Non-Object Type %s does not implement resolveType and Object ' .
'Type %s does not implement isTypeOf. There is no way to ' .
'determine if a value is of this type.', $this->getName(), $type->getName()
));
}
}
return NULL;
} | [
"public",
"function",
"getTypeOf",
"(",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getPossibleTypes",
"(",
")",
"as",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"isTypeOf",
"=",
"$",
"type",
"->",
"isTypeOf",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"type",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"isTypeOf",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"sprintf",
"(",
"'Non-Object Type %s does not implement resolveType and Object '",
".",
"'Type %s does not implement isTypeOf. There is no way to '",
".",
"'determine if a value is of this type.'",
",",
"$",
"this",
"->",
"getName",
"(",
")",
",",
"$",
"type",
"->",
"getName",
"(",
")",
")",
")",
";",
"}",
"}",
"return",
"NULL",
";",
"}"
]
| @param mixed $value
@return \Fubhy\GraphQL\Type\Definition\Types\ObjectType|null
@throws \Exception | [
"@param",
"mixed",
"$value"
]
| train | https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Type/Definition/Types/AbstractType.php#L14-L31 |
phpmob/changmin | src/PhpMob/CmsBundle/Translation/AddDefinedTranslation.php | AddDefinedTranslation.addTranslations | public function addTranslations(DefinedTranslationInterface $definedTranslation)
{
$translations = $definedTranslation->getDefinedTranslations();
if (empty($translations)) {
return;
}
foreach ($translations as $localeCode => $messages) {
if (empty($messages) || !$this->isValidLocaleCode($localeCode)) {
continue;
}
$this->translator->getCatalogue($localeCode)->addCatalogue(
(new ArrayLoader())->load($messages, $localeCode)
);
}
} | php | public function addTranslations(DefinedTranslationInterface $definedTranslation)
{
$translations = $definedTranslation->getDefinedTranslations();
if (empty($translations)) {
return;
}
foreach ($translations as $localeCode => $messages) {
if (empty($messages) || !$this->isValidLocaleCode($localeCode)) {
continue;
}
$this->translator->getCatalogue($localeCode)->addCatalogue(
(new ArrayLoader())->load($messages, $localeCode)
);
}
} | [
"public",
"function",
"addTranslations",
"(",
"DefinedTranslationInterface",
"$",
"definedTranslation",
")",
"{",
"$",
"translations",
"=",
"$",
"definedTranslation",
"->",
"getDefinedTranslations",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"translations",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"translations",
"as",
"$",
"localeCode",
"=>",
"$",
"messages",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"messages",
")",
"||",
"!",
"$",
"this",
"->",
"isValidLocaleCode",
"(",
"$",
"localeCode",
")",
")",
"{",
"continue",
";",
"}",
"$",
"this",
"->",
"translator",
"->",
"getCatalogue",
"(",
"$",
"localeCode",
")",
"->",
"addCatalogue",
"(",
"(",
"new",
"ArrayLoader",
"(",
")",
")",
"->",
"load",
"(",
"$",
"messages",
",",
"$",
"localeCode",
")",
")",
";",
"}",
"}"
]
| {@inheritdoc} | [
"{"
]
| train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CmsBundle/Translation/AddDefinedTranslation.php#L57-L74 |
phpmob/changmin | src/PhpMob/MediaBundle/Util/Base64ToFile.php | Base64ToFile.createFileInfo | public static function createFileInfo(string $base64String): \SplFileInfo
{
preg_match('/data:(.*);/', $base64String, $matchMime);
preg_match('/data:image\/(.*);base64/', $base64String, $matchExt);
$fileName = sprintf('/%s.%s', uniqid(), $matchExt[1]);
$outputFile = sys_get_temp_dir() . $fileName;
$fileResource = fopen($outputFile, 'wb');
$base64Data = explode(',', $base64String);
fwrite($fileResource, base64_decode($base64Data[1]));
fclose($fileResource);
return new \SplFileInfo($outputFile);
} | php | public static function createFileInfo(string $base64String): \SplFileInfo
{
preg_match('/data:(.*);/', $base64String, $matchMime);
preg_match('/data:image\/(.*);base64/', $base64String, $matchExt);
$fileName = sprintf('/%s.%s', uniqid(), $matchExt[1]);
$outputFile = sys_get_temp_dir() . $fileName;
$fileResource = fopen($outputFile, 'wb');
$base64Data = explode(',', $base64String);
fwrite($fileResource, base64_decode($base64Data[1]));
fclose($fileResource);
return new \SplFileInfo($outputFile);
} | [
"public",
"static",
"function",
"createFileInfo",
"(",
"string",
"$",
"base64String",
")",
":",
"\\",
"SplFileInfo",
"{",
"preg_match",
"(",
"'/data:(.*);/'",
",",
"$",
"base64String",
",",
"$",
"matchMime",
")",
";",
"preg_match",
"(",
"'/data:image\\/(.*);base64/'",
",",
"$",
"base64String",
",",
"$",
"matchExt",
")",
";",
"$",
"fileName",
"=",
"sprintf",
"(",
"'/%s.%s'",
",",
"uniqid",
"(",
")",
",",
"$",
"matchExt",
"[",
"1",
"]",
")",
";",
"$",
"outputFile",
"=",
"sys_get_temp_dir",
"(",
")",
".",
"$",
"fileName",
";",
"$",
"fileResource",
"=",
"fopen",
"(",
"$",
"outputFile",
",",
"'wb'",
")",
";",
"$",
"base64Data",
"=",
"explode",
"(",
"','",
",",
"$",
"base64String",
")",
";",
"fwrite",
"(",
"$",
"fileResource",
",",
"base64_decode",
"(",
"$",
"base64Data",
"[",
"1",
"]",
")",
")",
";",
"fclose",
"(",
"$",
"fileResource",
")",
";",
"return",
"new",
"\\",
"SplFileInfo",
"(",
"$",
"outputFile",
")",
";",
"}"
]
| @param string $base64String
@return \SplFileInfo | [
"@param",
"string",
"$base64String"
]
| train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/MediaBundle/Util/Base64ToFile.php#L26-L40 |
phpmob/changmin | src/PhpMob/MediaBundle/Util/Base64ToFile.php | Base64ToFile.createUploadedFile | public static function createUploadedFile(string $base64String): UploadedFile
{
$file = self::createFileInfo($base64String);
return new UploadedFile(
$file->getRealPath(), $file->getFilename(), mime_content_type($file->getRealPath())
);
} | php | public static function createUploadedFile(string $base64String): UploadedFile
{
$file = self::createFileInfo($base64String);
return new UploadedFile(
$file->getRealPath(), $file->getFilename(), mime_content_type($file->getRealPath())
);
} | [
"public",
"static",
"function",
"createUploadedFile",
"(",
"string",
"$",
"base64String",
")",
":",
"UploadedFile",
"{",
"$",
"file",
"=",
"self",
"::",
"createFileInfo",
"(",
"$",
"base64String",
")",
";",
"return",
"new",
"UploadedFile",
"(",
"$",
"file",
"->",
"getRealPath",
"(",
")",
",",
"$",
"file",
"->",
"getFilename",
"(",
")",
",",
"mime_content_type",
"(",
"$",
"file",
"->",
"getRealPath",
"(",
")",
")",
")",
";",
"}"
]
| @param string $base64String
@return UploadedFile | [
"@param",
"string",
"$base64String"
]
| train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/MediaBundle/Util/Base64ToFile.php#L47-L54 |
anexia-it/anexia-laravel-encryption | src/DatabaseEncryptionQueryBuilder.php | DatabaseEncryptionQueryBuilder.addEncryptionSelect | public function addEncryptionSelect($column = [])
{
$columnName = (isset($column['alias']) && !empty($column['alias'])) ? $column['alias'] : $column['column'];
$this->encryptionColumns[$columnName] = $column;
return $this;
} | php | public function addEncryptionSelect($column = [])
{
$columnName = (isset($column['alias']) && !empty($column['alias'])) ? $column['alias'] : $column['column'];
$this->encryptionColumns[$columnName] = $column;
return $this;
} | [
"public",
"function",
"addEncryptionSelect",
"(",
"$",
"column",
"=",
"[",
"]",
")",
"{",
"$",
"columnName",
"=",
"(",
"isset",
"(",
"$",
"column",
"[",
"'alias'",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"column",
"[",
"'alias'",
"]",
")",
")",
"?",
"$",
"column",
"[",
"'alias'",
"]",
":",
"$",
"column",
"[",
"'column'",
"]",
";",
"$",
"this",
"->",
"encryptionColumns",
"[",
"$",
"columnName",
"]",
"=",
"$",
"column",
";",
"return",
"$",
"this",
";",
"}"
]
| Add a new select encryption_column to the query.
@param array $column; array with [originalColumnName => selectValue]
@return $this | [
"Add",
"a",
"new",
"select",
"encryption_column",
"to",
"the",
"query",
"."
]
| train | https://github.com/anexia-it/anexia-laravel-encryption/blob/b7c72d99916ebca2d2cf2dbab1d4c0f84e383081/src/DatabaseEncryptionQueryBuilder.php#L36-L42 |
anexia-it/anexia-laravel-encryption | src/DatabaseEncryptionQueryBuilder.php | DatabaseEncryptionQueryBuilder.get | public function get($columns = ['*'])
{
$original = $this->columns;
if (is_null($original)) {
$this->columns = $columns;
}
// encrypted columns replace their default (original) columns
if ($this->encryptionModel instanceof Model
&& method_exists($this->encryptionModel, 'getEncryptKey')
) {
$model = $this->encryptionModel;
$modelEncryptionColumns = $model::getEncryptedFields();
if (!empty($modelEncryptionColumns)) {
if ($columns == ['*']) {
$this->columns = [];
/*
* Select all visible columns (avoid select *)
*/
$visibles = array_diff(array_merge($model->getFillable(), $model->getGuarded()), $model->getHidden());
$unencryptedVisibles = array_unique(array_diff($visibles, array_column($this->encryptionColumns, 'column')));
sort($unencryptedVisibles);
$primaryKey = [
$model->getKeyName()
];
$attributes = array_merge($primaryKey, $unencryptedVisibles);
if ($model->usesTimestamps()) {
$attributes[] = $model->getCreatedAtColumn();
$attributes[] = $model->getUpdatedAtColumn();
}
// add all visible unencrypted columns
foreach ($attributes as $attribute) {
$this->columns[] = $attribute;
}
// add all encrypted columns
$this->columns = array_merge($this->columns, array_column($this->encryptionColumns, 'select'));
} else {
$this->columns = [];
// add all visible unencrypted columns
$encryptionColumnNames = array_column($this->encryptionColumns, 'column');
foreach ($columns as $column) {
if (!in_array($column, $encryptionColumnNames)) {
$this->columns[] = $column;
}
}
// add the encrypted columns (and decrypted, if 'withDecryptionKey' was given)
foreach ($this->encryptionColumns as $encryptionColumn){
if (in_array($encryptionColumn['column'], $columns)) {
$this->columns[] = $encryptionColumn['select'];
}
}
}
}
}
$results = $this->processor->processSelect($this, $this->runSelect());
$this->columns = $original;
return collect($results);
} | php | public function get($columns = ['*'])
{
$original = $this->columns;
if (is_null($original)) {
$this->columns = $columns;
}
// encrypted columns replace their default (original) columns
if ($this->encryptionModel instanceof Model
&& method_exists($this->encryptionModel, 'getEncryptKey')
) {
$model = $this->encryptionModel;
$modelEncryptionColumns = $model::getEncryptedFields();
if (!empty($modelEncryptionColumns)) {
if ($columns == ['*']) {
$this->columns = [];
/*
* Select all visible columns (avoid select *)
*/
$visibles = array_diff(array_merge($model->getFillable(), $model->getGuarded()), $model->getHidden());
$unencryptedVisibles = array_unique(array_diff($visibles, array_column($this->encryptionColumns, 'column')));
sort($unencryptedVisibles);
$primaryKey = [
$model->getKeyName()
];
$attributes = array_merge($primaryKey, $unencryptedVisibles);
if ($model->usesTimestamps()) {
$attributes[] = $model->getCreatedAtColumn();
$attributes[] = $model->getUpdatedAtColumn();
}
// add all visible unencrypted columns
foreach ($attributes as $attribute) {
$this->columns[] = $attribute;
}
// add all encrypted columns
$this->columns = array_merge($this->columns, array_column($this->encryptionColumns, 'select'));
} else {
$this->columns = [];
// add all visible unencrypted columns
$encryptionColumnNames = array_column($this->encryptionColumns, 'column');
foreach ($columns as $column) {
if (!in_array($column, $encryptionColumnNames)) {
$this->columns[] = $column;
}
}
// add the encrypted columns (and decrypted, if 'withDecryptionKey' was given)
foreach ($this->encryptionColumns as $encryptionColumn){
if (in_array($encryptionColumn['column'], $columns)) {
$this->columns[] = $encryptionColumn['select'];
}
}
}
}
}
$results = $this->processor->processSelect($this, $this->runSelect());
$this->columns = $original;
return collect($results);
} | [
"public",
"function",
"get",
"(",
"$",
"columns",
"=",
"[",
"'*'",
"]",
")",
"{",
"$",
"original",
"=",
"$",
"this",
"->",
"columns",
";",
"if",
"(",
"is_null",
"(",
"$",
"original",
")",
")",
"{",
"$",
"this",
"->",
"columns",
"=",
"$",
"columns",
";",
"}",
"// encrypted columns replace their default (original) columns",
"if",
"(",
"$",
"this",
"->",
"encryptionModel",
"instanceof",
"Model",
"&&",
"method_exists",
"(",
"$",
"this",
"->",
"encryptionModel",
",",
"'getEncryptKey'",
")",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"encryptionModel",
";",
"$",
"modelEncryptionColumns",
"=",
"$",
"model",
"::",
"getEncryptedFields",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"modelEncryptionColumns",
")",
")",
"{",
"if",
"(",
"$",
"columns",
"==",
"[",
"'*'",
"]",
")",
"{",
"$",
"this",
"->",
"columns",
"=",
"[",
"]",
";",
"/*\n * Select all visible columns (avoid select *)\n */",
"$",
"visibles",
"=",
"array_diff",
"(",
"array_merge",
"(",
"$",
"model",
"->",
"getFillable",
"(",
")",
",",
"$",
"model",
"->",
"getGuarded",
"(",
")",
")",
",",
"$",
"model",
"->",
"getHidden",
"(",
")",
")",
";",
"$",
"unencryptedVisibles",
"=",
"array_unique",
"(",
"array_diff",
"(",
"$",
"visibles",
",",
"array_column",
"(",
"$",
"this",
"->",
"encryptionColumns",
",",
"'column'",
")",
")",
")",
";",
"sort",
"(",
"$",
"unencryptedVisibles",
")",
";",
"$",
"primaryKey",
"=",
"[",
"$",
"model",
"->",
"getKeyName",
"(",
")",
"]",
";",
"$",
"attributes",
"=",
"array_merge",
"(",
"$",
"primaryKey",
",",
"$",
"unencryptedVisibles",
")",
";",
"if",
"(",
"$",
"model",
"->",
"usesTimestamps",
"(",
")",
")",
"{",
"$",
"attributes",
"[",
"]",
"=",
"$",
"model",
"->",
"getCreatedAtColumn",
"(",
")",
";",
"$",
"attributes",
"[",
"]",
"=",
"$",
"model",
"->",
"getUpdatedAtColumn",
"(",
")",
";",
"}",
"// add all visible unencrypted columns",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"attribute",
")",
"{",
"$",
"this",
"->",
"columns",
"[",
"]",
"=",
"$",
"attribute",
";",
"}",
"// add all encrypted columns",
"$",
"this",
"->",
"columns",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"columns",
",",
"array_column",
"(",
"$",
"this",
"->",
"encryptionColumns",
",",
"'select'",
")",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"columns",
"=",
"[",
"]",
";",
"// add all visible unencrypted columns",
"$",
"encryptionColumnNames",
"=",
"array_column",
"(",
"$",
"this",
"->",
"encryptionColumns",
",",
"'column'",
")",
";",
"foreach",
"(",
"$",
"columns",
"as",
"$",
"column",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"column",
",",
"$",
"encryptionColumnNames",
")",
")",
"{",
"$",
"this",
"->",
"columns",
"[",
"]",
"=",
"$",
"column",
";",
"}",
"}",
"// add the encrypted columns (and decrypted, if 'withDecryptionKey' was given)",
"foreach",
"(",
"$",
"this",
"->",
"encryptionColumns",
"as",
"$",
"encryptionColumn",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"encryptionColumn",
"[",
"'column'",
"]",
",",
"$",
"columns",
")",
")",
"{",
"$",
"this",
"->",
"columns",
"[",
"]",
"=",
"$",
"encryptionColumn",
"[",
"'select'",
"]",
";",
"}",
"}",
"}",
"}",
"}",
"$",
"results",
"=",
"$",
"this",
"->",
"processor",
"->",
"processSelect",
"(",
"$",
"this",
",",
"$",
"this",
"->",
"runSelect",
"(",
")",
")",
";",
"$",
"this",
"->",
"columns",
"=",
"$",
"original",
";",
"return",
"collect",
"(",
"$",
"results",
")",
";",
"}"
]
| Execute the query as a "select" statement.
@param array $columns
@return \Illuminate\Support\Collection | [
"Execute",
"the",
"query",
"as",
"a",
"select",
"statement",
"."
]
| train | https://github.com/anexia-it/anexia-laravel-encryption/blob/b7c72d99916ebca2d2cf2dbab1d4c0f84e383081/src/DatabaseEncryptionQueryBuilder.php#L50-L118 |
jpcercal/resource-query-language | src/ExprBuilder.php | ExprBuilder.between | public function between($field, $from, $to)
{
$this->enqueue(new BetweenExpr($field, $from, $to));
return $this;
} | php | public function between($field, $from, $to)
{
$this->enqueue(new BetweenExpr($field, $from, $to));
return $this;
} | [
"public",
"function",
"between",
"(",
"$",
"field",
",",
"$",
"from",
",",
"$",
"to",
")",
"{",
"$",
"this",
"->",
"enqueue",
"(",
"new",
"BetweenExpr",
"(",
"$",
"field",
",",
"$",
"from",
",",
"$",
"to",
")",
")",
";",
"return",
"$",
"this",
";",
"}"
]
| @param string $field
@param string $from
@param string $to
@return ExprBuilder | [
"@param",
"string",
"$field",
"@param",
"string",
"$from",
"@param",
"string",
"$to"
]
| train | https://github.com/jpcercal/resource-query-language/blob/2a1520198c717a8199cd8d3d85ca2557e24cb7f5/src/ExprBuilder.php#L44-L49 |
atkrad/data-tables | src/Extension/ColReorder.php | ColReorder.setReorderCallback | public function setReorderCallback($reorderCallback)
{
$hash = sha1($reorderCallback);
$this->properties['reorderCallback'] = $hash;
$this->callbacks[$hash] = $reorderCallback;
return $this;
} | php | public function setReorderCallback($reorderCallback)
{
$hash = sha1($reorderCallback);
$this->properties['reorderCallback'] = $hash;
$this->callbacks[$hash] = $reorderCallback;
return $this;
} | [
"public",
"function",
"setReorderCallback",
"(",
"$",
"reorderCallback",
")",
"{",
"$",
"hash",
"=",
"sha1",
"(",
"$",
"reorderCallback",
")",
";",
"$",
"this",
"->",
"properties",
"[",
"'reorderCallback'",
"]",
"=",
"$",
"hash",
";",
"$",
"this",
"->",
"callbacks",
"[",
"$",
"hash",
"]",
"=",
"$",
"reorderCallback",
";",
"return",
"$",
"this",
";",
"}"
]
| Callback function which can be used to perform actions when the columns have
been reordered.
Input parameters: void
Return parameter: void
@param string $reorderCallback Callback function which can be used to perform
actions when the columns have been reordered.
@return ColReorder
@see http://datatables.net/extensions/colreorder/options | [
"Callback",
"function",
"which",
"can",
"be",
"used",
"to",
"perform",
"actions",
"when",
"the",
"columns",
"have",
"been",
"reordered",
"."
]
| train | https://github.com/atkrad/data-tables/blob/5afcc337ab624ca626e29d9674459c5105982b16/src/Extension/ColReorder.php#L107-L114 |
kattsoftware/phassets | src/Phassets/AssetsMergers/NewLineAssetsMerger.php | NewLineAssetsMerger.mergeFilenames | public function mergeFilenames($assets, Asset $outputAsset)
{
$filename = '';
foreach($assets as $asset) {
$filename .= $asset->getFilename();
}
$outputAsset->setFilename(md5($filename));
} | php | public function mergeFilenames($assets, Asset $outputAsset)
{
$filename = '';
foreach($assets as $asset) {
$filename .= $asset->getFilename();
}
$outputAsset->setFilename(md5($filename));
} | [
"public",
"function",
"mergeFilenames",
"(",
"$",
"assets",
",",
"Asset",
"$",
"outputAsset",
")",
"{",
"$",
"filename",
"=",
"''",
";",
"foreach",
"(",
"$",
"assets",
"as",
"$",
"asset",
")",
"{",
"$",
"filename",
".=",
"$",
"asset",
"->",
"getFilename",
"(",
")",
";",
"}",
"$",
"outputAsset",
"->",
"setFilename",
"(",
"md5",
"(",
"$",
"filename",
")",
")",
";",
"}"
]
| Using an internal algorithm, try to create an unique filename of received assets,
writing the changes to $outputAsset::setFilename().
Note: There is no need to set the $outputAsset::setOutputExtension().
@param Asset[] $assets Array of assets for merging their filenames
@param Asset $outputAsset Asset Asset instance whose filenames should be
merged according to the internal algorithm.
@throws PhassetsInternalException If the merge of filenames cannot be performed | [
"Using",
"an",
"internal",
"algorithm",
"try",
"to",
"create",
"an",
"unique",
"filename",
"of",
"received",
"assets",
"writing",
"the",
"changes",
"to",
"$outputAsset",
"::",
"setFilename",
"()",
".",
"Note",
":",
"There",
"is",
"no",
"need",
"to",
"set",
"the",
"$outputAsset",
"::",
"setOutputExtension",
"()",
"."
]
| train | https://github.com/kattsoftware/phassets/blob/cc982cf1941eb5776287d64f027218bd4835ed2b/src/Phassets/AssetsMergers/NewLineAssetsMerger.php#L31-L40 |
kattsoftware/phassets | src/Phassets/AssetsMergers/NewLineAssetsMerger.php | NewLineAssetsMerger.mergeContents | public function mergeContents($assets, Asset $outputAsset)
{
$contents = '';
foreach ($assets as $asset) {
$contents .= $asset->getContents() . PHP_EOL;
}
$outputAsset->setContents($contents);
} | php | public function mergeContents($assets, Asset $outputAsset)
{
$contents = '';
foreach ($assets as $asset) {
$contents .= $asset->getContents() . PHP_EOL;
}
$outputAsset->setContents($contents);
} | [
"public",
"function",
"mergeContents",
"(",
"$",
"assets",
",",
"Asset",
"$",
"outputAsset",
")",
"{",
"$",
"contents",
"=",
"''",
";",
"foreach",
"(",
"$",
"assets",
"as",
"$",
"asset",
")",
"{",
"$",
"contents",
".=",
"$",
"asset",
"->",
"getContents",
"(",
")",
".",
"PHP_EOL",
";",
"}",
"$",
"outputAsset",
"->",
"setContents",
"(",
"$",
"contents",
")",
";",
"}"
]
| Using an internal algorithm, try to merge all contents of an array of assets,
writing the changes to $outputAsset::setContents().
@param Asset[] $assets Array of assets to be merged
@param Asset $outputAsset Asset Asset instance whose contents should be
modified according to the internal algorithm.
@throws PhassetsInternalException If the merge of contents cannot be performed | [
"Using",
"an",
"internal",
"algorithm",
"try",
"to",
"merge",
"all",
"contents",
"of",
"an",
"array",
"of",
"assets",
"writing",
"the",
"changes",
"to",
"$outputAsset",
"::",
"setContents",
"()",
"."
]
| train | https://github.com/kattsoftware/phassets/blob/cc982cf1941eb5776287d64f027218bd4835ed2b/src/Phassets/AssetsMergers/NewLineAssetsMerger.php#L51-L60 |
phpmob/changmin | src/PhpMob/MediaBundle/Form/Type/ImageType.php | ImageType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
$types = $this->imageTypeRegistry->getSectionTypes($this->getFilterSection());
if (!empty($types)) {
if (count($types) > 1) {
$builder->add('type', ChoiceType::class, [
'required' => false,
'label' => 'phpmob.form.image.type',
'placeholder' => 'phpmob.form.image.type',
'choices' => $types,
'choice_value' => 'code',
'choice_label' => 'label'
]);
} else {
$builder
->add('type', HiddenType::class, [
'data_class' => null,
'data' => $types[0],
])
->get('type')
->addViewTransformer(new ImageTypeTransformer($this->imageTypeRegistry))
;
}
}
$builder
->addEventListener(FormEvents::PRE_SUBMIT, [$this, 'convertBase64ImageListener'])
->add('file', FileType::class, [
'label' => 'phpmob.form.image.file',
'attr' => ['accept' => 'image/*'],
'required' => false,
])
->add('caption', TextType::class, [
'label' => 'phpmob.form.image.caption',
'attr' => [
'placeholder' => 'phpmob.form.image.caption',
],
'required' => false,
])
->add('shouldRemove', CheckboxType::class, [
'label' => 'phpmob.form.image.remove_file',
'required' => false,
])
;
} | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
$types = $this->imageTypeRegistry->getSectionTypes($this->getFilterSection());
if (!empty($types)) {
if (count($types) > 1) {
$builder->add('type', ChoiceType::class, [
'required' => false,
'label' => 'phpmob.form.image.type',
'placeholder' => 'phpmob.form.image.type',
'choices' => $types,
'choice_value' => 'code',
'choice_label' => 'label'
]);
} else {
$builder
->add('type', HiddenType::class, [
'data_class' => null,
'data' => $types[0],
])
->get('type')
->addViewTransformer(new ImageTypeTransformer($this->imageTypeRegistry))
;
}
}
$builder
->addEventListener(FormEvents::PRE_SUBMIT, [$this, 'convertBase64ImageListener'])
->add('file', FileType::class, [
'label' => 'phpmob.form.image.file',
'attr' => ['accept' => 'image/*'],
'required' => false,
])
->add('caption', TextType::class, [
'label' => 'phpmob.form.image.caption',
'attr' => [
'placeholder' => 'phpmob.form.image.caption',
],
'required' => false,
])
->add('shouldRemove', CheckboxType::class, [
'label' => 'phpmob.form.image.remove_file',
'required' => false,
])
;
} | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"types",
"=",
"$",
"this",
"->",
"imageTypeRegistry",
"->",
"getSectionTypes",
"(",
"$",
"this",
"->",
"getFilterSection",
"(",
")",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"types",
")",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"types",
")",
">",
"1",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"'type'",
",",
"ChoiceType",
"::",
"class",
",",
"[",
"'required'",
"=>",
"false",
",",
"'label'",
"=>",
"'phpmob.form.image.type'",
",",
"'placeholder'",
"=>",
"'phpmob.form.image.type'",
",",
"'choices'",
"=>",
"$",
"types",
",",
"'choice_value'",
"=>",
"'code'",
",",
"'choice_label'",
"=>",
"'label'",
"]",
")",
";",
"}",
"else",
"{",
"$",
"builder",
"->",
"add",
"(",
"'type'",
",",
"HiddenType",
"::",
"class",
",",
"[",
"'data_class'",
"=>",
"null",
",",
"'data'",
"=>",
"$",
"types",
"[",
"0",
"]",
",",
"]",
")",
"->",
"get",
"(",
"'type'",
")",
"->",
"addViewTransformer",
"(",
"new",
"ImageTypeTransformer",
"(",
"$",
"this",
"->",
"imageTypeRegistry",
")",
")",
";",
"}",
"}",
"$",
"builder",
"->",
"addEventListener",
"(",
"FormEvents",
"::",
"PRE_SUBMIT",
",",
"[",
"$",
"this",
",",
"'convertBase64ImageListener'",
"]",
")",
"->",
"add",
"(",
"'file'",
",",
"FileType",
"::",
"class",
",",
"[",
"'label'",
"=>",
"'phpmob.form.image.file'",
",",
"'attr'",
"=>",
"[",
"'accept'",
"=>",
"'image/*'",
"]",
",",
"'required'",
"=>",
"false",
",",
"]",
")",
"->",
"add",
"(",
"'caption'",
",",
"TextType",
"::",
"class",
",",
"[",
"'label'",
"=>",
"'phpmob.form.image.caption'",
",",
"'attr'",
"=>",
"[",
"'placeholder'",
"=>",
"'phpmob.form.image.caption'",
",",
"]",
",",
"'required'",
"=>",
"false",
",",
"]",
")",
"->",
"add",
"(",
"'shouldRemove'",
",",
"CheckboxType",
"::",
"class",
",",
"[",
"'label'",
"=>",
"'phpmob.form.image.remove_file'",
",",
"'required'",
"=>",
"false",
",",
"]",
")",
";",
"}"
]
| {@inheritdoc} | [
"{"
]
| train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/MediaBundle/Form/Type/ImageType.php#L51-L96 |
egeloen/IvorySerializerBundle | DependencyInjection/IvorySerializerExtension.php | IvorySerializerExtension.loadInternal | protected function loadInternal(array $config, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$resources = [
'cache',
'common',
'event',
'fos',
'mapping',
'navigator',
'registry',
'serializer',
'type',
'visitor',
];
foreach ($resources as $resource) {
$loader->load($resource.'.xml');
}
$this->loadEvent($config['event'], $container);
$this->loadMapping($config['mapping'], $container);
$this->loadTypes($config['types'], $container);
$this->loadVisitors($config['visitors'], $container);
} | php | protected function loadInternal(array $config, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$resources = [
'cache',
'common',
'event',
'fos',
'mapping',
'navigator',
'registry',
'serializer',
'type',
'visitor',
];
foreach ($resources as $resource) {
$loader->load($resource.'.xml');
}
$this->loadEvent($config['event'], $container);
$this->loadMapping($config['mapping'], $container);
$this->loadTypes($config['types'], $container);
$this->loadVisitors($config['visitors'], $container);
} | [
"protected",
"function",
"loadInternal",
"(",
"array",
"$",
"config",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"loader",
"=",
"new",
"XmlFileLoader",
"(",
"$",
"container",
",",
"new",
"FileLocator",
"(",
"__DIR__",
".",
"'/../Resources/config'",
")",
")",
";",
"$",
"resources",
"=",
"[",
"'cache'",
",",
"'common'",
",",
"'event'",
",",
"'fos'",
",",
"'mapping'",
",",
"'navigator'",
",",
"'registry'",
",",
"'serializer'",
",",
"'type'",
",",
"'visitor'",
",",
"]",
";",
"foreach",
"(",
"$",
"resources",
"as",
"$",
"resource",
")",
"{",
"$",
"loader",
"->",
"load",
"(",
"$",
"resource",
".",
"'.xml'",
")",
";",
"}",
"$",
"this",
"->",
"loadEvent",
"(",
"$",
"config",
"[",
"'event'",
"]",
",",
"$",
"container",
")",
";",
"$",
"this",
"->",
"loadMapping",
"(",
"$",
"config",
"[",
"'mapping'",
"]",
",",
"$",
"container",
")",
";",
"$",
"this",
"->",
"loadTypes",
"(",
"$",
"config",
"[",
"'types'",
"]",
",",
"$",
"container",
")",
";",
"$",
"this",
"->",
"loadVisitors",
"(",
"$",
"config",
"[",
"'visitors'",
"]",
",",
"$",
"container",
")",
";",
"}"
]
| {@inheritdoc} | [
"{"
]
| train | https://github.com/egeloen/IvorySerializerBundle/blob/a2bdd912bf715c61b823cf7257ee232d5c823dd3/DependencyInjection/IvorySerializerExtension.php#L44-L69 |
egeloen/IvorySerializerBundle | DependencyInjection/IvorySerializerExtension.php | IvorySerializerExtension.resolveMappingPaths | private function resolveMappingPaths(array $config, ContainerBuilder $container)
{
$paths = [];
if ($config['auto']['enabled']) {
$bundles = $container->getParameter('kernel.bundles');
foreach ($bundles as $bundle) {
$bundlePath = dirname((new \ReflectionClass($bundle))->getFileName());
foreach ($config['auto']['paths'] as $relativePath) {
$path = $bundlePath.'/'.$relativePath;
if (file_exists($path)) {
$paths[] = $path;
}
}
}
}
return array_merge($paths, $config['paths']);
} | php | private function resolveMappingPaths(array $config, ContainerBuilder $container)
{
$paths = [];
if ($config['auto']['enabled']) {
$bundles = $container->getParameter('kernel.bundles');
foreach ($bundles as $bundle) {
$bundlePath = dirname((new \ReflectionClass($bundle))->getFileName());
foreach ($config['auto']['paths'] as $relativePath) {
$path = $bundlePath.'/'.$relativePath;
if (file_exists($path)) {
$paths[] = $path;
}
}
}
}
return array_merge($paths, $config['paths']);
} | [
"private",
"function",
"resolveMappingPaths",
"(",
"array",
"$",
"config",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"paths",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"config",
"[",
"'auto'",
"]",
"[",
"'enabled'",
"]",
")",
"{",
"$",
"bundles",
"=",
"$",
"container",
"->",
"getParameter",
"(",
"'kernel.bundles'",
")",
";",
"foreach",
"(",
"$",
"bundles",
"as",
"$",
"bundle",
")",
"{",
"$",
"bundlePath",
"=",
"dirname",
"(",
"(",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"bundle",
")",
")",
"->",
"getFileName",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"config",
"[",
"'auto'",
"]",
"[",
"'paths'",
"]",
"as",
"$",
"relativePath",
")",
"{",
"$",
"path",
"=",
"$",
"bundlePath",
".",
"'/'",
".",
"$",
"relativePath",
";",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"$",
"paths",
"[",
"]",
"=",
"$",
"path",
";",
"}",
"}",
"}",
"}",
"return",
"array_merge",
"(",
"$",
"paths",
",",
"$",
"config",
"[",
"'paths'",
"]",
")",
";",
"}"
]
| @param mixed[] $config
@param ContainerBuilder $container
@return string[] | [
"@param",
"mixed",
"[]",
"$config",
"@param",
"ContainerBuilder",
"$container"
]
| train | https://github.com/egeloen/IvorySerializerBundle/blob/a2bdd912bf715c61b823cf7257ee232d5c823dd3/DependencyInjection/IvorySerializerExtension.php#L251-L272 |
titon/db | src/Titon/Db/Behavior/SoftDeleteBehavior.php | SoftDeleteBehavior.preFind | public function preFind(Event $event, Query $query, $finder) {
$config = $this->allConfig();
if ($config['filterDeleted']) {
$where = $query->getWhere();
if ($config['useFlag']) {
if (!$where->hasParam($config['flagField'])) {
$query->where($config['flagField'], false);
}
} else if (!$where->hasParam($config['deleteField'])) {
$query->where($config['deleteField'], null);
}
}
return true;
} | php | public function preFind(Event $event, Query $query, $finder) {
$config = $this->allConfig();
if ($config['filterDeleted']) {
$where = $query->getWhere();
if ($config['useFlag']) {
if (!$where->hasParam($config['flagField'])) {
$query->where($config['flagField'], false);
}
} else if (!$where->hasParam($config['deleteField'])) {
$query->where($config['deleteField'], null);
}
}
return true;
} | [
"public",
"function",
"preFind",
"(",
"Event",
"$",
"event",
",",
"Query",
"$",
"query",
",",
"$",
"finder",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"allConfig",
"(",
")",
";",
"if",
"(",
"$",
"config",
"[",
"'filterDeleted'",
"]",
")",
"{",
"$",
"where",
"=",
"$",
"query",
"->",
"getWhere",
"(",
")",
";",
"if",
"(",
"$",
"config",
"[",
"'useFlag'",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"where",
"->",
"hasParam",
"(",
"$",
"config",
"[",
"'flagField'",
"]",
")",
")",
"{",
"$",
"query",
"->",
"where",
"(",
"$",
"config",
"[",
"'flagField'",
"]",
",",
"false",
")",
";",
"}",
"}",
"else",
"if",
"(",
"!",
"$",
"where",
"->",
"hasParam",
"(",
"$",
"config",
"[",
"'deleteField'",
"]",
")",
")",
"{",
"$",
"query",
"->",
"where",
"(",
"$",
"config",
"[",
"'deleteField'",
"]",
",",
"null",
")",
";",
"}",
"}",
"return",
"true",
";",
"}"
]
| Filter out all soft deleted records from a select query if $filterDeleted is true.
Only apply the filter if the field being filtered on is not part of the original query.
@param \Titon\Event\Event $event
@param \Titon\Db\Query $query
@param string $finder
@return bool | [
"Filter",
"out",
"all",
"soft",
"deleted",
"records",
"from",
"a",
"select",
"query",
"if",
"$filterDeleted",
"is",
"true",
".",
"Only",
"apply",
"the",
"filter",
"if",
"the",
"field",
"being",
"filtered",
"on",
"is",
"not",
"part",
"of",
"the",
"original",
"query",
"."
]
| train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/SoftDeleteBehavior.php#L61-L77 |
titon/db | src/Titon/Db/Behavior/SoftDeleteBehavior.php | SoftDeleteBehavior.purgeDeleted | public function purgeDeleted($timeFrame) {
$config = $this->allConfig();
return $this->getRepository()->deleteMany(function(Query $query) use ($timeFrame, $config) {
if ($timeFrame) {
$query->where($config['deleteField'], '>=', Time::toUnix($timeFrame));
} else if ($config['useFlag']) {
$query->where($config['flagField'], true);
} else {
$query->where($config['deleteField'], '!=', null);
}
}, [
'before' => false,
'after' => false
]);
} | php | public function purgeDeleted($timeFrame) {
$config = $this->allConfig();
return $this->getRepository()->deleteMany(function(Query $query) use ($timeFrame, $config) {
if ($timeFrame) {
$query->where($config['deleteField'], '>=', Time::toUnix($timeFrame));
} else if ($config['useFlag']) {
$query->where($config['flagField'], true);
} else {
$query->where($config['deleteField'], '!=', null);
}
}, [
'before' => false,
'after' => false
]);
} | [
"public",
"function",
"purgeDeleted",
"(",
"$",
"timeFrame",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"allConfig",
"(",
")",
";",
"return",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"deleteMany",
"(",
"function",
"(",
"Query",
"$",
"query",
")",
"use",
"(",
"$",
"timeFrame",
",",
"$",
"config",
")",
"{",
"if",
"(",
"$",
"timeFrame",
")",
"{",
"$",
"query",
"->",
"where",
"(",
"$",
"config",
"[",
"'deleteField'",
"]",
",",
"'>='",
",",
"Time",
"::",
"toUnix",
"(",
"$",
"timeFrame",
")",
")",
";",
"}",
"else",
"if",
"(",
"$",
"config",
"[",
"'useFlag'",
"]",
")",
"{",
"$",
"query",
"->",
"where",
"(",
"$",
"config",
"[",
"'flagField'",
"]",
",",
"true",
")",
";",
"}",
"else",
"{",
"$",
"query",
"->",
"where",
"(",
"$",
"config",
"[",
"'deleteField'",
"]",
",",
"'!='",
",",
"null",
")",
";",
"}",
"}",
",",
"[",
"'before'",
"=>",
"false",
",",
"'after'",
"=>",
"false",
"]",
")",
";",
"}"
]
| Purge all soft deleted records from the database.
If a time frame is provided, delete all records within that time frame.
If no time frame is provided, delete all records based on flag or timestamp being not null.
@uses \Titon\Utility\Time
@param int|string $timeFrame
@return int | [
"Purge",
"all",
"soft",
"deleted",
"records",
"from",
"the",
"database",
".",
"If",
"a",
"time",
"frame",
"is",
"provided",
"delete",
"all",
"records",
"within",
"that",
"time",
"frame",
".",
"If",
"no",
"time",
"frame",
"is",
"provided",
"delete",
"all",
"records",
"based",
"on",
"flag",
"or",
"timestamp",
"being",
"not",
"null",
"."
]
| train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/SoftDeleteBehavior.php#L102-L119 |
titon/db | src/Titon/Db/Behavior/SoftDeleteBehavior.php | SoftDeleteBehavior.softDelete | public function softDelete($id) {
return $this->getRepository()->update($id, [
$this->getConfig('flagField') => true,
$this->getConfig('deleteField') => time()
], [
'before' => false,
'after' => false
]);
} | php | public function softDelete($id) {
return $this->getRepository()->update($id, [
$this->getConfig('flagField') => true,
$this->getConfig('deleteField') => time()
], [
'before' => false,
'after' => false
]);
} | [
"public",
"function",
"softDelete",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"update",
"(",
"$",
"id",
",",
"[",
"$",
"this",
"->",
"getConfig",
"(",
"'flagField'",
")",
"=>",
"true",
",",
"$",
"this",
"->",
"getConfig",
"(",
"'deleteField'",
")",
"=>",
"time",
"(",
")",
"]",
",",
"[",
"'before'",
"=>",
"false",
",",
"'after'",
"=>",
"false",
"]",
")",
";",
"}"
]
| Perform a soft delete by marking a record as deleted and updating a timestamp.
Do not delete the actual record.
@param int|int[] $id
@return int | [
"Perform",
"a",
"soft",
"delete",
"by",
"marking",
"a",
"record",
"as",
"deleted",
"and",
"updating",
"a",
"timestamp",
".",
"Do",
"not",
"delete",
"the",
"actual",
"record",
"."
]
| train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/SoftDeleteBehavior.php#L138-L146 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.getEntityInRevision | public function getEntityInRevision($parentIdentifier, $revision, $subResource = NULL, $query = NULL) {
try {
$entity = $this->hydrateEntityInRevision($parentIdentifier, $revision);
} catch (EntityNotFoundException $e) {
throw $this->err->resourceNotFound(__FUNCTION__, 'entity', array('identifier'=>$parentIdentifier), $e);
} // was passiert wenn mehrere items gefunden werden? (bis jetzt 500)
if ($subResource === NULL) {
return $entity;
} elseif ($subResource === 'form') {
return $this->getEntityFormular($entity);
} elseif (array_key_exists($subResource, $this->customActions)) {
return $this->callCustomAction($this->customActions[$subResource], array($entity, $query, $revision));
} else {
throw $this->err->invalidArgument(__FUNCTION__, 'subResource', $subResource);
}
} | php | public function getEntityInRevision($parentIdentifier, $revision, $subResource = NULL, $query = NULL) {
try {
$entity = $this->hydrateEntityInRevision($parentIdentifier, $revision);
} catch (EntityNotFoundException $e) {
throw $this->err->resourceNotFound(__FUNCTION__, 'entity', array('identifier'=>$parentIdentifier), $e);
} // was passiert wenn mehrere items gefunden werden? (bis jetzt 500)
if ($subResource === NULL) {
return $entity;
} elseif ($subResource === 'form') {
return $this->getEntityFormular($entity);
} elseif (array_key_exists($subResource, $this->customActions)) {
return $this->callCustomAction($this->customActions[$subResource], array($entity, $query, $revision));
} else {
throw $this->err->invalidArgument(__FUNCTION__, 'subResource', $subResource);
}
} | [
"public",
"function",
"getEntityInRevision",
"(",
"$",
"parentIdentifier",
",",
"$",
"revision",
",",
"$",
"subResource",
"=",
"NULL",
",",
"$",
"query",
"=",
"NULL",
")",
"{",
"try",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"hydrateEntityInRevision",
"(",
"$",
"parentIdentifier",
",",
"$",
"revision",
")",
";",
"}",
"catch",
"(",
"EntityNotFoundException",
"$",
"e",
")",
"{",
"throw",
"$",
"this",
"->",
"err",
"->",
"resourceNotFound",
"(",
"__FUNCTION__",
",",
"'entity'",
",",
"array",
"(",
"'identifier'",
"=>",
"$",
"parentIdentifier",
")",
",",
"$",
"e",
")",
";",
"}",
"// was passiert wenn mehrere items gefunden werden? (bis jetzt 500)",
"if",
"(",
"$",
"subResource",
"===",
"NULL",
")",
"{",
"return",
"$",
"entity",
";",
"}",
"elseif",
"(",
"$",
"subResource",
"===",
"'form'",
")",
"{",
"return",
"$",
"this",
"->",
"getEntityFormular",
"(",
"$",
"entity",
")",
";",
"}",
"elseif",
"(",
"array_key_exists",
"(",
"$",
"subResource",
",",
"$",
"this",
"->",
"customActions",
")",
")",
"{",
"return",
"$",
"this",
"->",
"callCustomAction",
"(",
"$",
"this",
"->",
"customActions",
"[",
"$",
"subResource",
"]",
",",
"array",
"(",
"$",
"entity",
",",
"$",
"query",
",",
"$",
"revision",
")",
")",
";",
"}",
"else",
"{",
"throw",
"$",
"this",
"->",
"err",
"->",
"invalidArgument",
"(",
"__FUNCTION__",
",",
"'subResource'",
",",
"$",
"subResource",
")",
";",
"}",
"}"
]
| Returns a revision from the entity with the $parentIdentifier
if no revision or identifier is found an Resource Not Found HTTP Error is raised
@return Entity | [
"Returns",
"a",
"revision",
"from",
"the",
"entity",
"with",
"the",
"$parentIdentifier"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L156-L172 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.hydrateEntityInRevision | protected function hydrateEntityInRevision($parentIdentifier, $revision) {
$parentIdentifier = $this->v->validateIdentifier($parentIdentifier, $this->getEntityMeta());
if ($revision === $this->defaultRevision) {
return $this->repository->hydrate($parentIdentifier);
} else {
throw EntityNotFoundException::criteria(compact('parentIdentifier', 'revision'));
}
} | php | protected function hydrateEntityInRevision($parentIdentifier, $revision) {
$parentIdentifier = $this->v->validateIdentifier($parentIdentifier, $this->getEntityMeta());
if ($revision === $this->defaultRevision) {
return $this->repository->hydrate($parentIdentifier);
} else {
throw EntityNotFoundException::criteria(compact('parentIdentifier', 'revision'));
}
} | [
"protected",
"function",
"hydrateEntityInRevision",
"(",
"$",
"parentIdentifier",
",",
"$",
"revision",
")",
"{",
"$",
"parentIdentifier",
"=",
"$",
"this",
"->",
"v",
"->",
"validateIdentifier",
"(",
"$",
"parentIdentifier",
",",
"$",
"this",
"->",
"getEntityMeta",
"(",
")",
")",
";",
"if",
"(",
"$",
"revision",
"===",
"$",
"this",
"->",
"defaultRevision",
")",
"{",
"return",
"$",
"this",
"->",
"repository",
"->",
"hydrate",
"(",
"$",
"parentIdentifier",
")",
";",
"}",
"else",
"{",
"throw",
"EntityNotFoundException",
"::",
"criteria",
"(",
"compact",
"(",
"'parentIdentifier'",
",",
"'revision'",
")",
")",
";",
"}",
"}"
]
| Returns the $revision of the entity with the $parentIdentifier
notice that the returned Entity may not have the same identifier as $parentIdentifier
@return Entity | [
"Returns",
"the",
"$revision",
"of",
"the",
"entity",
"with",
"the",
"$parentIdentifier"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L180-L188 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.saveEntity | public function saveEntity($identifier, FormData $requestData, $subResource = NULL) {
$revision = $this->defaultRevision;
$entity = $this->getEntity($identifier);
if ($subResource !== NULL && array_key_exists($subResource, $this->customActions)) {
return $this->callCustomAction($this->customActions[$subResource], array($entity, $requestData, $revision));
}
return $this->updateEntityRevision($entity, $revision, $requestData, $subResource);
} | php | public function saveEntity($identifier, FormData $requestData, $subResource = NULL) {
$revision = $this->defaultRevision;
$entity = $this->getEntity($identifier);
if ($subResource !== NULL && array_key_exists($subResource, $this->customActions)) {
return $this->callCustomAction($this->customActions[$subResource], array($entity, $requestData, $revision));
}
return $this->updateEntityRevision($entity, $revision, $requestData, $subResource);
} | [
"public",
"function",
"saveEntity",
"(",
"$",
"identifier",
",",
"FormData",
"$",
"requestData",
",",
"$",
"subResource",
"=",
"NULL",
")",
"{",
"$",
"revision",
"=",
"$",
"this",
"->",
"defaultRevision",
";",
"$",
"entity",
"=",
"$",
"this",
"->",
"getEntity",
"(",
"$",
"identifier",
")",
";",
"if",
"(",
"$",
"subResource",
"!==",
"NULL",
"&&",
"array_key_exists",
"(",
"$",
"subResource",
",",
"$",
"this",
"->",
"customActions",
")",
")",
"{",
"return",
"$",
"this",
"->",
"callCustomAction",
"(",
"$",
"this",
"->",
"customActions",
"[",
"$",
"subResource",
"]",
",",
"array",
"(",
"$",
"entity",
",",
"$",
"requestData",
",",
"$",
"revision",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"updateEntityRevision",
"(",
"$",
"entity",
",",
"$",
"revision",
",",
"$",
"requestData",
",",
"$",
"subResource",
")",
";",
"}"
]
| Saves the Entity default Revision
@controller-api
@return Entity | [
"Saves",
"the",
"Entity",
"default",
"Revision"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L280-L289 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.saveEntityAsRevision | public function saveEntityAsRevision($parentIdentifier, $revision, FormData $requestData, $subResource = NULL) {
try {
$entity = $this->hydrateEntityInRevision($parentIdentifier, $revision);
} catch (EntityNotFoundException $e) {
$parentEntity = $this->getEntity($parentIdentifier);
$entity = $this->createNewRevisionFrom($parentEntity, $revision);
}
if ($subResource !== NULL && array_key_exists($subResource, $this->customActions)) {
return $this->callCustomAction($this->customActions[$subResource], array($entity, $requestData, $revision));
}
return $this->updateEntityRevision($entity, $revision, $requestData, $subResource);
} | php | public function saveEntityAsRevision($parentIdentifier, $revision, FormData $requestData, $subResource = NULL) {
try {
$entity = $this->hydrateEntityInRevision($parentIdentifier, $revision);
} catch (EntityNotFoundException $e) {
$parentEntity = $this->getEntity($parentIdentifier);
$entity = $this->createNewRevisionFrom($parentEntity, $revision);
}
if ($subResource !== NULL && array_key_exists($subResource, $this->customActions)) {
return $this->callCustomAction($this->customActions[$subResource], array($entity, $requestData, $revision));
}
return $this->updateEntityRevision($entity, $revision, $requestData, $subResource);
} | [
"public",
"function",
"saveEntityAsRevision",
"(",
"$",
"parentIdentifier",
",",
"$",
"revision",
",",
"FormData",
"$",
"requestData",
",",
"$",
"subResource",
"=",
"NULL",
")",
"{",
"try",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"hydrateEntityInRevision",
"(",
"$",
"parentIdentifier",
",",
"$",
"revision",
")",
";",
"}",
"catch",
"(",
"EntityNotFoundException",
"$",
"e",
")",
"{",
"$",
"parentEntity",
"=",
"$",
"this",
"->",
"getEntity",
"(",
"$",
"parentIdentifier",
")",
";",
"$",
"entity",
"=",
"$",
"this",
"->",
"createNewRevisionFrom",
"(",
"$",
"parentEntity",
",",
"$",
"revision",
")",
";",
"}",
"if",
"(",
"$",
"subResource",
"!==",
"NULL",
"&&",
"array_key_exists",
"(",
"$",
"subResource",
",",
"$",
"this",
"->",
"customActions",
")",
")",
"{",
"return",
"$",
"this",
"->",
"callCustomAction",
"(",
"$",
"this",
"->",
"customActions",
"[",
"$",
"subResource",
"]",
",",
"array",
"(",
"$",
"entity",
",",
"$",
"requestData",
",",
"$",
"revision",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"updateEntityRevision",
"(",
"$",
"entity",
",",
"$",
"revision",
",",
"$",
"requestData",
",",
"$",
"subResource",
")",
";",
"}"
]
| Saves an Entity ($parentIdentifier) as a new Entity in a specific $evision
notice: think of a save as... - button
this does NOT use getEntityInRevision to retrieve the revision-entity. it uses hydrateEntityInRevision
a new Revision is created (if it does not exist in db) with createNewRevisionFrom()
@controller-api
@return Entity | [
"Saves",
"an",
"Entity",
"(",
"$parentIdentifier",
")",
"as",
"a",
"new",
"Entity",
"in",
"a",
"specific",
"$evision"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L301-L315 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.updateEntityRevision | protected function updateEntityRevision(Entity $entity, $revision, FormData $requestData) {
$this->setRevisionMetadata($revision);
$this->beginTransaction();
// validiert und processed die daten aus requestData und setzt diese im Entity
$this->processEntityFormRequest($entity, $requestData, $revision);
$this->repository->save($entity);
$this->commitTransaction();
$this->setEntityResponseMetadata($entity);
return $entity;
} | php | protected function updateEntityRevision(Entity $entity, $revision, FormData $requestData) {
$this->setRevisionMetadata($revision);
$this->beginTransaction();
// validiert und processed die daten aus requestData und setzt diese im Entity
$this->processEntityFormRequest($entity, $requestData, $revision);
$this->repository->save($entity);
$this->commitTransaction();
$this->setEntityResponseMetadata($entity);
return $entity;
} | [
"protected",
"function",
"updateEntityRevision",
"(",
"Entity",
"$",
"entity",
",",
"$",
"revision",
",",
"FormData",
"$",
"requestData",
")",
"{",
"$",
"this",
"->",
"setRevisionMetadata",
"(",
"$",
"revision",
")",
";",
"$",
"this",
"->",
"beginTransaction",
"(",
")",
";",
"// validiert und processed die daten aus requestData und setzt diese im Entity",
"$",
"this",
"->",
"processEntityFormRequest",
"(",
"$",
"entity",
",",
"$",
"requestData",
",",
"$",
"revision",
")",
";",
"$",
"this",
"->",
"repository",
"->",
"save",
"(",
"$",
"entity",
")",
";",
"$",
"this",
"->",
"commitTransaction",
"(",
")",
";",
"$",
"this",
"->",
"setEntityResponseMetadata",
"(",
"$",
"entity",
")",
";",
"return",
"$",
"entity",
";",
"}"
]
| Saves the specific Entity with the $requestData in $revision
this does not create new revisions of the entity, it just stores the current with the requestdata
@return Entity | [
"Saves",
"the",
"specific",
"Entity",
"with",
"the",
"$requestData",
"in",
"$revision"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L323-L338 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.insertEntity | public function insertEntity(FormData $requestData, $subResource = NULL) {
return $this->insertEntityRevision($this->defaultRevision, $requestData, $subResource);
} | php | public function insertEntity(FormData $requestData, $subResource = NULL) {
return $this->insertEntityRevision($this->defaultRevision, $requestData, $subResource);
} | [
"public",
"function",
"insertEntity",
"(",
"FormData",
"$",
"requestData",
",",
"$",
"subResource",
"=",
"NULL",
")",
"{",
"return",
"$",
"this",
"->",
"insertEntityRevision",
"(",
"$",
"this",
"->",
"defaultRevision",
",",
"$",
"requestData",
",",
"$",
"subResource",
")",
";",
"}"
]
| Inserts a new Entity in default Revision
@controller-api
@return Psc\CMS\Entity | [
"Inserts",
"a",
"new",
"Entity",
"in",
"default",
"Revision"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L381-L383 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.insertEntityRevision | public function insertEntityRevision($revision, FormData $requestData, $subResource = NULL) {
$entity = $this->createEmptyEntity($revision);
if ($subResource !== NULL && array_key_exists($subResource, $this->customActions)) {
return $this->callCustomAction($this->customActions[$subResource], array($entity, $requestData, $revision));
}
$this->updateEntityRevision($entity, $revision, $requestData);
$this->setOpenTabMetadata($entity);
return $entity;
} | php | public function insertEntityRevision($revision, FormData $requestData, $subResource = NULL) {
$entity = $this->createEmptyEntity($revision);
if ($subResource !== NULL && array_key_exists($subResource, $this->customActions)) {
return $this->callCustomAction($this->customActions[$subResource], array($entity, $requestData, $revision));
}
$this->updateEntityRevision($entity, $revision, $requestData);
$this->setOpenTabMetadata($entity);
return $entity;
} | [
"public",
"function",
"insertEntityRevision",
"(",
"$",
"revision",
",",
"FormData",
"$",
"requestData",
",",
"$",
"subResource",
"=",
"NULL",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"createEmptyEntity",
"(",
"$",
"revision",
")",
";",
"if",
"(",
"$",
"subResource",
"!==",
"NULL",
"&&",
"array_key_exists",
"(",
"$",
"subResource",
",",
"$",
"this",
"->",
"customActions",
")",
")",
"{",
"return",
"$",
"this",
"->",
"callCustomAction",
"(",
"$",
"this",
"->",
"customActions",
"[",
"$",
"subResource",
"]",
",",
"array",
"(",
"$",
"entity",
",",
"$",
"requestData",
",",
"$",
"revision",
")",
")",
";",
"}",
"$",
"this",
"->",
"updateEntityRevision",
"(",
"$",
"entity",
",",
"$",
"revision",
",",
"$",
"requestData",
")",
";",
"$",
"this",
"->",
"setOpenTabMetadata",
"(",
"$",
"entity",
")",
";",
"return",
"$",
"entity",
";",
"}"
]
| Inserts a new Entity in specific Revision
@controller-api | [
"Inserts",
"a",
"new",
"Entity",
"in",
"specific",
"Revision"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L390-L401 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.getEntityGrid | public function getEntityGrid(EntityMeta $entityMeta, $entities) {
$this->init(array('ev.componentMapper', 'ev.labeler'));
$panel = $this->createGridPanel($entityMeta);
$this->init(array('ev.gridPanel'));
// entities zuweisen
$panel->addEntities($entities);
return $panel;
} | php | public function getEntityGrid(EntityMeta $entityMeta, $entities) {
$this->init(array('ev.componentMapper', 'ev.labeler'));
$panel = $this->createGridPanel($entityMeta);
$this->init(array('ev.gridPanel'));
// entities zuweisen
$panel->addEntities($entities);
return $panel;
} | [
"public",
"function",
"getEntityGrid",
"(",
"EntityMeta",
"$",
"entityMeta",
",",
"$",
"entities",
")",
"{",
"$",
"this",
"->",
"init",
"(",
"array",
"(",
"'ev.componentMapper'",
",",
"'ev.labeler'",
")",
")",
";",
"$",
"panel",
"=",
"$",
"this",
"->",
"createGridPanel",
"(",
"$",
"entityMeta",
")",
";",
"$",
"this",
"->",
"init",
"(",
"array",
"(",
"'ev.gridPanel'",
")",
")",
";",
"// entities zuweisen",
"$",
"panel",
"->",
"addEntities",
"(",
"$",
"entities",
")",
";",
"return",
"$",
"panel",
";",
"}"
]
| Der Grid ist eine pflegbare Liste in dem die Items als Buttons dargestellt werden
@controller-api | [
"Der",
"Grid",
"ist",
"eine",
"pflegbare",
"Liste",
"in",
"dem",
"die",
"Items",
"als",
"Buttons",
"dargestellt",
"werden"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L555-L565 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.saveSort | public function saveSort(Array $sortMap) {
$this->beginTransaction();
$field = $this->getSortField();
$sorts = array();
foreach ($sortMap as $sort => $identifier) {
$sorts[$identifier] = $sort+1;
$this->repository->persist(
$this->getEntity($identifier)->callSetter($field, $sort+1)
);
}
$this->dc->getEntityManager()->flush();
$this->commitTransaction();
return $sorts;
} | php | public function saveSort(Array $sortMap) {
$this->beginTransaction();
$field = $this->getSortField();
$sorts = array();
foreach ($sortMap as $sort => $identifier) {
$sorts[$identifier] = $sort+1;
$this->repository->persist(
$this->getEntity($identifier)->callSetter($field, $sort+1)
);
}
$this->dc->getEntityManager()->flush();
$this->commitTransaction();
return $sorts;
} | [
"public",
"function",
"saveSort",
"(",
"Array",
"$",
"sortMap",
")",
"{",
"$",
"this",
"->",
"beginTransaction",
"(",
")",
";",
"$",
"field",
"=",
"$",
"this",
"->",
"getSortField",
"(",
")",
";",
"$",
"sorts",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"sortMap",
"as",
"$",
"sort",
"=>",
"$",
"identifier",
")",
"{",
"$",
"sorts",
"[",
"$",
"identifier",
"]",
"=",
"$",
"sort",
"+",
"1",
";",
"$",
"this",
"->",
"repository",
"->",
"persist",
"(",
"$",
"this",
"->",
"getEntity",
"(",
"$",
"identifier",
")",
"->",
"callSetter",
"(",
"$",
"field",
",",
"$",
"sort",
"+",
"1",
")",
")",
";",
"}",
"$",
"this",
"->",
"dc",
"->",
"getEntityManager",
"(",
")",
"->",
"flush",
"(",
")",
";",
"$",
"this",
"->",
"commitTransaction",
"(",
")",
";",
"return",
"$",
"sorts",
";",
"}"
]
| Speichert die Reihenfolge (wenn vorhanden) für die Entities des Controllers ab
dies ist die Hilfs-Implementierung für SortingController
die Sortierung wird von 1-basierend von unten nach oben durchnummeriert
@return array $identifier => $savedSortInteger | [
"Speichert",
"die",
"Reihenfolge",
"(",
"wenn",
"vorhanden",
")",
"für",
"die",
"Entities",
"des",
"Controllers",
"ab"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L575-L591 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.getEntitySearchPanel | public function getEntitySearchPanel(EntityMeta $entityMeta, Array $query) {
$panel = $this->ev->createSearchPanel($entityMeta, $query);
$this->init(array('ev.searchPanel'));
return $panel;
} | php | public function getEntitySearchPanel(EntityMeta $entityMeta, Array $query) {
$panel = $this->ev->createSearchPanel($entityMeta, $query);
$this->init(array('ev.searchPanel'));
return $panel;
} | [
"public",
"function",
"getEntitySearchPanel",
"(",
"EntityMeta",
"$",
"entityMeta",
",",
"Array",
"$",
"query",
")",
"{",
"$",
"panel",
"=",
"$",
"this",
"->",
"ev",
"->",
"createSearchPanel",
"(",
"$",
"entityMeta",
",",
"$",
"query",
")",
";",
"$",
"this",
"->",
"init",
"(",
"array",
"(",
"'ev.searchPanel'",
")",
")",
";",
"return",
"$",
"panel",
";",
"}"
]
| Der Grid ist eine pflegbare Liste in dem die Items als Buttons dargestellt werden
@param array $query noch nicht benutzt.
@controller-api | [
"Der",
"Grid",
"ist",
"eine",
"pflegbare",
"Liste",
"in",
"dem",
"die",
"Items",
"als",
"Buttons",
"dargestellt",
"werden"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L599-L604 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.createEmptyEntity | public function createEmptyEntity($revision = NULL) {
// @TODO check ob entity einen constructor hat, der parameter braucht?
$c = $this->getEntityName();
try {
$gClass = new GClass($c);
// wir rufen hier nicht den constructor auf
return $gClass->newInstance(array(), GClass::WITHOUT_CONSTRUCTOR);
} catch (\ErrorException $e) {
if (mb_strpos($e->getMessage(), 'Missing argument') !== FALSE) {
throw new \Psc\Exception(sprintf("Kann kein leeres Entity '%s' mit leerem Constructor erstellen. createEmptyEntity() kann im Controller abgeleitet werden, um das Problem zu beheben",$c), 0, $e);
} else {
throw $e;
}
}
} | php | public function createEmptyEntity($revision = NULL) {
// @TODO check ob entity einen constructor hat, der parameter braucht?
$c = $this->getEntityName();
try {
$gClass = new GClass($c);
// wir rufen hier nicht den constructor auf
return $gClass->newInstance(array(), GClass::WITHOUT_CONSTRUCTOR);
} catch (\ErrorException $e) {
if (mb_strpos($e->getMessage(), 'Missing argument') !== FALSE) {
throw new \Psc\Exception(sprintf("Kann kein leeres Entity '%s' mit leerem Constructor erstellen. createEmptyEntity() kann im Controller abgeleitet werden, um das Problem zu beheben",$c), 0, $e);
} else {
throw $e;
}
}
} | [
"public",
"function",
"createEmptyEntity",
"(",
"$",
"revision",
"=",
"NULL",
")",
"{",
"// @TODO check ob entity einen constructor hat, der parameter braucht?",
"$",
"c",
"=",
"$",
"this",
"->",
"getEntityName",
"(",
")",
";",
"try",
"{",
"$",
"gClass",
"=",
"new",
"GClass",
"(",
"$",
"c",
")",
";",
"// wir rufen hier nicht den constructor auf",
"return",
"$",
"gClass",
"->",
"newInstance",
"(",
"array",
"(",
")",
",",
"GClass",
"::",
"WITHOUT_CONSTRUCTOR",
")",
";",
"}",
"catch",
"(",
"\\",
"ErrorException",
"$",
"e",
")",
"{",
"if",
"(",
"mb_strpos",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
",",
"'Missing argument'",
")",
"!==",
"FALSE",
")",
"{",
"throw",
"new",
"\\",
"Psc",
"\\",
"Exception",
"(",
"sprintf",
"(",
"\"Kann kein leeres Entity '%s' mit leerem Constructor erstellen. createEmptyEntity() kann im Controller abgeleitet werden, um das Problem zu beheben\"",
",",
"$",
"c",
")",
",",
"0",
",",
"$",
"e",
")",
";",
"}",
"else",
"{",
"throw",
"$",
"e",
";",
"}",
"}",
"}"
]
| Erstellt ein leeres Entity
kann abgeleitet werden, falls der constructor von {$this->getEntityName()} Parameter braucht | [
"Erstellt",
"ein",
"leeres",
"Entity"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L624-L642 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.initGridPanel | protected function initGridPanel(\Psc\CMS\EntityGridPanel $panel) {
if ($this instanceof SortingController) {
$panel->setSortable(TRUE);
$panel->setSortableName($this->getSortField());
}
$panel->addControlColumn();
$panel->addControlButtons();
foreach ($this->getWhiteListProperties($panel->getEntityMeta(), 'grid') as $property) {
$panel->addProperty($property, $panel->getEntityMeta()->getTCIColumn() === $property ? EntityGridPanel::TCI_BUTTON : NULL);
}
} | php | protected function initGridPanel(\Psc\CMS\EntityGridPanel $panel) {
if ($this instanceof SortingController) {
$panel->setSortable(TRUE);
$panel->setSortableName($this->getSortField());
}
$panel->addControlColumn();
$panel->addControlButtons();
foreach ($this->getWhiteListProperties($panel->getEntityMeta(), 'grid') as $property) {
$panel->addProperty($property, $panel->getEntityMeta()->getTCIColumn() === $property ? EntityGridPanel::TCI_BUTTON : NULL);
}
} | [
"protected",
"function",
"initGridPanel",
"(",
"\\",
"Psc",
"\\",
"CMS",
"\\",
"EntityGridPanel",
"$",
"panel",
")",
"{",
"if",
"(",
"$",
"this",
"instanceof",
"SortingController",
")",
"{",
"$",
"panel",
"->",
"setSortable",
"(",
"TRUE",
")",
";",
"$",
"panel",
"->",
"setSortableName",
"(",
"$",
"this",
"->",
"getSortField",
"(",
")",
")",
";",
"}",
"$",
"panel",
"->",
"addControlColumn",
"(",
")",
";",
"$",
"panel",
"->",
"addControlButtons",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getWhiteListProperties",
"(",
"$",
"panel",
"->",
"getEntityMeta",
"(",
")",
",",
"'grid'",
")",
"as",
"$",
"property",
")",
"{",
"$",
"panel",
"->",
"addProperty",
"(",
"$",
"property",
",",
"$",
"panel",
"->",
"getEntityMeta",
"(",
")",
"->",
"getTCIColumn",
"(",
")",
"===",
"$",
"property",
"?",
"EntityGridPanel",
"::",
"TCI_BUTTON",
":",
"NULL",
")",
";",
"}",
"}"
]
| Fügt per Default alle Whitelist Properties der Tabelle hinzu | [
"Fügt",
"per",
"Default",
"alle",
"Whitelist",
"Properties",
"der",
"Tabelle",
"hinzu"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L729-L741 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.onEntityRelationComponentCreated | protected function onEntityRelationComponentCreated(Component $component, ComponentsCreater $creater, Event $event, EntityMeta $relationEntityMeta) {
if ($component instanceof \Psc\UI\Component\ComboDropBox) {
// in der ComboDropBox werden ja fremde Entities mit Ajax geladen, d.h. wir müssen hier relationEntityMeta übergebe
$component->dpi($relationEntityMeta, $this->dc);
} elseif ($component instanceof \Psc\UI\Component\ComboBox) {
$component->dpi($relationEntityMeta, $this->dc);
} elseif ($component instanceof \Psc\UI\Component\SingleImage) {
$component->dpi($relationEntityMeta, $this->dc);
}
} | php | protected function onEntityRelationComponentCreated(Component $component, ComponentsCreater $creater, Event $event, EntityMeta $relationEntityMeta) {
if ($component instanceof \Psc\UI\Component\ComboDropBox) {
// in der ComboDropBox werden ja fremde Entities mit Ajax geladen, d.h. wir müssen hier relationEntityMeta übergebe
$component->dpi($relationEntityMeta, $this->dc);
} elseif ($component instanceof \Psc\UI\Component\ComboBox) {
$component->dpi($relationEntityMeta, $this->dc);
} elseif ($component instanceof \Psc\UI\Component\SingleImage) {
$component->dpi($relationEntityMeta, $this->dc);
}
} | [
"protected",
"function",
"onEntityRelationComponentCreated",
"(",
"Component",
"$",
"component",
",",
"ComponentsCreater",
"$",
"creater",
",",
"Event",
"$",
"event",
",",
"EntityMeta",
"$",
"relationEntityMeta",
")",
"{",
"if",
"(",
"$",
"component",
"instanceof",
"\\",
"Psc",
"\\",
"UI",
"\\",
"Component",
"\\",
"ComboDropBox",
")",
"{",
"// in der ComboDropBox werden ja fremde Entities mit Ajax geladen, d.h. wir müssen hier relationEntityMeta übergebe",
"$",
"component",
"->",
"dpi",
"(",
"$",
"relationEntityMeta",
",",
"$",
"this",
"->",
"dc",
")",
";",
"}",
"elseif",
"(",
"$",
"component",
"instanceof",
"\\",
"Psc",
"\\",
"UI",
"\\",
"Component",
"\\",
"ComboBox",
")",
"{",
"$",
"component",
"->",
"dpi",
"(",
"$",
"relationEntityMeta",
",",
"$",
"this",
"->",
"dc",
")",
";",
"}",
"elseif",
"(",
"$",
"component",
"instanceof",
"\\",
"Psc",
"\\",
"UI",
"\\",
"Component",
"\\",
"SingleImage",
")",
"{",
"$",
"component",
"->",
"dpi",
"(",
"$",
"relationEntityMeta",
",",
"$",
"this",
"->",
"dc",
")",
";",
"}",
"}"
]
| Fügt Metadaten zu Relations hinzu, die z. B. die FormComboDropBox braucht | [
"Fügt",
"Metadaten",
"zu",
"Relations",
"hinzu",
"die",
"z",
".",
"B",
".",
"die",
"FormComboDropBox",
"braucht"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L761-L771 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.onComponentCreated | public function onComponentCreated(Component $component, ComponentsCreater $creater, Event $event) {
$entityMeta = $this->getEntityMeta();
$propertyMeta = $entityMeta->getPropertyMeta($event->getData()->name);
if (($hint = $propertyMeta->getHint()) !== NULL) {
$event->getData()->hint = $hint;
$component->setHint($hint);
}
if ($propertyMeta->isRelation()) {
$relationEntityMeta = $this->getEntityMeta($propertyMeta->getRelationEntityClass()->getFQN());
$this->onEntityRelationComponentCreated($component, $creater, $event, $relationEntityMeta);
}
// Rufe on{$Property}ComponentCreated auf, wenn es die Methode gibt
$method = 'on'.$propertyMeta->getName().'ComponentCreated';
if (method_exists($this, $method)) {
$this->$method($component, $creater, $event);
}
} | php | public function onComponentCreated(Component $component, ComponentsCreater $creater, Event $event) {
$entityMeta = $this->getEntityMeta();
$propertyMeta = $entityMeta->getPropertyMeta($event->getData()->name);
if (($hint = $propertyMeta->getHint()) !== NULL) {
$event->getData()->hint = $hint;
$component->setHint($hint);
}
if ($propertyMeta->isRelation()) {
$relationEntityMeta = $this->getEntityMeta($propertyMeta->getRelationEntityClass()->getFQN());
$this->onEntityRelationComponentCreated($component, $creater, $event, $relationEntityMeta);
}
// Rufe on{$Property}ComponentCreated auf, wenn es die Methode gibt
$method = 'on'.$propertyMeta->getName().'ComponentCreated';
if (method_exists($this, $method)) {
$this->$method($component, $creater, $event);
}
} | [
"public",
"function",
"onComponentCreated",
"(",
"Component",
"$",
"component",
",",
"ComponentsCreater",
"$",
"creater",
",",
"Event",
"$",
"event",
")",
"{",
"$",
"entityMeta",
"=",
"$",
"this",
"->",
"getEntityMeta",
"(",
")",
";",
"$",
"propertyMeta",
"=",
"$",
"entityMeta",
"->",
"getPropertyMeta",
"(",
"$",
"event",
"->",
"getData",
"(",
")",
"->",
"name",
")",
";",
"if",
"(",
"(",
"$",
"hint",
"=",
"$",
"propertyMeta",
"->",
"getHint",
"(",
")",
")",
"!==",
"NULL",
")",
"{",
"$",
"event",
"->",
"getData",
"(",
")",
"->",
"hint",
"=",
"$",
"hint",
";",
"$",
"component",
"->",
"setHint",
"(",
"$",
"hint",
")",
";",
"}",
"if",
"(",
"$",
"propertyMeta",
"->",
"isRelation",
"(",
")",
")",
"{",
"$",
"relationEntityMeta",
"=",
"$",
"this",
"->",
"getEntityMeta",
"(",
"$",
"propertyMeta",
"->",
"getRelationEntityClass",
"(",
")",
"->",
"getFQN",
"(",
")",
")",
";",
"$",
"this",
"->",
"onEntityRelationComponentCreated",
"(",
"$",
"component",
",",
"$",
"creater",
",",
"$",
"event",
",",
"$",
"relationEntityMeta",
")",
";",
"}",
"// Rufe on{$Property}ComponentCreated auf, wenn es die Methode gibt",
"$",
"method",
"=",
"'on'",
".",
"$",
"propertyMeta",
"->",
"getName",
"(",
")",
".",
"'ComponentCreated'",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"$",
"method",
")",
")",
"{",
"$",
"this",
"->",
"$",
"method",
"(",
"$",
"component",
",",
"$",
"creater",
",",
"$",
"event",
")",
";",
"}",
"}"
]
| /* Interface ComponentsCreaterListener | [
"/",
"*",
"Interface",
"ComponentsCreaterListener"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L803-L823 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.trans | public function trans($key, Array $parameters = array(), $domain = NULL) {
if (!isset($domain)) $domain = 'project';
return $this->translationContainer->getTranslator()->trans($key, $parameters, $domain);
} | php | public function trans($key, Array $parameters = array(), $domain = NULL) {
if (!isset($domain)) $domain = 'project';
return $this->translationContainer->getTranslator()->trans($key, $parameters, $domain);
} | [
"public",
"function",
"trans",
"(",
"$",
"key",
",",
"Array",
"$",
"parameters",
"=",
"array",
"(",
")",
",",
"$",
"domain",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"domain",
")",
")",
"$",
"domain",
"=",
"'project'",
";",
"return",
"$",
"this",
"->",
"translationContainer",
"->",
"getTranslator",
"(",
")",
"->",
"trans",
"(",
"$",
"key",
",",
"$",
"parameters",
",",
"$",
"domain",
")",
";",
"}"
]
| public for usage in 5.3 in closures | [
"public",
"for",
"usage",
"in",
"5",
".",
"3",
"in",
"closures"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L937-L941 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/AbstractEntityController.php | AbstractEntityController.initPropertyTranslations | protected function initPropertyTranslations($domain = NULL) {
$entityMeta = $this->getEntityMeta();
$translator = $this->translationContainer->getTranslator();
$this->on('init.labeler', function ($labeler) use ($domain, $entityMeta, $translator) {
foreach ($entityMeta->getSetMeta()->getKeys() as $propertyName) {
$property = $entityMeta->getPropertyMeta($propertyName);
$labeler->label(
$property->getName(),
$translator->trans(
sprintf('entities.%s.%s', $entityMeta->getEntityName(), $property->getCanonicalName()),
array(),
$domain ?: 'project'
)
);
}
});
} | php | protected function initPropertyTranslations($domain = NULL) {
$entityMeta = $this->getEntityMeta();
$translator = $this->translationContainer->getTranslator();
$this->on('init.labeler', function ($labeler) use ($domain, $entityMeta, $translator) {
foreach ($entityMeta->getSetMeta()->getKeys() as $propertyName) {
$property = $entityMeta->getPropertyMeta($propertyName);
$labeler->label(
$property->getName(),
$translator->trans(
sprintf('entities.%s.%s', $entityMeta->getEntityName(), $property->getCanonicalName()),
array(),
$domain ?: 'project'
)
);
}
});
} | [
"protected",
"function",
"initPropertyTranslations",
"(",
"$",
"domain",
"=",
"NULL",
")",
"{",
"$",
"entityMeta",
"=",
"$",
"this",
"->",
"getEntityMeta",
"(",
")",
";",
"$",
"translator",
"=",
"$",
"this",
"->",
"translationContainer",
"->",
"getTranslator",
"(",
")",
";",
"$",
"this",
"->",
"on",
"(",
"'init.labeler'",
",",
"function",
"(",
"$",
"labeler",
")",
"use",
"(",
"$",
"domain",
",",
"$",
"entityMeta",
",",
"$",
"translator",
")",
"{",
"foreach",
"(",
"$",
"entityMeta",
"->",
"getSetMeta",
"(",
")",
"->",
"getKeys",
"(",
")",
"as",
"$",
"propertyName",
")",
"{",
"$",
"property",
"=",
"$",
"entityMeta",
"->",
"getPropertyMeta",
"(",
"$",
"propertyName",
")",
";",
"$",
"labeler",
"->",
"label",
"(",
"$",
"property",
"->",
"getName",
"(",
")",
",",
"$",
"translator",
"->",
"trans",
"(",
"sprintf",
"(",
"'entities.%s.%s'",
",",
"$",
"entityMeta",
"->",
"getEntityName",
"(",
")",
",",
"$",
"property",
"->",
"getCanonicalName",
"(",
")",
")",
",",
"array",
"(",
")",
",",
"$",
"domain",
"?",
":",
"'project'",
")",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Loads translations keys for each property of the entity of the controller with labels
domain: project (if not specified)
key:
entities.<entityName>.<propertyName>
for example:
entities.news-entry.published
entities.news-entry.teaser
if property is i18n property the i18n will be stripped | [
"Loads",
"translations",
"keys",
"for",
"each",
"property",
"of",
"the",
"entity",
"of",
"the",
"controller",
"with",
"labels"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L956-L974 |
kherge-abandoned/lib-exception | src/lib/Phine/Exception/Exception.php | Exception.createUsingFormat | public static function createUsingFormat($format)
{
$previous = null;
if (1 < func_num_args()) {
$args = array_slice(func_get_args(), 1);
// extract $previous exception
if (end($args) instanceof \Exception) {
$previous = array_pop($args);
}
if ($args) {
$format = vsprintf($format, $args);
}
}
return new static($format, 0, $previous);
} | php | public static function createUsingFormat($format)
{
$previous = null;
if (1 < func_num_args()) {
$args = array_slice(func_get_args(), 1);
// extract $previous exception
if (end($args) instanceof \Exception) {
$previous = array_pop($args);
}
if ($args) {
$format = vsprintf($format, $args);
}
}
return new static($format, 0, $previous);
} | [
"public",
"static",
"function",
"createUsingFormat",
"(",
"$",
"format",
")",
"{",
"$",
"previous",
"=",
"null",
";",
"if",
"(",
"1",
"<",
"func_num_args",
"(",
")",
")",
"{",
"$",
"args",
"=",
"array_slice",
"(",
"func_get_args",
"(",
")",
",",
"1",
")",
";",
"// extract $previous exception",
"if",
"(",
"end",
"(",
"$",
"args",
")",
"instanceof",
"\\",
"Exception",
")",
"{",
"$",
"previous",
"=",
"array_pop",
"(",
"$",
"args",
")",
";",
"}",
"if",
"(",
"$",
"args",
")",
"{",
"$",
"format",
"=",
"vsprintf",
"(",
"$",
"format",
",",
"$",
"args",
")",
";",
"}",
"}",
"return",
"new",
"static",
"(",
"$",
"format",
",",
"0",
",",
"$",
"previous",
")",
";",
"}"
]
| Creates a new exception using a formatted message.
A new exception is created after formatting the given arguments using
`vsprintf()`. If the last argument is an instance of the `Exception`
class, it will be used as the `$previous` exception in the new one
that is created.
@param string $format The message format.
@param mixed $value,... A value to format.
@param \Exception $previous A previous exception.
@return Exception The new exception. | [
"Creates",
"a",
"new",
"exception",
"using",
"a",
"formatted",
"message",
"."
]
| train | https://github.com/kherge-abandoned/lib-exception/blob/3f50754bcc416df91235766cc3d5d5ce6ed6d612/src/lib/Phine/Exception/Exception.php#L26-L44 |
webforge-labs/psc-cms | lib/Psc/MailChimp/API.php | API.listSubscribe | public function listSubscribe($listId, $email, Array $mergeVars = NULL, $emailType = 'text', $doubleOptin = true, $updateExisting = false, $replaceInterests = true, $sendWelcome = true) {
$response = $this->dispatch(__FUNCTION__, array(
'id'=>$listId,
'email_address'=>$email,
'email_type'=>$emailType
));
// boolean
if ($response->getRaw() === 'true') {
return TRUE;
} else {
throw Exception::unknown($response->getRaw());
}
} | php | public function listSubscribe($listId, $email, Array $mergeVars = NULL, $emailType = 'text', $doubleOptin = true, $updateExisting = false, $replaceInterests = true, $sendWelcome = true) {
$response = $this->dispatch(__FUNCTION__, array(
'id'=>$listId,
'email_address'=>$email,
'email_type'=>$emailType
));
// boolean
if ($response->getRaw() === 'true') {
return TRUE;
} else {
throw Exception::unknown($response->getRaw());
}
} | [
"public",
"function",
"listSubscribe",
"(",
"$",
"listId",
",",
"$",
"email",
",",
"Array",
"$",
"mergeVars",
"=",
"NULL",
",",
"$",
"emailType",
"=",
"'text'",
",",
"$",
"doubleOptin",
"=",
"true",
",",
"$",
"updateExisting",
"=",
"false",
",",
"$",
"replaceInterests",
"=",
"true",
",",
"$",
"sendWelcome",
"=",
"true",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"dispatch",
"(",
"__FUNCTION__",
",",
"array",
"(",
"'id'",
"=>",
"$",
"listId",
",",
"'email_address'",
"=>",
"$",
"email",
",",
"'email_type'",
"=>",
"$",
"emailType",
")",
")",
";",
"// boolean",
"if",
"(",
"$",
"response",
"->",
"getRaw",
"(",
")",
"===",
"'true'",
")",
"{",
"return",
"TRUE",
";",
"}",
"else",
"{",
"throw",
"Exception",
"::",
"unknown",
"(",
"$",
"response",
"->",
"getRaw",
"(",
")",
")",
";",
"}",
"}"
]
| Subscribe the provided email to a list. By default this sends a confirmation email - you will not see new members until the link contained in it is clicked!
listSubscribe(string apikey, string id, string email_address, array merge_vars, string email_type, bool double_optin, bool update_existing, bool replace_interests, bool send_welcome)
http://apidocs.mailchimp.com/api/1.3/listsubscribe.func.php
@todo im Moment sind nur die ersten 2 parameter implementiert
@param emailType text|html|mobile
@return bool success | [
"Subscribe",
"the",
"provided",
"email",
"to",
"a",
"list",
".",
"By",
"default",
"this",
"sends",
"a",
"confirmation",
"email",
"-",
"you",
"will",
"not",
"see",
"new",
"members",
"until",
"the",
"link",
"contained",
"in",
"it",
"is",
"clicked!"
]
| train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/MailChimp/API.php#L59-L72 |
titon/db | src/Titon/Db/Query/ExprAware.php | ExprAware.expr | public static function expr($field, $operator = null, $value = null) {
return new Expr($field, $operator, $value);
} | php | public static function expr($field, $operator = null, $value = null) {
return new Expr($field, $operator, $value);
} | [
"public",
"static",
"function",
"expr",
"(",
"$",
"field",
",",
"$",
"operator",
"=",
"null",
",",
"$",
"value",
"=",
"null",
")",
"{",
"return",
"new",
"Expr",
"(",
"$",
"field",
",",
"$",
"operator",
",",
"$",
"value",
")",
";",
"}"
]
| Instantiate a new database expression.
@param string $field
@param string $operator
@param mixed $value
@return \Titon\Db\Query\Expr | [
"Instantiate",
"a",
"new",
"database",
"expression",
"."
]
| train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Query/ExprAware.php#L25-L27 |
rayrutjes/domain-foundation | src/UnitOfWork/AggregateRootContainer.php | AggregateRootContainer.add | public function add(AggregateRoot $aggregateRoot, EventBus $eventBus, SaveAggregateCallback $saveAggregateCallback)
{
$previouslyRegisteredAggregateRoot = $this->findSimilarAggregateRoot($aggregateRoot);
if (null !== $previouslyRegisteredAggregateRoot) {
return $previouslyRegisteredAggregateRoot;
}
$aggregateRootHash = $this->getAggregateRootHash($aggregateRoot);
$this->aggregateRoots[$aggregateRootHash] = $aggregateRoot;
$this->aggregateRootSaveCallbacks[$aggregateRootHash] = $saveAggregateCallback;
$eventRegistrationCallback = new DefaultUnitOfWorkEventRegistrationCallback($this->unitOfWork, $eventBus);
$aggregateRoot->addEventRegistrationCallback($eventRegistrationCallback);
return $aggregateRoot;
} | php | public function add(AggregateRoot $aggregateRoot, EventBus $eventBus, SaveAggregateCallback $saveAggregateCallback)
{
$previouslyRegisteredAggregateRoot = $this->findSimilarAggregateRoot($aggregateRoot);
if (null !== $previouslyRegisteredAggregateRoot) {
return $previouslyRegisteredAggregateRoot;
}
$aggregateRootHash = $this->getAggregateRootHash($aggregateRoot);
$this->aggregateRoots[$aggregateRootHash] = $aggregateRoot;
$this->aggregateRootSaveCallbacks[$aggregateRootHash] = $saveAggregateCallback;
$eventRegistrationCallback = new DefaultUnitOfWorkEventRegistrationCallback($this->unitOfWork, $eventBus);
$aggregateRoot->addEventRegistrationCallback($eventRegistrationCallback);
return $aggregateRoot;
} | [
"public",
"function",
"add",
"(",
"AggregateRoot",
"$",
"aggregateRoot",
",",
"EventBus",
"$",
"eventBus",
",",
"SaveAggregateCallback",
"$",
"saveAggregateCallback",
")",
"{",
"$",
"previouslyRegisteredAggregateRoot",
"=",
"$",
"this",
"->",
"findSimilarAggregateRoot",
"(",
"$",
"aggregateRoot",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"previouslyRegisteredAggregateRoot",
")",
"{",
"return",
"$",
"previouslyRegisteredAggregateRoot",
";",
"}",
"$",
"aggregateRootHash",
"=",
"$",
"this",
"->",
"getAggregateRootHash",
"(",
"$",
"aggregateRoot",
")",
";",
"$",
"this",
"->",
"aggregateRoots",
"[",
"$",
"aggregateRootHash",
"]",
"=",
"$",
"aggregateRoot",
";",
"$",
"this",
"->",
"aggregateRootSaveCallbacks",
"[",
"$",
"aggregateRootHash",
"]",
"=",
"$",
"saveAggregateCallback",
";",
"$",
"eventRegistrationCallback",
"=",
"new",
"DefaultUnitOfWorkEventRegistrationCallback",
"(",
"$",
"this",
"->",
"unitOfWork",
",",
"$",
"eventBus",
")",
";",
"$",
"aggregateRoot",
"->",
"addEventRegistrationCallback",
"(",
"$",
"eventRegistrationCallback",
")",
";",
"return",
"$",
"aggregateRoot",
";",
"}"
]
| @param AggregateRoot $aggregateRoot
@param EventBus $eventBus
@param SaveAggregateCallback $saveAggregateCallback
@return AggregateRoot | [
"@param",
"AggregateRoot",
"$aggregateRoot",
"@param",
"EventBus",
"$eventBus",
"@param",
"SaveAggregateCallback",
"$saveAggregateCallback"
]
| train | https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/UnitOfWork/AggregateRootContainer.php#L40-L55 |
rayrutjes/domain-foundation | src/UnitOfWork/AggregateRootContainer.php | AggregateRootContainer.saveAggregateRoots | public function saveAggregateRoots()
{
foreach ($this->aggregateRoots as $aggregateRootHash => $aggregateRoot) {
$this->aggregateRootSaveCallbacks[$aggregateRootHash]->save($aggregateRoot);
}
} | php | public function saveAggregateRoots()
{
foreach ($this->aggregateRoots as $aggregateRootHash => $aggregateRoot) {
$this->aggregateRootSaveCallbacks[$aggregateRootHash]->save($aggregateRoot);
}
} | [
"public",
"function",
"saveAggregateRoots",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"aggregateRoots",
"as",
"$",
"aggregateRootHash",
"=>",
"$",
"aggregateRoot",
")",
"{",
"$",
"this",
"->",
"aggregateRootSaveCallbacks",
"[",
"$",
"aggregateRootHash",
"]",
"->",
"save",
"(",
"$",
"aggregateRoot",
")",
";",
"}",
"}"
]
| Triggers all saving callbacks on all staged aggregates. | [
"Triggers",
"all",
"saving",
"callbacks",
"on",
"all",
"staged",
"aggregates",
"."
]
| train | https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/UnitOfWork/AggregateRootContainer.php#L68-L73 |
rayrutjes/domain-foundation | src/UnitOfWork/AggregateRootContainer.php | AggregateRootContainer.findSimilarAggregateRoot | private function findSimilarAggregateRoot(AggregateRoot $aggregateRoot)
{
foreach ($this->aggregateRoots as $registeredAggregateRoot) {
if ($registeredAggregateRoot->sameIdentityAs($aggregateRoot)) {
return $registeredAggregateRoot;
}
}
return;
} | php | private function findSimilarAggregateRoot(AggregateRoot $aggregateRoot)
{
foreach ($this->aggregateRoots as $registeredAggregateRoot) {
if ($registeredAggregateRoot->sameIdentityAs($aggregateRoot)) {
return $registeredAggregateRoot;
}
}
return;
} | [
"private",
"function",
"findSimilarAggregateRoot",
"(",
"AggregateRoot",
"$",
"aggregateRoot",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"aggregateRoots",
"as",
"$",
"registeredAggregateRoot",
")",
"{",
"if",
"(",
"$",
"registeredAggregateRoot",
"->",
"sameIdentityAs",
"(",
"$",
"aggregateRoot",
")",
")",
"{",
"return",
"$",
"registeredAggregateRoot",
";",
"}",
"}",
"return",
";",
"}"
]
| @param AggregateRoot $aggregateRoot
@return AggregateRoot|null | [
"@param",
"AggregateRoot",
"$aggregateRoot"
]
| train | https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/UnitOfWork/AggregateRootContainer.php#L80-L89 |
opis/http | src/MimeType.php | MimeType.get | public static function get(string $file, bool $guess = true): string
{
if($guess === true) {
$extension = pathinfo($file, PATHINFO_EXTENSION);
if(isset(self::$defaultMime[$extension])) {
return self::$defaultMime[$extension];
}
}
// Get mime using the file information functions
$info = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($info, $file);
finfo_close($info);
if(false === $mime){
$mime = 'application/octet-stream';
}
return $mime;
} | php | public static function get(string $file, bool $guess = true): string
{
if($guess === true) {
$extension = pathinfo($file, PATHINFO_EXTENSION);
if(isset(self::$defaultMime[$extension])) {
return self::$defaultMime[$extension];
}
}
// Get mime using the file information functions
$info = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($info, $file);
finfo_close($info);
if(false === $mime){
$mime = 'application/octet-stream';
}
return $mime;
} | [
"public",
"static",
"function",
"get",
"(",
"string",
"$",
"file",
",",
"bool",
"$",
"guess",
"=",
"true",
")",
":",
"string",
"{",
"if",
"(",
"$",
"guess",
"===",
"true",
")",
"{",
"$",
"extension",
"=",
"pathinfo",
"(",
"$",
"file",
",",
"PATHINFO_EXTENSION",
")",
";",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"defaultMime",
"[",
"$",
"extension",
"]",
")",
")",
"{",
"return",
"self",
"::",
"$",
"defaultMime",
"[",
"$",
"extension",
"]",
";",
"}",
"}",
"// Get mime using the file information functions",
"$",
"info",
"=",
"finfo_open",
"(",
"FILEINFO_MIME_TYPE",
")",
";",
"$",
"mime",
"=",
"finfo_file",
"(",
"$",
"info",
",",
"$",
"file",
")",
";",
"finfo_close",
"(",
"$",
"info",
")",
";",
"if",
"(",
"false",
"===",
"$",
"mime",
")",
"{",
"$",
"mime",
"=",
"'application/octet-stream'",
";",
"}",
"return",
"$",
"mime",
";",
"}"
]
| Returns the mime type of a file.
@param string $file Full path to the file
@param boolean $guess (optional) Set to false to disable mime type guessing
@return string | [
"Returns",
"the",
"mime",
"type",
"of",
"a",
"file",
"."
]
| train | https://github.com/opis/http/blob/70b813ba97d65b53fad3fb58b800add8b10d7291/src/MimeType.php#L805-L824 |
whisller/IrcBotBundle | EventListener/Plugins/Commands/SeenCommandListener.php | SeenCommandListener.onCommand | public function onCommand(BotCommandFoundEvent $event)
{
$arguments = $event->getArguments();
if (!isset($arguments[0])) {
$this->noNickname($event);
} else {
$seen = $this->readFromSeen($arguments[0]);
if ($seen) {
$this->sendMessage(array($event->getChannel()), $event->getNickname().' I\'ve seen '.$arguments[0].' at '.$seen.' '.date_default_timezone_get());
} else {
$this->noInformationAvailable($event);
}
}
} | php | public function onCommand(BotCommandFoundEvent $event)
{
$arguments = $event->getArguments();
if (!isset($arguments[0])) {
$this->noNickname($event);
} else {
$seen = $this->readFromSeen($arguments[0]);
if ($seen) {
$this->sendMessage(array($event->getChannel()), $event->getNickname().' I\'ve seen '.$arguments[0].' at '.$seen.' '.date_default_timezone_get());
} else {
$this->noInformationAvailable($event);
}
}
} | [
"public",
"function",
"onCommand",
"(",
"BotCommandFoundEvent",
"$",
"event",
")",
"{",
"$",
"arguments",
"=",
"$",
"event",
"->",
"getArguments",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"arguments",
"[",
"0",
"]",
")",
")",
"{",
"$",
"this",
"->",
"noNickname",
"(",
"$",
"event",
")",
";",
"}",
"else",
"{",
"$",
"seen",
"=",
"$",
"this",
"->",
"readFromSeen",
"(",
"$",
"arguments",
"[",
"0",
"]",
")",
";",
"if",
"(",
"$",
"seen",
")",
"{",
"$",
"this",
"->",
"sendMessage",
"(",
"array",
"(",
"$",
"event",
"->",
"getChannel",
"(",
")",
")",
",",
"$",
"event",
"->",
"getNickname",
"(",
")",
".",
"' I\\'ve seen '",
".",
"$",
"arguments",
"[",
"0",
"]",
".",
"' at '",
".",
"$",
"seen",
".",
"' '",
".",
"date_default_timezone_get",
"(",
")",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"noInformationAvailable",
"(",
"$",
"event",
")",
";",
"}",
"}",
"}"
]
| {@inheritdoc} | [
"{"
]
| train | https://github.com/whisller/IrcBotBundle/blob/d8bcafc1599cbbc7756b0a59f51ee988a2de0f2e/EventListener/Plugins/Commands/SeenCommandListener.php#L24-L38 |
aedart/laravel-helpers | src/Traits/Mail/MailQueueTrait.php | MailQueueTrait.getMailQueue | public function getMailQueue(): ?MailQueue
{
if (!$this->hasMailQueue()) {
$this->setMailQueue($this->getDefaultMailQueue());
}
return $this->mailQueue;
} | php | public function getMailQueue(): ?MailQueue
{
if (!$this->hasMailQueue()) {
$this->setMailQueue($this->getDefaultMailQueue());
}
return $this->mailQueue;
} | [
"public",
"function",
"getMailQueue",
"(",
")",
":",
"?",
"MailQueue",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasMailQueue",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setMailQueue",
"(",
"$",
"this",
"->",
"getDefaultMailQueue",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"mailQueue",
";",
"}"
]
| Get mail queue
If no mail queue has been set, this method will
set and return a default mail queue, if any such
value is available
@see getDefaultMailQueue()
@return MailQueue|null mail queue or null if none mail queue has been set | [
"Get",
"mail",
"queue"
]
| train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Mail/MailQueueTrait.php#L53-L59 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Common/CoverFishColor.php | CoverFishColor.setColor | public static function setColor($color, $string)
{
if (!isset(self::$colorTable[$color]))
{
throw new \Exception('ansi color is not defined');
}
return sprintf("\033[%sm%s\033[0m", self::$colorTable[$color], $string);
} | php | public static function setColor($color, $string)
{
if (!isset(self::$colorTable[$color]))
{
throw new \Exception('ansi color is not defined');
}
return sprintf("\033[%sm%s\033[0m", self::$colorTable[$color], $string);
} | [
"public",
"static",
"function",
"setColor",
"(",
"$",
"color",
",",
"$",
"string",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"colorTable",
"[",
"$",
"color",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'ansi color is not defined'",
")",
";",
"}",
"return",
"sprintf",
"(",
"\"\\033[%sm%s\\033[0m\"",
",",
"self",
"::",
"$",
"colorTable",
"[",
"$",
"color",
"]",
",",
"$",
"string",
")",
";",
"}"
]
| Make string appear in color
@param string $color
@param string $string
@return string
@throws \Exception | [
"Make",
"string",
"appear",
"in",
"color"
]
| train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Common/CoverFishColor.php#L63-L71 |
nguyenanhung/nusoap | src/nusoap_wsdlcache.php | nusoap_wsdlcache.get | function get($wsdl)
{
$filename = $this->createFilename($wsdl);
if ($this->obtainMutex($filename, "r")) {
// check for expired WSDL that must be removed from the cache
if ($this->cache_lifetime > 0) {
if (file_exists($filename) && (time() - filemtime($filename) > $this->cache_lifetime)) {
unlink($filename);
$this->debug("Expired $wsdl ($filename) from cache");
$this->releaseMutex($filename);
return NULL;
}
}
// see what there is to return
if (!file_exists($filename)) {
$this->debug("$wsdl ($filename) not in cache (1)");
$this->releaseMutex($filename);
return NULL;
}
$fp = @fopen($filename, "r");
if ($fp) {
$s = implode("", @file($filename));
fclose($fp);
$this->debug("Got $wsdl ($filename) from cache");
} else {
$s = NULL;
$this->debug("$wsdl ($filename) not in cache (2)");
}
$this->releaseMutex($filename);
return (!is_null($s)) ? unserialize($s) : NULL;
} else {
$this->debug("Unable to obtain mutex for $filename in get");
}
return NULL;
} | php | function get($wsdl)
{
$filename = $this->createFilename($wsdl);
if ($this->obtainMutex($filename, "r")) {
// check for expired WSDL that must be removed from the cache
if ($this->cache_lifetime > 0) {
if (file_exists($filename) && (time() - filemtime($filename) > $this->cache_lifetime)) {
unlink($filename);
$this->debug("Expired $wsdl ($filename) from cache");
$this->releaseMutex($filename);
return NULL;
}
}
// see what there is to return
if (!file_exists($filename)) {
$this->debug("$wsdl ($filename) not in cache (1)");
$this->releaseMutex($filename);
return NULL;
}
$fp = @fopen($filename, "r");
if ($fp) {
$s = implode("", @file($filename));
fclose($fp);
$this->debug("Got $wsdl ($filename) from cache");
} else {
$s = NULL;
$this->debug("$wsdl ($filename) not in cache (2)");
}
$this->releaseMutex($filename);
return (!is_null($s)) ? unserialize($s) : NULL;
} else {
$this->debug("Unable to obtain mutex for $filename in get");
}
return NULL;
} | [
"function",
"get",
"(",
"$",
"wsdl",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"createFilename",
"(",
"$",
"wsdl",
")",
";",
"if",
"(",
"$",
"this",
"->",
"obtainMutex",
"(",
"$",
"filename",
",",
"\"r\"",
")",
")",
"{",
"// check for expired WSDL that must be removed from the cache\r",
"if",
"(",
"$",
"this",
"->",
"cache_lifetime",
">",
"0",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"filename",
")",
"&&",
"(",
"time",
"(",
")",
"-",
"filemtime",
"(",
"$",
"filename",
")",
">",
"$",
"this",
"->",
"cache_lifetime",
")",
")",
"{",
"unlink",
"(",
"$",
"filename",
")",
";",
"$",
"this",
"->",
"debug",
"(",
"\"Expired $wsdl ($filename) from cache\"",
")",
";",
"$",
"this",
"->",
"releaseMutex",
"(",
"$",
"filename",
")",
";",
"return",
"NULL",
";",
"}",
"}",
"// see what there is to return\r",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"filename",
")",
")",
"{",
"$",
"this",
"->",
"debug",
"(",
"\"$wsdl ($filename) not in cache (1)\"",
")",
";",
"$",
"this",
"->",
"releaseMutex",
"(",
"$",
"filename",
")",
";",
"return",
"NULL",
";",
"}",
"$",
"fp",
"=",
"@",
"fopen",
"(",
"$",
"filename",
",",
"\"r\"",
")",
";",
"if",
"(",
"$",
"fp",
")",
"{",
"$",
"s",
"=",
"implode",
"(",
"\"\"",
",",
"@",
"file",
"(",
"$",
"filename",
")",
")",
";",
"fclose",
"(",
"$",
"fp",
")",
";",
"$",
"this",
"->",
"debug",
"(",
"\"Got $wsdl ($filename) from cache\"",
")",
";",
"}",
"else",
"{",
"$",
"s",
"=",
"NULL",
";",
"$",
"this",
"->",
"debug",
"(",
"\"$wsdl ($filename) not in cache (2)\"",
")",
";",
"}",
"$",
"this",
"->",
"releaseMutex",
"(",
"$",
"filename",
")",
";",
"return",
"(",
"!",
"is_null",
"(",
"$",
"s",
")",
")",
"?",
"unserialize",
"(",
"$",
"s",
")",
":",
"NULL",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"debug",
"(",
"\"Unable to obtain mutex for $filename in get\"",
")",
";",
"}",
"return",
"NULL",
";",
"}"
]
| gets a wsdl instance from the cache
@param string $wsdl The URL of the wsdl instance
@return object wsdl The cached wsdl instance, null if the instance is not in the cache
@access public | [
"gets",
"a",
"wsdl",
"instance",
"from",
"the",
"cache"
]
| train | https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src/nusoap_wsdlcache.php#L92-L130 |
nguyenanhung/nusoap | src/nusoap_wsdlcache.php | nusoap_wsdlcache.obtainMutex | function obtainMutex($filename, $mode)
{
if (isset($this->fplock[md5($filename)])) {
$this->debug("Lock for $filename already exists");
return FALSE;
}
$this->fplock[md5($filename)] = fopen($filename . ".lock", "w");
if ($mode == "r") {
return flock($this->fplock[md5($filename)], LOCK_SH);
} else {
return flock($this->fplock[md5($filename)], LOCK_EX);
}
} | php | function obtainMutex($filename, $mode)
{
if (isset($this->fplock[md5($filename)])) {
$this->debug("Lock for $filename already exists");
return FALSE;
}
$this->fplock[md5($filename)] = fopen($filename . ".lock", "w");
if ($mode == "r") {
return flock($this->fplock[md5($filename)], LOCK_SH);
} else {
return flock($this->fplock[md5($filename)], LOCK_EX);
}
} | [
"function",
"obtainMutex",
"(",
"$",
"filename",
",",
"$",
"mode",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"fplock",
"[",
"md5",
"(",
"$",
"filename",
")",
"]",
")",
")",
"{",
"$",
"this",
"->",
"debug",
"(",
"\"Lock for $filename already exists\"",
")",
";",
"return",
"FALSE",
";",
"}",
"$",
"this",
"->",
"fplock",
"[",
"md5",
"(",
"$",
"filename",
")",
"]",
"=",
"fopen",
"(",
"$",
"filename",
".",
"\".lock\"",
",",
"\"w\"",
")",
";",
"if",
"(",
"$",
"mode",
"==",
"\"r\"",
")",
"{",
"return",
"flock",
"(",
"$",
"this",
"->",
"fplock",
"[",
"md5",
"(",
"$",
"filename",
")",
"]",
",",
"LOCK_SH",
")",
";",
"}",
"else",
"{",
"return",
"flock",
"(",
"$",
"this",
"->",
"fplock",
"[",
"md5",
"(",
"$",
"filename",
")",
"]",
",",
"LOCK_EX",
")",
";",
"}",
"}"
]
| obtains the local mutex
@param string $filename The Filename of the Cache to lock
@param string $mode The open-mode ("r" or "w") or the file - affects lock-mode
@return boolean Lock successfully obtained ?!
@access private | [
"obtains",
"the",
"local",
"mutex"
]
| train | https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src/nusoap_wsdlcache.php#L141-L154 |
nguyenanhung/nusoap | src/nusoap_wsdlcache.php | nusoap_wsdlcache.put | function put($wsdl_instance)
{
$filename = $this->createFilename($wsdl_instance->wsdl);
$s = serialize($wsdl_instance);
if ($this->obtainMutex($filename, "w")) {
$fp = fopen($filename, "w");
if (!$fp) {
$this->debug("Cannot write $wsdl_instance->wsdl ($filename) in cache");
$this->releaseMutex($filename);
return FALSE;
}
fputs($fp, $s);
fclose($fp);
$this->debug("Put $wsdl_instance->wsdl ($filename) in cache");
$this->releaseMutex($filename);
return TRUE;
} else {
$this->debug("Unable to obtain mutex for $filename in put");
}
return FALSE;
} | php | function put($wsdl_instance)
{
$filename = $this->createFilename($wsdl_instance->wsdl);
$s = serialize($wsdl_instance);
if ($this->obtainMutex($filename, "w")) {
$fp = fopen($filename, "w");
if (!$fp) {
$this->debug("Cannot write $wsdl_instance->wsdl ($filename) in cache");
$this->releaseMutex($filename);
return FALSE;
}
fputs($fp, $s);
fclose($fp);
$this->debug("Put $wsdl_instance->wsdl ($filename) in cache");
$this->releaseMutex($filename);
return TRUE;
} else {
$this->debug("Unable to obtain mutex for $filename in put");
}
return FALSE;
} | [
"function",
"put",
"(",
"$",
"wsdl_instance",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"createFilename",
"(",
"$",
"wsdl_instance",
"->",
"wsdl",
")",
";",
"$",
"s",
"=",
"serialize",
"(",
"$",
"wsdl_instance",
")",
";",
"if",
"(",
"$",
"this",
"->",
"obtainMutex",
"(",
"$",
"filename",
",",
"\"w\"",
")",
")",
"{",
"$",
"fp",
"=",
"fopen",
"(",
"$",
"filename",
",",
"\"w\"",
")",
";",
"if",
"(",
"!",
"$",
"fp",
")",
"{",
"$",
"this",
"->",
"debug",
"(",
"\"Cannot write $wsdl_instance->wsdl ($filename) in cache\"",
")",
";",
"$",
"this",
"->",
"releaseMutex",
"(",
"$",
"filename",
")",
";",
"return",
"FALSE",
";",
"}",
"fputs",
"(",
"$",
"fp",
",",
"$",
"s",
")",
";",
"fclose",
"(",
"$",
"fp",
")",
";",
"$",
"this",
"->",
"debug",
"(",
"\"Put $wsdl_instance->wsdl ($filename) in cache\"",
")",
";",
"$",
"this",
"->",
"releaseMutex",
"(",
"$",
"filename",
")",
";",
"return",
"TRUE",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"debug",
"(",
"\"Unable to obtain mutex for $filename in put\"",
")",
";",
"}",
"return",
"FALSE",
";",
"}"
]
| adds a wsdl instance to the cache
@param object wsdl $wsdl_instance The wsdl instance to add
@return boolean WSDL successfully cached
@access public | [
"adds",
"a",
"wsdl",
"instance",
"to",
"the",
"cache"
]
| train | https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src/nusoap_wsdlcache.php#L164-L187 |
forxer/tao | src/Tao/Database/Model.php | Model.has | public function has($primaryKey, $column = null)
{
if (null === $column) {
$column = $this->getPrimaryKey();
}
return (boolean)$this->app['db']->fetchColumn(
'SELECT COUNT(:column) FROM ' . $this->getTable() . ' WHERE '.$this->getPrimaryKey().' = :pk',
[
'column' => $column,
'pk' => $primaryKey
]
);
} | php | public function has($primaryKey, $column = null)
{
if (null === $column) {
$column = $this->getPrimaryKey();
}
return (boolean)$this->app['db']->fetchColumn(
'SELECT COUNT(:column) FROM ' . $this->getTable() . ' WHERE '.$this->getPrimaryKey().' = :pk',
[
'column' => $column,
'pk' => $primaryKey
]
);
} | [
"public",
"function",
"has",
"(",
"$",
"primaryKey",
",",
"$",
"column",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"column",
")",
"{",
"$",
"column",
"=",
"$",
"this",
"->",
"getPrimaryKey",
"(",
")",
";",
"}",
"return",
"(",
"boolean",
")",
"$",
"this",
"->",
"app",
"[",
"'db'",
"]",
"->",
"fetchColumn",
"(",
"'SELECT COUNT(:column) FROM '",
".",
"$",
"this",
"->",
"getTable",
"(",
")",
".",
"' WHERE '",
".",
"$",
"this",
"->",
"getPrimaryKey",
"(",
")",
".",
"' = :pk'",
",",
"[",
"'column'",
"=>",
"$",
"column",
",",
"'pk'",
"=>",
"$",
"primaryKey",
"]",
")",
";",
"}"
]
| Indicate if a given entry exists.
@param mixed $primaryKey
@param string $column
@return boolean | [
"Indicate",
"if",
"a",
"given",
"entry",
"exists",
"."
]
| train | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Database/Model.php#L49-L62 |
forxer/tao | src/Tao/Database/Model.php | Model.insert | public function insert(array $data)
{
$this->normalizeDataColumns($data);
$this->setSearchIndexableData($data);
return $this->app['db']->insert($this->getTable(), $data);
} | php | public function insert(array $data)
{
$this->normalizeDataColumns($data);
$this->setSearchIndexableData($data);
return $this->app['db']->insert($this->getTable(), $data);
} | [
"public",
"function",
"insert",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"normalizeDataColumns",
"(",
"$",
"data",
")",
";",
"$",
"this",
"->",
"setSearchIndexableData",
"(",
"$",
"data",
")",
";",
"return",
"$",
"this",
"->",
"app",
"[",
"'db'",
"]",
"->",
"insert",
"(",
"$",
"this",
"->",
"getTable",
"(",
")",
",",
"$",
"data",
")",
";",
"}"
]
| Insert an entry.
@param array $data | [
"Insert",
"an",
"entry",
"."
]
| train | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Database/Model.php#L69-L76 |
forxer/tao | src/Tao/Database/Model.php | Model.update | public function update(array $data, $primaryKey)
{
$this->normalizeDataColumns($data);
$this->setSearchIndexableData($data);
return $this->app['db']->update($this->getTable(), $data, [ $this->getPrimaryKey() => $primaryKey]);
} | php | public function update(array $data, $primaryKey)
{
$this->normalizeDataColumns($data);
$this->setSearchIndexableData($data);
return $this->app['db']->update($this->getTable(), $data, [ $this->getPrimaryKey() => $primaryKey]);
} | [
"public",
"function",
"update",
"(",
"array",
"$",
"data",
",",
"$",
"primaryKey",
")",
"{",
"$",
"this",
"->",
"normalizeDataColumns",
"(",
"$",
"data",
")",
";",
"$",
"this",
"->",
"setSearchIndexableData",
"(",
"$",
"data",
")",
";",
"return",
"$",
"this",
"->",
"app",
"[",
"'db'",
"]",
"->",
"update",
"(",
"$",
"this",
"->",
"getTable",
"(",
")",
",",
"$",
"data",
",",
"[",
"$",
"this",
"->",
"getPrimaryKey",
"(",
")",
"=>",
"$",
"primaryKey",
"]",
")",
";",
"}"
]
| Update an entry.
@param array $data
@param mixed $primaryKey | [
"Update",
"an",
"entry",
"."
]
| train | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Database/Model.php#L84-L91 |
forxer/tao | src/Tao/Database/Model.php | Model.delete | public function delete($primaryKey)
{
return $this->app['db']->delete($this->getTable(), [ $this->getPrimaryKey() => $primaryKey]);
} | php | public function delete($primaryKey)
{
return $this->app['db']->delete($this->getTable(), [ $this->getPrimaryKey() => $primaryKey]);
} | [
"public",
"function",
"delete",
"(",
"$",
"primaryKey",
")",
"{",
"return",
"$",
"this",
"->",
"app",
"[",
"'db'",
"]",
"->",
"delete",
"(",
"$",
"this",
"->",
"getTable",
"(",
")",
",",
"[",
"$",
"this",
"->",
"getPrimaryKey",
"(",
")",
"=>",
"$",
"primaryKey",
"]",
")",
";",
"}"
]
| Delete an entry.
@param mixed $primaryKey | [
"Delete",
"an",
"entry",
"."
]
| train | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Database/Model.php#L98-L101 |
forxer/tao | src/Tao/Database/Model.php | Model.getColumns | public function getColumns($bWithoutForeignKey = true, $bAliased = true, $bPrefixed = false)
{
$aColumns = $this->columns;
if ($bWithoutForeignKey) {
$aColumns = $this->removeForeignKeyColumns($aColumns);
}
if ($bAliased) {
$aColumns = $this->aliaseColumns($aColumns, $this->getAlias());
}
if ($bPrefixed) {
$aColumns = $this->prefixeColumns($aColumns, $this->getAlias());
}
return $aColumns;
} | php | public function getColumns($bWithoutForeignKey = true, $bAliased = true, $bPrefixed = false)
{
$aColumns = $this->columns;
if ($bWithoutForeignKey) {
$aColumns = $this->removeForeignKeyColumns($aColumns);
}
if ($bAliased) {
$aColumns = $this->aliaseColumns($aColumns, $this->getAlias());
}
if ($bPrefixed) {
$aColumns = $this->prefixeColumns($aColumns, $this->getAlias());
}
return $aColumns;
} | [
"public",
"function",
"getColumns",
"(",
"$",
"bWithoutForeignKey",
"=",
"true",
",",
"$",
"bAliased",
"=",
"true",
",",
"$",
"bPrefixed",
"=",
"false",
")",
"{",
"$",
"aColumns",
"=",
"$",
"this",
"->",
"columns",
";",
"if",
"(",
"$",
"bWithoutForeignKey",
")",
"{",
"$",
"aColumns",
"=",
"$",
"this",
"->",
"removeForeignKeyColumns",
"(",
"$",
"aColumns",
")",
";",
"}",
"if",
"(",
"$",
"bAliased",
")",
"{",
"$",
"aColumns",
"=",
"$",
"this",
"->",
"aliaseColumns",
"(",
"$",
"aColumns",
",",
"$",
"this",
"->",
"getAlias",
"(",
")",
")",
";",
"}",
"if",
"(",
"$",
"bPrefixed",
")",
"{",
"$",
"aColumns",
"=",
"$",
"this",
"->",
"prefixeColumns",
"(",
"$",
"aColumns",
",",
"$",
"this",
"->",
"getAlias",
"(",
")",
")",
";",
"}",
"return",
"$",
"aColumns",
";",
"}"
]
| Get the columns names.
@param boolean $bWithoutForeignKey Return with or without foreign keys.
@param boolean $bAliased Return or not aliased columns names.
@param boolean $bPrefixed Return or not prefixed columns names.
@return array | [
"Get",
"the",
"columns",
"names",
"."
]
| train | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Database/Model.php#L187-L204 |
forxer/tao | src/Tao/Database/Model.php | Model.getPrimaryKey | public function getPrimaryKey($bAliased = false)
{
return $bAliased
? $this->getAlias() . '.' . $this->primaryKey
: $this->primaryKey;
} | php | public function getPrimaryKey($bAliased = false)
{
return $bAliased
? $this->getAlias() . '.' . $this->primaryKey
: $this->primaryKey;
} | [
"public",
"function",
"getPrimaryKey",
"(",
"$",
"bAliased",
"=",
"false",
")",
"{",
"return",
"$",
"bAliased",
"?",
"$",
"this",
"->",
"getAlias",
"(",
")",
".",
"'.'",
".",
"$",
"this",
"->",
"primaryKey",
":",
"$",
"this",
"->",
"primaryKey",
";",
"}"
]
| Get the table primary key.
@param boolean $bAliased Return or not aliased primary key.
@return string | [
"Get",
"the",
"table",
"primary",
"key",
"."
]
| train | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Database/Model.php#L222-L227 |
yuncms/framework | src/behaviors/JsonBehavior.php | JsonBehavior.initialization | protected function initialization()
{
foreach ($this->attributes as $attribute) {
$this->owner->setAttribute($attribute, new JsonObject());
}
} | php | protected function initialization()
{
foreach ($this->attributes as $attribute) {
$this->owner->setAttribute($attribute, new JsonObject());
}
} | [
"protected",
"function",
"initialization",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"attributes",
"as",
"$",
"attribute",
")",
"{",
"$",
"this",
"->",
"owner",
"->",
"setAttribute",
"(",
"$",
"attribute",
",",
"new",
"JsonObject",
"(",
")",
")",
";",
"}",
"}"
]
| 初始化 | [
"初始化"
]
| train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/behaviors/JsonBehavior.php#L77-L82 |
nexusnetsoftgmbh/nexuscli | src/Nexus/CustomCommand/Business/CustomCommandFacade.php | CustomCommandFacade.hydrateCommands | public function hydrateCommands(array $commands, string $directory, bool $recursive): array
{
return $this->getFactory()->createCommandHydrator($directory, $recursive)->hydrateCommands($commands);
} | php | public function hydrateCommands(array $commands, string $directory, bool $recursive): array
{
return $this->getFactory()->createCommandHydrator($directory, $recursive)->hydrateCommands($commands);
} | [
"public",
"function",
"hydrateCommands",
"(",
"array",
"$",
"commands",
",",
"string",
"$",
"directory",
",",
"bool",
"$",
"recursive",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createCommandHydrator",
"(",
"$",
"directory",
",",
"$",
"recursive",
")",
"->",
"hydrateCommands",
"(",
"$",
"commands",
")",
";",
"}"
]
| @param array $commands
@param string $directory
@param bool $recursive
@return array | [
"@param",
"array",
"$commands",
"@param",
"string",
"$directory",
"@param",
"bool",
"$recursive"
]
| train | https://github.com/nexusnetsoftgmbh/nexuscli/blob/8416b43d31ad56ea379ae2b0bf85d456e78ba67a/src/Nexus/CustomCommand/Business/CustomCommandFacade.php#L21-L24 |
PeekAndPoke/psi | src/Operation/Terminal/MaxOperation.php | MaxOperation.apply | public function apply(\Iterator $set)
{
$data = iterator_to_array($set);
return count($data) > 0 ? max($data) : 0;
} | php | public function apply(\Iterator $set)
{
$data = iterator_to_array($set);
return count($data) > 0 ? max($data) : 0;
} | [
"public",
"function",
"apply",
"(",
"\\",
"Iterator",
"$",
"set",
")",
"{",
"$",
"data",
"=",
"iterator_to_array",
"(",
"$",
"set",
")",
";",
"return",
"count",
"(",
"$",
"data",
")",
">",
"0",
"?",
"max",
"(",
"$",
"data",
")",
":",
"0",
";",
"}"
]
| {@inheritdoc}
@return float | [
"{",
"@inheritdoc",
"}"
]
| train | https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/Operation/Terminal/MaxOperation.php#L24-L29 |
lelivrescolaire/SQSBundle | DependencyInjection/LLSSQSExtension.php | LLSSQSExtension.loadQueues | public function loadQueues(ContainerBuilder $container, array $config)
{
foreach ($config as $name => $attributes) {
$container
->setDefinition(
self::getQueueServiceKey($name),
new Definition(
$container->getParameter('llssqs.model.queue.class'),
array(
new Reference(
LLSAWSExtension::getServiceServiceKey($attributes['service'])
),
new Reference('llssqs.model.message.factory'),
$attributes['name']
)
)
);
}
return $this;
} | php | public function loadQueues(ContainerBuilder $container, array $config)
{
foreach ($config as $name => $attributes) {
$container
->setDefinition(
self::getQueueServiceKey($name),
new Definition(
$container->getParameter('llssqs.model.queue.class'),
array(
new Reference(
LLSAWSExtension::getServiceServiceKey($attributes['service'])
),
new Reference('llssqs.model.message.factory'),
$attributes['name']
)
)
);
}
return $this;
} | [
"public",
"function",
"loadQueues",
"(",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"config",
")",
"{",
"foreach",
"(",
"$",
"config",
"as",
"$",
"name",
"=>",
"$",
"attributes",
")",
"{",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"getQueueServiceKey",
"(",
"$",
"name",
")",
",",
"new",
"Definition",
"(",
"$",
"container",
"->",
"getParameter",
"(",
"'llssqs.model.queue.class'",
")",
",",
"array",
"(",
"new",
"Reference",
"(",
"LLSAWSExtension",
"::",
"getServiceServiceKey",
"(",
"$",
"attributes",
"[",
"'service'",
"]",
")",
")",
",",
"new",
"Reference",
"(",
"'llssqs.model.message.factory'",
")",
",",
"$",
"attributes",
"[",
"'name'",
"]",
")",
")",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
]
| Load queues from user configuration
@param ContainerBuilder $container SF2 Container Builder
@param array $config Configuration array
@return {$this} | [
"Load",
"queues",
"from",
"user",
"configuration"
]
| train | https://github.com/lelivrescolaire/SQSBundle/blob/bba3fa6d63d0ae1bddbc7b2fe3c2e737f49d6559/DependencyInjection/LLSSQSExtension.php#L46-L66 |
aedart/config-loader | src/Traits/ConfigLoaderTrait.php | ConfigLoaderTrait.getConfigLoader | public function getConfigLoader(): ?ConfigLoader
{
if (!$this->hasConfigLoader()) {
$this->setConfigLoader($this->getDefaultConfigLoader());
}
return $this->configLoader;
} | php | public function getConfigLoader(): ?ConfigLoader
{
if (!$this->hasConfigLoader()) {
$this->setConfigLoader($this->getDefaultConfigLoader());
}
return $this->configLoader;
} | [
"public",
"function",
"getConfigLoader",
"(",
")",
":",
"?",
"ConfigLoader",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasConfigLoader",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setConfigLoader",
"(",
"$",
"this",
"->",
"getDefaultConfigLoader",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"configLoader",
";",
"}"
]
| Get config loader
If no config loader has been set, this method will
set and return a default config loader, if any such
value is available
@see getDefaultConfigLoader()
@return ConfigLoader|null config loader or null if none config loader has been set | [
"Get",
"config",
"loader"
]
| train | https://github.com/aedart/config-loader/blob/9e1cf592bee46ba4930bb9c352aaf475d81266ea/src/Traits/ConfigLoaderTrait.php#L53-L59 |
ruvents/ruwork-upload-bundle | Form/DataMapper/UploadMapper.php | UploadMapper.mapFormsToData | public function mapFormsToData($forms, &$data)
{
/** @var FormInterface[] $formsArray */
$formsArray = iterator_to_array($forms);
$fileForm = $formsArray[$this->fileName];
$pathForm = $formsArray[$this->pathName];
if (!$fileForm->isEmpty()) {
$form = $fileForm->getParent();
$data = ($this->factory)($form, $data);
$this->manager->register($data, $fileForm->getData());
if (null !== $this->saver) {
$this->savers->add($form, $this->saver);
}
} elseif (!$pathForm->isEmpty()) {
$data = ($this->finder)($pathForm->getData());
}
$this->dataMapper->mapFormsToData($forms, $data);
} | php | public function mapFormsToData($forms, &$data)
{
/** @var FormInterface[] $formsArray */
$formsArray = iterator_to_array($forms);
$fileForm = $formsArray[$this->fileName];
$pathForm = $formsArray[$this->pathName];
if (!$fileForm->isEmpty()) {
$form = $fileForm->getParent();
$data = ($this->factory)($form, $data);
$this->manager->register($data, $fileForm->getData());
if (null !== $this->saver) {
$this->savers->add($form, $this->saver);
}
} elseif (!$pathForm->isEmpty()) {
$data = ($this->finder)($pathForm->getData());
}
$this->dataMapper->mapFormsToData($forms, $data);
} | [
"public",
"function",
"mapFormsToData",
"(",
"$",
"forms",
",",
"&",
"$",
"data",
")",
"{",
"/** @var FormInterface[] $formsArray */",
"$",
"formsArray",
"=",
"iterator_to_array",
"(",
"$",
"forms",
")",
";",
"$",
"fileForm",
"=",
"$",
"formsArray",
"[",
"$",
"this",
"->",
"fileName",
"]",
";",
"$",
"pathForm",
"=",
"$",
"formsArray",
"[",
"$",
"this",
"->",
"pathName",
"]",
";",
"if",
"(",
"!",
"$",
"fileForm",
"->",
"isEmpty",
"(",
")",
")",
"{",
"$",
"form",
"=",
"$",
"fileForm",
"->",
"getParent",
"(",
")",
";",
"$",
"data",
"=",
"(",
"$",
"this",
"->",
"factory",
")",
"(",
"$",
"form",
",",
"$",
"data",
")",
";",
"$",
"this",
"->",
"manager",
"->",
"register",
"(",
"$",
"data",
",",
"$",
"fileForm",
"->",
"getData",
"(",
")",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"saver",
")",
"{",
"$",
"this",
"->",
"savers",
"->",
"add",
"(",
"$",
"form",
",",
"$",
"this",
"->",
"saver",
")",
";",
"}",
"}",
"elseif",
"(",
"!",
"$",
"pathForm",
"->",
"isEmpty",
"(",
")",
")",
"{",
"$",
"data",
"=",
"(",
"$",
"this",
"->",
"finder",
")",
"(",
"$",
"pathForm",
"->",
"getData",
"(",
")",
")",
";",
"}",
"$",
"this",
"->",
"dataMapper",
"->",
"mapFormsToData",
"(",
"$",
"forms",
",",
"$",
"data",
")",
";",
"}"
]
| {@inheritdoc} | [
"{"
]
| train | https://github.com/ruvents/ruwork-upload-bundle/blob/8ad09cc2dce6ab389105c440d791346696da43af/Form/DataMapper/UploadMapper.php#L55-L75 |
steeffeen/FancyManiaLinks | FML/Script/Features/Tooltip.php | Tooltip.setHoverControl | public function setHoverControl(Control $hoverControl)
{
$hoverControl->checkId();
if ($hoverControl instanceof Scriptable) {
$hoverControl->setScriptEvents(true);
}
$this->hoverControl = $hoverControl;
return $this;
} | php | public function setHoverControl(Control $hoverControl)
{
$hoverControl->checkId();
if ($hoverControl instanceof Scriptable) {
$hoverControl->setScriptEvents(true);
}
$this->hoverControl = $hoverControl;
return $this;
} | [
"public",
"function",
"setHoverControl",
"(",
"Control",
"$",
"hoverControl",
")",
"{",
"$",
"hoverControl",
"->",
"checkId",
"(",
")",
";",
"if",
"(",
"$",
"hoverControl",
"instanceof",
"Scriptable",
")",
"{",
"$",
"hoverControl",
"->",
"setScriptEvents",
"(",
"true",
")",
";",
"}",
"$",
"this",
"->",
"hoverControl",
"=",
"$",
"hoverControl",
";",
"return",
"$",
"this",
";",
"}"
]
| Set the Hover Control
@api
@param Control $hoverControl Hover Control
@return static | [
"Set",
"the",
"Hover",
"Control"
]
| train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/Tooltip.php#L94-L102 |
steeffeen/FancyManiaLinks | FML/Script/Features/Tooltip.php | Tooltip.setTooltipControl | public function setTooltipControl(Control $tooltipControl)
{
$tooltipControl->checkId();
$tooltipControl->setVisible(false);
$this->tooltipControl = $tooltipControl;
return $this;
} | php | public function setTooltipControl(Control $tooltipControl)
{
$tooltipControl->checkId();
$tooltipControl->setVisible(false);
$this->tooltipControl = $tooltipControl;
return $this;
} | [
"public",
"function",
"setTooltipControl",
"(",
"Control",
"$",
"tooltipControl",
")",
"{",
"$",
"tooltipControl",
"->",
"checkId",
"(",
")",
";",
"$",
"tooltipControl",
"->",
"setVisible",
"(",
"false",
")",
";",
"$",
"this",
"->",
"tooltipControl",
"=",
"$",
"tooltipControl",
";",
"return",
"$",
"this",
";",
"}"
]
| Set the Tooltip Control
@api
@param Control $tooltipControl Tooltip Control
@return static | [
"Set",
"the",
"Tooltip",
"Control"
]
| train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/Tooltip.php#L122-L128 |
aedart/laravel-helpers | src/Traits/Routing/URLTrait.php | URLTrait.getUrl | public function getUrl(): ?UrlGenerator
{
if (!$this->hasUrl()) {
$this->setUrl($this->getDefaultUrl());
}
return $this->url;
} | php | public function getUrl(): ?UrlGenerator
{
if (!$this->hasUrl()) {
$this->setUrl($this->getDefaultUrl());
}
return $this->url;
} | [
"public",
"function",
"getUrl",
"(",
")",
":",
"?",
"UrlGenerator",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasUrl",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setUrl",
"(",
"$",
"this",
"->",
"getDefaultUrl",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"url",
";",
"}"
]
| Get url
If no url has been set, this method will
set and return a default url, if any such
value is available
@see getDefaultUrl()
@return UrlGenerator|null url or null if none url has been set | [
"Get",
"url"
]
| train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Routing/URLTrait.php#L53-L59 |
cohesion/cohesion-core | src/Util/Email.php | Email.sendEmail | public function sendEmail($to, $view, $vars = null, $subject = null, $params = null) {
if (!($view instanceof EmailView)) {
$view = $this->generateView($view);
}
if (!$subject) {
$subject = $view->getSubject();
}
if (!$subject) {
throw new InvalidEmailException('No subject has been set');
}
if ($vars) {
$view->addVars($vars);
}
$from = $this->config->get('from');
$cc = null;
$bcc = $this->config->get('bcc');
$headers = $this->config->get('headers');
$viewHeaders = $view->getHeaders();
if ($viewHeaders) {
foreach ($viewHeaders as $header => $value) {
$headers[$header] = $value;
}
}
if ($params) {
if (isset($params['headers'])) {
foreach ($params['headers'] as $header => $value) {
$headers[$header] = $value;
}
}
if (isset($params['from'])) {
if (!isset($params['from']['name']) || !isset($params['from']['email'])) {
throw new InvalidEmailException("Invalid from setting. Must include a name and an email address");
}
$from = $params['from'];
}
if (isset($params['cc'])) {
$cc = $params['cc'];
}
if (isset($params['bcc'])) {
if ($bcc) {
$bcc = array_merge($bcc, $params['bcc']);
} else {
$bcc = $params['bcc'];
}
}
if (isset($params['template'])) {
$view->setTemplate($params['template']);
}
if (isset($params['content'])) {
$view->setContent('content');
}
}
$to = $this->validateEmailAddresses($to);
$headers['From'] = "{$from['name']} <{$from['email']}>";
if ($cc) {
$headers['Cc'] = $this->validateEmailAddresses($cc);
}
if ($bcc) {
$headers['Bcc'] = $this->validateEmailAddresses($bcc);
}
if (!$this->send($to, $subject, $view, $headers)) {
throw new SendEmailException("Unable to send email to $to");
}
} | php | public function sendEmail($to, $view, $vars = null, $subject = null, $params = null) {
if (!($view instanceof EmailView)) {
$view = $this->generateView($view);
}
if (!$subject) {
$subject = $view->getSubject();
}
if (!$subject) {
throw new InvalidEmailException('No subject has been set');
}
if ($vars) {
$view->addVars($vars);
}
$from = $this->config->get('from');
$cc = null;
$bcc = $this->config->get('bcc');
$headers = $this->config->get('headers');
$viewHeaders = $view->getHeaders();
if ($viewHeaders) {
foreach ($viewHeaders as $header => $value) {
$headers[$header] = $value;
}
}
if ($params) {
if (isset($params['headers'])) {
foreach ($params['headers'] as $header => $value) {
$headers[$header] = $value;
}
}
if (isset($params['from'])) {
if (!isset($params['from']['name']) || !isset($params['from']['email'])) {
throw new InvalidEmailException("Invalid from setting. Must include a name and an email address");
}
$from = $params['from'];
}
if (isset($params['cc'])) {
$cc = $params['cc'];
}
if (isset($params['bcc'])) {
if ($bcc) {
$bcc = array_merge($bcc, $params['bcc']);
} else {
$bcc = $params['bcc'];
}
}
if (isset($params['template'])) {
$view->setTemplate($params['template']);
}
if (isset($params['content'])) {
$view->setContent('content');
}
}
$to = $this->validateEmailAddresses($to);
$headers['From'] = "{$from['name']} <{$from['email']}>";
if ($cc) {
$headers['Cc'] = $this->validateEmailAddresses($cc);
}
if ($bcc) {
$headers['Bcc'] = $this->validateEmailAddresses($bcc);
}
if (!$this->send($to, $subject, $view, $headers)) {
throw new SendEmailException("Unable to send email to $to");
}
} | [
"public",
"function",
"sendEmail",
"(",
"$",
"to",
",",
"$",
"view",
",",
"$",
"vars",
"=",
"null",
",",
"$",
"subject",
"=",
"null",
",",
"$",
"params",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"view",
"instanceof",
"EmailView",
")",
")",
"{",
"$",
"view",
"=",
"$",
"this",
"->",
"generateView",
"(",
"$",
"view",
")",
";",
"}",
"if",
"(",
"!",
"$",
"subject",
")",
"{",
"$",
"subject",
"=",
"$",
"view",
"->",
"getSubject",
"(",
")",
";",
"}",
"if",
"(",
"!",
"$",
"subject",
")",
"{",
"throw",
"new",
"InvalidEmailException",
"(",
"'No subject has been set'",
")",
";",
"}",
"if",
"(",
"$",
"vars",
")",
"{",
"$",
"view",
"->",
"addVars",
"(",
"$",
"vars",
")",
";",
"}",
"$",
"from",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'from'",
")",
";",
"$",
"cc",
"=",
"null",
";",
"$",
"bcc",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'bcc'",
")",
";",
"$",
"headers",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'headers'",
")",
";",
"$",
"viewHeaders",
"=",
"$",
"view",
"->",
"getHeaders",
"(",
")",
";",
"if",
"(",
"$",
"viewHeaders",
")",
"{",
"foreach",
"(",
"$",
"viewHeaders",
"as",
"$",
"header",
"=>",
"$",
"value",
")",
"{",
"$",
"headers",
"[",
"$",
"header",
"]",
"=",
"$",
"value",
";",
"}",
"}",
"if",
"(",
"$",
"params",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'headers'",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"params",
"[",
"'headers'",
"]",
"as",
"$",
"header",
"=>",
"$",
"value",
")",
"{",
"$",
"headers",
"[",
"$",
"header",
"]",
"=",
"$",
"value",
";",
"}",
"}",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'from'",
"]",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"params",
"[",
"'from'",
"]",
"[",
"'name'",
"]",
")",
"||",
"!",
"isset",
"(",
"$",
"params",
"[",
"'from'",
"]",
"[",
"'email'",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidEmailException",
"(",
"\"Invalid from setting. Must include a name and an email address\"",
")",
";",
"}",
"$",
"from",
"=",
"$",
"params",
"[",
"'from'",
"]",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'cc'",
"]",
")",
")",
"{",
"$",
"cc",
"=",
"$",
"params",
"[",
"'cc'",
"]",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'bcc'",
"]",
")",
")",
"{",
"if",
"(",
"$",
"bcc",
")",
"{",
"$",
"bcc",
"=",
"array_merge",
"(",
"$",
"bcc",
",",
"$",
"params",
"[",
"'bcc'",
"]",
")",
";",
"}",
"else",
"{",
"$",
"bcc",
"=",
"$",
"params",
"[",
"'bcc'",
"]",
";",
"}",
"}",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'template'",
"]",
")",
")",
"{",
"$",
"view",
"->",
"setTemplate",
"(",
"$",
"params",
"[",
"'template'",
"]",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'content'",
"]",
")",
")",
"{",
"$",
"view",
"->",
"setContent",
"(",
"'content'",
")",
";",
"}",
"}",
"$",
"to",
"=",
"$",
"this",
"->",
"validateEmailAddresses",
"(",
"$",
"to",
")",
";",
"$",
"headers",
"[",
"'From'",
"]",
"=",
"\"{$from['name']} <{$from['email']}>\"",
";",
"if",
"(",
"$",
"cc",
")",
"{",
"$",
"headers",
"[",
"'Cc'",
"]",
"=",
"$",
"this",
"->",
"validateEmailAddresses",
"(",
"$",
"cc",
")",
";",
"}",
"if",
"(",
"$",
"bcc",
")",
"{",
"$",
"headers",
"[",
"'Bcc'",
"]",
"=",
"$",
"this",
"->",
"validateEmailAddresses",
"(",
"$",
"bcc",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"send",
"(",
"$",
"to",
",",
"$",
"subject",
",",
"$",
"view",
",",
"$",
"headers",
")",
")",
"{",
"throw",
"new",
"SendEmailException",
"(",
"\"Unable to send email to $to\"",
")",
";",
"}",
"}"
]
| Send an email.
Uses named parameters
@param $to mixed Either an email address or an array of addresses
@param $view string Optional view name
@param $vars array Optional array of additional vars to be rendered
@param $subject string The email subject
@param $params array additional parameters
cc mixed Same as the to field but is optional
bcc mixed Same as the cc field
template string Optional base layout template
content string Inner template
from array Optional overwrite for the email from name and address
headers array Optional additional headers to send with the email
@throws InvalidEmailException When the given parameters aren't valid
@throws SendEmailException When the email is unable to be sent | [
"Send",
"an",
"email",
"."
]
| train | https://github.com/cohesion/cohesion-core/blob/c6352aef7336e06285f0943da68235dc45523998/src/Util/Email.php#L52-L119 |
voda/php-translator | Antee/i18n/NetteTranslator.php | NetteTranslator.addTranslationContext | public static function addTranslationContext($value, $context) {
if (is_array($value) || $value instanceof Traversable) {
$array = array();
foreach ($value as $key => $string) {
$array[$key] = self::addTranslationContext($string, $context);
}
return $array;
}
return (string)$context . chr(4) . (string)$value;
} | php | public static function addTranslationContext($value, $context) {
if (is_array($value) || $value instanceof Traversable) {
$array = array();
foreach ($value as $key => $string) {
$array[$key] = self::addTranslationContext($string, $context);
}
return $array;
}
return (string)$context . chr(4) . (string)$value;
} | [
"public",
"static",
"function",
"addTranslationContext",
"(",
"$",
"value",
",",
"$",
"context",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
"||",
"$",
"value",
"instanceof",
"Traversable",
")",
"{",
"$",
"array",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"value",
"as",
"$",
"key",
"=>",
"$",
"string",
")",
"{",
"$",
"array",
"[",
"$",
"key",
"]",
"=",
"self",
"::",
"addTranslationContext",
"(",
"$",
"string",
",",
"$",
"context",
")",
";",
"}",
"return",
"$",
"array",
";",
"}",
"return",
"(",
"string",
")",
"$",
"context",
".",
"chr",
"(",
"4",
")",
".",
"(",
"string",
")",
"$",
"value",
";",
"}"
]
| Add context to given string(s).
@param string|array|Traversable $value
@param string $context
@return string|array
@throws InvalidArgumentException | [
"Add",
"context",
"to",
"given",
"string",
"(",
"s",
")",
"."
]
| train | https://github.com/voda/php-translator/blob/b1890ce89f7185b8958e6cf89cf2ad231d5e5f58/Antee/i18n/NetteTranslator.php#L57-L66 |
voda/php-translator | Antee/i18n/NetteTranslator.php | NetteTranslator.translate | public function translate($message, $count = null) {
$isContext = false;
$context = "";
$plural = "";
$isPlural = is_array($message);
if ($isPlural) {
list($message, $plural) = $message;
}
if (strpos($message, chr(4)) !== false) {
$isContext = true;
list ($context, $message) = explode(chr(4), $message, 2);
}
$translation = null;
switch (true) {
case $isContext && $isPlural:
$translation = $this->translator->npgettext($context, $message, $plural, $count);
break;
case $isContext:
$translation = $this->translator->pgettext($context, $message);
break;
case $isPlural:
$translation = $this->translator->ngettext($message, $plural, $count);
break;
default:
$translation = $this->translator->gettext($message);
break;
}
return $translation;
} | php | public function translate($message, $count = null) {
$isContext = false;
$context = "";
$plural = "";
$isPlural = is_array($message);
if ($isPlural) {
list($message, $plural) = $message;
}
if (strpos($message, chr(4)) !== false) {
$isContext = true;
list ($context, $message) = explode(chr(4), $message, 2);
}
$translation = null;
switch (true) {
case $isContext && $isPlural:
$translation = $this->translator->npgettext($context, $message, $plural, $count);
break;
case $isContext:
$translation = $this->translator->pgettext($context, $message);
break;
case $isPlural:
$translation = $this->translator->ngettext($message, $plural, $count);
break;
default:
$translation = $this->translator->gettext($message);
break;
}
return $translation;
} | [
"public",
"function",
"translate",
"(",
"$",
"message",
",",
"$",
"count",
"=",
"null",
")",
"{",
"$",
"isContext",
"=",
"false",
";",
"$",
"context",
"=",
"\"\"",
";",
"$",
"plural",
"=",
"\"\"",
";",
"$",
"isPlural",
"=",
"is_array",
"(",
"$",
"message",
")",
";",
"if",
"(",
"$",
"isPlural",
")",
"{",
"list",
"(",
"$",
"message",
",",
"$",
"plural",
")",
"=",
"$",
"message",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"message",
",",
"chr",
"(",
"4",
")",
")",
"!==",
"false",
")",
"{",
"$",
"isContext",
"=",
"true",
";",
"list",
"(",
"$",
"context",
",",
"$",
"message",
")",
"=",
"explode",
"(",
"chr",
"(",
"4",
")",
",",
"$",
"message",
",",
"2",
")",
";",
"}",
"$",
"translation",
"=",
"null",
";",
"switch",
"(",
"true",
")",
"{",
"case",
"$",
"isContext",
"&&",
"$",
"isPlural",
":",
"$",
"translation",
"=",
"$",
"this",
"->",
"translator",
"->",
"npgettext",
"(",
"$",
"context",
",",
"$",
"message",
",",
"$",
"plural",
",",
"$",
"count",
")",
";",
"break",
";",
"case",
"$",
"isContext",
":",
"$",
"translation",
"=",
"$",
"this",
"->",
"translator",
"->",
"pgettext",
"(",
"$",
"context",
",",
"$",
"message",
")",
";",
"break",
";",
"case",
"$",
"isPlural",
":",
"$",
"translation",
"=",
"$",
"this",
"->",
"translator",
"->",
"ngettext",
"(",
"$",
"message",
",",
"$",
"plural",
",",
"$",
"count",
")",
";",
"break",
";",
"default",
":",
"$",
"translation",
"=",
"$",
"this",
"->",
"translator",
"->",
"gettext",
"(",
"$",
"message",
")",
";",
"break",
";",
"}",
"return",
"$",
"translation",
";",
"}"
]
| * \Nette\ITranslator ************************************************** | [
"*",
"\\",
"Nette",
"\\",
"ITranslator",
"**************************************************"
]
| train | https://github.com/voda/php-translator/blob/b1890ce89f7185b8958e6cf89cf2ad231d5e5f58/Antee/i18n/NetteTranslator.php#L70-L99 |
steeffeen/FancyManiaLinks | FML/ManiaCode/JoinServer.php | JoinServer.setLogin | public function setLogin($login)
{
$this->login = (string)$login;
$this->ip = null;
$this->port = null;
return $this;
} | php | public function setLogin($login)
{
$this->login = (string)$login;
$this->ip = null;
$this->port = null;
return $this;
} | [
"public",
"function",
"setLogin",
"(",
"$",
"login",
")",
"{",
"$",
"this",
"->",
"login",
"=",
"(",
"string",
")",
"$",
"login",
";",
"$",
"this",
"->",
"ip",
"=",
"null",
";",
"$",
"this",
"->",
"port",
"=",
"null",
";",
"return",
"$",
"this",
";",
"}"
]
| Set the server login
@api
@param string $login Server login
@return static | [
"Set",
"the",
"server",
"login"
]
| train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/ManiaCode/JoinServer.php#L77-L83 |
steeffeen/FancyManiaLinks | FML/ManiaCode/JoinServer.php | JoinServer.setIp | public function setIp($ip, $port = null)
{
$this->login = null;
$this->ip = (string)$ip;
if ($port) {
$this->setPort($port);
}
return $this;
} | php | public function setIp($ip, $port = null)
{
$this->login = null;
$this->ip = (string)$ip;
if ($port) {
$this->setPort($port);
}
return $this;
} | [
"public",
"function",
"setIp",
"(",
"$",
"ip",
",",
"$",
"port",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"login",
"=",
"null",
";",
"$",
"this",
"->",
"ip",
"=",
"(",
"string",
")",
"$",
"ip",
";",
"if",
"(",
"$",
"port",
")",
"{",
"$",
"this",
"->",
"setPort",
"(",
"$",
"port",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
]
| Set the server ip and port
@api
@param string $ip Server ip
@param int $port (optional) Server port
@return static | [
"Set",
"the",
"server",
"ip",
"and",
"port"
]
| train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/ManiaCode/JoinServer.php#L104-L112 |
hametuha/gapiwp | src/Hametuha/GapiWP/Service/Prototype.php | Prototype.show_message | protected function show_message($msg, $error = false){
add_action("admin_notices", function() use($msg, $error){
printf('<div class="%s"><p>%s</p></div>', $error ? 'error' : 'updated', esc_html($msg) );
});
} | php | protected function show_message($msg, $error = false){
add_action("admin_notices", function() use($msg, $error){
printf('<div class="%s"><p>%s</p></div>', $error ? 'error' : 'updated', esc_html($msg) );
});
} | [
"protected",
"function",
"show_message",
"(",
"$",
"msg",
",",
"$",
"error",
"=",
"false",
")",
"{",
"add_action",
"(",
"\"admin_notices\"",
",",
"function",
"(",
")",
"use",
"(",
"$",
"msg",
",",
"$",
"error",
")",
"{",
"printf",
"(",
"'<div class=\"%s\"><p>%s</p></div>'",
",",
"$",
"error",
"?",
"'error'",
":",
"'updated'",
",",
"esc_html",
"(",
"$",
"msg",
")",
")",
";",
"}",
")",
";",
"}"
]
| Show message on admin screen
@param string $msg
@param bool $error | [
"Show",
"message",
"on",
"admin",
"screen"
]
| train | https://github.com/hametuha/gapiwp/blob/7b9716d0ebd54c4ab79cca94a4c5aef099a54266/src/Hametuha/GapiWP/Service/Prototype.php#L31-L35 |
boekkooi/tactician-amqp | src/Publisher/ExchangePublisher.php | ExchangePublisher.publish | public function publish(Message $message)
{
$exchange = $this->getExchange($message);
if (!$exchange instanceof \AMQPExchange) {
throw MissingExchangeException::forMessage($message);
}
try {
return $this->publishToExchange($message, $exchange);
} catch (\AMQPException $e) {
throw FailedToPublishException::fromException($message, $e);
}
} | php | public function publish(Message $message)
{
$exchange = $this->getExchange($message);
if (!$exchange instanceof \AMQPExchange) {
throw MissingExchangeException::forMessage($message);
}
try {
return $this->publishToExchange($message, $exchange);
} catch (\AMQPException $e) {
throw FailedToPublishException::fromException($message, $e);
}
} | [
"public",
"function",
"publish",
"(",
"Message",
"$",
"message",
")",
"{",
"$",
"exchange",
"=",
"$",
"this",
"->",
"getExchange",
"(",
"$",
"message",
")",
";",
"if",
"(",
"!",
"$",
"exchange",
"instanceof",
"\\",
"AMQPExchange",
")",
"{",
"throw",
"MissingExchangeException",
"::",
"forMessage",
"(",
"$",
"message",
")",
";",
"}",
"try",
"{",
"return",
"$",
"this",
"->",
"publishToExchange",
"(",
"$",
"message",
",",
"$",
"exchange",
")",
";",
"}",
"catch",
"(",
"\\",
"AMQPException",
"$",
"e",
")",
"{",
"throw",
"FailedToPublishException",
"::",
"fromException",
"(",
"$",
"message",
",",
"$",
"e",
")",
";",
"}",
"}"
]
| {@inheritdoc} | [
"{"
]
| train | https://github.com/boekkooi/tactician-amqp/blob/55cbb8b9e20aab7891e6a6090b248377c599360e/src/Publisher/ExchangePublisher.php#L16-L28 |
boekkooi/tactician-amqp | src/Publisher/ExchangePublisher.php | ExchangePublisher.publishToExchange | protected function publishToExchange(Message $message, \AMQPExchange $exchange)
{
$isPublished = $exchange->publish(
$message->getMessage(),
$message->getRoutingKey(),
$message->getFlags(),
$message->getAttributes()
);
if (!$isPublished) {
throw FailedToPublishException::fromMessage($message);
}
return $isPublished;
} | php | protected function publishToExchange(Message $message, \AMQPExchange $exchange)
{
$isPublished = $exchange->publish(
$message->getMessage(),
$message->getRoutingKey(),
$message->getFlags(),
$message->getAttributes()
);
if (!$isPublished) {
throw FailedToPublishException::fromMessage($message);
}
return $isPublished;
} | [
"protected",
"function",
"publishToExchange",
"(",
"Message",
"$",
"message",
",",
"\\",
"AMQPExchange",
"$",
"exchange",
")",
"{",
"$",
"isPublished",
"=",
"$",
"exchange",
"->",
"publish",
"(",
"$",
"message",
"->",
"getMessage",
"(",
")",
",",
"$",
"message",
"->",
"getRoutingKey",
"(",
")",
",",
"$",
"message",
"->",
"getFlags",
"(",
")",
",",
"$",
"message",
"->",
"getAttributes",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"isPublished",
")",
"{",
"throw",
"FailedToPublishException",
"::",
"fromMessage",
"(",
"$",
"message",
")",
";",
"}",
"return",
"$",
"isPublished",
";",
"}"
]
| Publish the message to AMQP exchange
@param Message $message
@param \AMQPExchange $exchange
@return bool
@throws \AMQPException | [
"Publish",
"the",
"message",
"to",
"AMQP",
"exchange"
]
| train | https://github.com/boekkooi/tactician-amqp/blob/55cbb8b9e20aab7891e6a6090b248377c599360e/src/Publisher/ExchangePublisher.php#L38-L52 |
boekkooi/tactician-amqp | src/Middleware/ConsumeMiddleware.php | ConsumeMiddleware.execute | public function execute($command, callable $next)
{
if (!$command instanceof Command) {
return $next($command);
}
$queue = $command->getQueue();
$deliveryTag = $command->getEnvelope()->getDeliveryTag();
try {
$res = $next($command);
$queue->ack($deliveryTag);
return $res;
} catch (\Exception $e) {
$queue->reject(
$deliveryTag,
($this->requeue ? AMQP_REQUEUE : AMQP_NOPARAM)
);
throw $e;
} catch (\Error $e) {
$queue->reject(
$deliveryTag,
($this->requeue ? AMQP_REQUEUE : AMQP_NOPARAM)
);
throw $e;
}
} | php | public function execute($command, callable $next)
{
if (!$command instanceof Command) {
return $next($command);
}
$queue = $command->getQueue();
$deliveryTag = $command->getEnvelope()->getDeliveryTag();
try {
$res = $next($command);
$queue->ack($deliveryTag);
return $res;
} catch (\Exception $e) {
$queue->reject(
$deliveryTag,
($this->requeue ? AMQP_REQUEUE : AMQP_NOPARAM)
);
throw $e;
} catch (\Error $e) {
$queue->reject(
$deliveryTag,
($this->requeue ? AMQP_REQUEUE : AMQP_NOPARAM)
);
throw $e;
}
} | [
"public",
"function",
"execute",
"(",
"$",
"command",
",",
"callable",
"$",
"next",
")",
"{",
"if",
"(",
"!",
"$",
"command",
"instanceof",
"Command",
")",
"{",
"return",
"$",
"next",
"(",
"$",
"command",
")",
";",
"}",
"$",
"queue",
"=",
"$",
"command",
"->",
"getQueue",
"(",
")",
";",
"$",
"deliveryTag",
"=",
"$",
"command",
"->",
"getEnvelope",
"(",
")",
"->",
"getDeliveryTag",
"(",
")",
";",
"try",
"{",
"$",
"res",
"=",
"$",
"next",
"(",
"$",
"command",
")",
";",
"$",
"queue",
"->",
"ack",
"(",
"$",
"deliveryTag",
")",
";",
"return",
"$",
"res",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"$",
"queue",
"->",
"reject",
"(",
"$",
"deliveryTag",
",",
"(",
"$",
"this",
"->",
"requeue",
"?",
"AMQP_REQUEUE",
":",
"AMQP_NOPARAM",
")",
")",
";",
"throw",
"$",
"e",
";",
"}",
"catch",
"(",
"\\",
"Error",
"$",
"e",
")",
"{",
"$",
"queue",
"->",
"reject",
"(",
"$",
"deliveryTag",
",",
"(",
"$",
"this",
"->",
"requeue",
"?",
"AMQP_REQUEUE",
":",
"AMQP_NOPARAM",
")",
")",
";",
"throw",
"$",
"e",
";",
"}",
"}"
]
| {@inheritdoc} | [
"{"
]
| train | https://github.com/boekkooi/tactician-amqp/blob/55cbb8b9e20aab7891e6a6090b248377c599360e/src/Middleware/ConsumeMiddleware.php#L25-L54 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomer.php | BaseCustomer.getCreated | public function getCreated($format = null)
{
if ($this->created === null) {
return null;
}
if ($this->created === '0000-00-00 00:00:00') {
// while technically this is not a default value of null,
// this seems to be closest in meaning.
return null;
}
try {
$dt = new DateTime($this->created);
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is true, we return a DateTime object.
return $dt;
}
if (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
}
return $dt->format($format);
} | php | public function getCreated($format = null)
{
if ($this->created === null) {
return null;
}
if ($this->created === '0000-00-00 00:00:00') {
// while technically this is not a default value of null,
// this seems to be closest in meaning.
return null;
}
try {
$dt = new DateTime($this->created);
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is true, we return a DateTime object.
return $dt;
}
if (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
}
return $dt->format($format);
} | [
"public",
"function",
"getCreated",
"(",
"$",
"format",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"created",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"created",
"===",
"'0000-00-00 00:00:00'",
")",
"{",
"// while technically this is not a default value of null,",
"// this seems to be closest in meaning.",
"return",
"null",
";",
"}",
"try",
"{",
"$",
"dt",
"=",
"new",
"DateTime",
"(",
"$",
"this",
"->",
"created",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"x",
")",
"{",
"throw",
"new",
"PropelException",
"(",
"\"Internally stored date/time/timestamp value could not be converted to DateTime: \"",
".",
"var_export",
"(",
"$",
"this",
"->",
"created",
",",
"true",
")",
",",
"$",
"x",
")",
";",
"}",
"if",
"(",
"$",
"format",
"===",
"null",
")",
"{",
"// Because propel.useDateTimeClass is true, we return a DateTime object.",
"return",
"$",
"dt",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"format",
",",
"'%'",
")",
"!==",
"false",
")",
"{",
"return",
"strftime",
"(",
"$",
"format",
",",
"$",
"dt",
"->",
"format",
"(",
"'U'",
")",
")",
";",
"}",
"return",
"$",
"dt",
"->",
"format",
"(",
"$",
"format",
")",
";",
"}"
]
| Get the [optionally formatted] temporal [created] column value.
@param string $format The date/time format string (either date()-style or strftime()-style).
If format is null, then the raw DateTime object will be returned.
@return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00
@throws PropelException - if unable to parse/validate the date/time value. | [
"Get",
"the",
"[",
"optionally",
"formatted",
"]",
"temporal",
"[",
"created",
"]",
"column",
"value",
"."
]
| train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L306-L335 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomer.php | BaseCustomer.setStreet | public function setStreet($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->street !== $v) {
$this->street = $v;
$this->modifiedColumns[] = CustomerPeer::STREET;
}
return $this;
} | php | public function setStreet($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->street !== $v) {
$this->street = $v;
$this->modifiedColumns[] = CustomerPeer::STREET;
}
return $this;
} | [
"public",
"function",
"setStreet",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"street",
"!==",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"street",
"=",
"$",
"v",
";",
"$",
"this",
"->",
"modifiedColumns",
"[",
"]",
"=",
"CustomerPeer",
"::",
"STREET",
";",
"}",
"return",
"$",
"this",
";",
"}"
]
| Set the value of [street] column.
@param string $v new value
@return Customer The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"street",
"]",
"column",
"."
]
| train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L396-L409 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomer.php | BaseCustomer.setZip | public function setZip($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->zip !== $v) {
$this->zip = $v;
$this->modifiedColumns[] = CustomerPeer::ZIP;
}
return $this;
} | php | public function setZip($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->zip !== $v) {
$this->zip = $v;
$this->modifiedColumns[] = CustomerPeer::ZIP;
}
return $this;
} | [
"public",
"function",
"setZip",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"zip",
"!==",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"zip",
"=",
"$",
"v",
";",
"$",
"this",
"->",
"modifiedColumns",
"[",
"]",
"=",
"CustomerPeer",
"::",
"ZIP",
";",
"}",
"return",
"$",
"this",
";",
"}"
]
| Set the value of [zip] column.
@param string $v new value
@return Customer The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"zip",
"]",
"column",
"."
]
| train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L417-L430 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomer.php | BaseCustomer.setCity | public function setCity($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->city !== $v) {
$this->city = $v;
$this->modifiedColumns[] = CustomerPeer::CITY;
}
return $this;
} | php | public function setCity($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->city !== $v) {
$this->city = $v;
$this->modifiedColumns[] = CustomerPeer::CITY;
}
return $this;
} | [
"public",
"function",
"setCity",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"city",
"!==",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"city",
"=",
"$",
"v",
";",
"$",
"this",
"->",
"modifiedColumns",
"[",
"]",
"=",
"CustomerPeer",
"::",
"CITY",
";",
"}",
"return",
"$",
"this",
";",
"}"
]
| Set the value of [city] column.
@param string $v new value
@return Customer The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"city",
"]",
"column",
"."
]
| train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L438-L451 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomer.php | BaseCustomer.setCountryId | public function setCountryId($v)
{
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
if ($this->country_id !== $v) {
$this->country_id = $v;
$this->modifiedColumns[] = CustomerPeer::COUNTRY_ID;
}
if ($this->aCountry !== null && $this->aCountry->getId() !== $v) {
$this->aCountry = null;
}
return $this;
} | php | public function setCountryId($v)
{
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
if ($this->country_id !== $v) {
$this->country_id = $v;
$this->modifiedColumns[] = CustomerPeer::COUNTRY_ID;
}
if ($this->aCountry !== null && $this->aCountry->getId() !== $v) {
$this->aCountry = null;
}
return $this;
} | [
"public",
"function",
"setCountryId",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
"&&",
"is_numeric",
"(",
"$",
"v",
")",
")",
"{",
"$",
"v",
"=",
"(",
"int",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"country_id",
"!==",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"country_id",
"=",
"$",
"v",
";",
"$",
"this",
"->",
"modifiedColumns",
"[",
"]",
"=",
"CustomerPeer",
"::",
"COUNTRY_ID",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"aCountry",
"!==",
"null",
"&&",
"$",
"this",
"->",
"aCountry",
"->",
"getId",
"(",
")",
"!==",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"aCountry",
"=",
"null",
";",
"}",
"return",
"$",
"this",
";",
"}"
]
| Set the value of [country_id] column.
@param int $v new value
@return Customer The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"country_id",
"]",
"column",
"."
]
| train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L459-L476 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomer.php | BaseCustomer.setFax | public function setFax($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->fax !== $v) {
$this->fax = $v;
$this->modifiedColumns[] = CustomerPeer::FAX;
}
return $this;
} | php | public function setFax($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->fax !== $v) {
$this->fax = $v;
$this->modifiedColumns[] = CustomerPeer::FAX;
}
return $this;
} | [
"public",
"function",
"setFax",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"fax",
"!==",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"fax",
"=",
"$",
"v",
";",
"$",
"this",
"->",
"modifiedColumns",
"[",
"]",
"=",
"CustomerPeer",
"::",
"FAX",
";",
"}",
"return",
"$",
"this",
";",
"}"
]
| Set the value of [fax] column.
@param string $v new value
@return Customer The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"fax",
"]",
"column",
"."
]
| train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L505-L518 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomer.php | BaseCustomer.setLegalform | public function setLegalform($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->legalform !== $v) {
$this->legalform = $v;
$this->modifiedColumns[] = CustomerPeer::LEGALFORM;
}
return $this;
} | php | public function setLegalform($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->legalform !== $v) {
$this->legalform = $v;
$this->modifiedColumns[] = CustomerPeer::LEGALFORM;
}
return $this;
} | [
"public",
"function",
"setLegalform",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"legalform",
"!==",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"legalform",
"=",
"$",
"v",
";",
"$",
"this",
"->",
"modifiedColumns",
"[",
"]",
"=",
"CustomerPeer",
"::",
"LEGALFORM",
";",
"}",
"return",
"$",
"this",
";",
"}"
]
| Set the value of [legalform] column.
@param string $v new value
@return Customer The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"legalform",
"]",
"column",
"."
]
| train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L547-L560 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomer.php | BaseCustomer.setLogo | public function setLogo($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->logo !== $v) {
$this->logo = $v;
$this->modifiedColumns[] = CustomerPeer::LOGO;
}
return $this;
} | php | public function setLogo($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->logo !== $v) {
$this->logo = $v;
$this->modifiedColumns[] = CustomerPeer::LOGO;
}
return $this;
} | [
"public",
"function",
"setLogo",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"logo",
"!==",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"logo",
"=",
"$",
"v",
";",
"$",
"this",
"->",
"modifiedColumns",
"[",
"]",
"=",
"CustomerPeer",
"::",
"LOGO",
";",
"}",
"return",
"$",
"this",
";",
"}"
]
| Set the value of [logo] column.
@param string $v new value
@return Customer The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"logo",
"]",
"column",
"."
]
| train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L568-L581 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomer.php | BaseCustomer.setCreated | public function setCreated($v)
{
$dt = PropelDateTime::newInstance($v, null, 'DateTime');
if ($this->created !== null || $dt !== null) {
$currentDateAsString = ($this->created !== null && $tmpDt = new DateTime($this->created)) ? $tmpDt->format('Y-m-d H:i:s') : null;
$newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
if ($currentDateAsString !== $newDateAsString) {
$this->created = $newDateAsString;
$this->modifiedColumns[] = CustomerPeer::CREATED;
}
} // if either are not null
return $this;
} | php | public function setCreated($v)
{
$dt = PropelDateTime::newInstance($v, null, 'DateTime');
if ($this->created !== null || $dt !== null) {
$currentDateAsString = ($this->created !== null && $tmpDt = new DateTime($this->created)) ? $tmpDt->format('Y-m-d H:i:s') : null;
$newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
if ($currentDateAsString !== $newDateAsString) {
$this->created = $newDateAsString;
$this->modifiedColumns[] = CustomerPeer::CREATED;
}
} // if either are not null
return $this;
} | [
"public",
"function",
"setCreated",
"(",
"$",
"v",
")",
"{",
"$",
"dt",
"=",
"PropelDateTime",
"::",
"newInstance",
"(",
"$",
"v",
",",
"null",
",",
"'DateTime'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"created",
"!==",
"null",
"||",
"$",
"dt",
"!==",
"null",
")",
"{",
"$",
"currentDateAsString",
"=",
"(",
"$",
"this",
"->",
"created",
"!==",
"null",
"&&",
"$",
"tmpDt",
"=",
"new",
"DateTime",
"(",
"$",
"this",
"->",
"created",
")",
")",
"?",
"$",
"tmpDt",
"->",
"format",
"(",
"'Y-m-d H:i:s'",
")",
":",
"null",
";",
"$",
"newDateAsString",
"=",
"$",
"dt",
"?",
"$",
"dt",
"->",
"format",
"(",
"'Y-m-d H:i:s'",
")",
":",
"null",
";",
"if",
"(",
"$",
"currentDateAsString",
"!==",
"$",
"newDateAsString",
")",
"{",
"$",
"this",
"->",
"created",
"=",
"$",
"newDateAsString",
";",
"$",
"this",
"->",
"modifiedColumns",
"[",
"]",
"=",
"CustomerPeer",
"::",
"CREATED",
";",
"}",
"}",
"// if either are not null",
"return",
"$",
"this",
";",
"}"
]
| Sets the value of [created] column to a normalized version of the date/time value specified.
@param mixed $v string, integer (timestamp), or DateTime value.
Empty strings are treated as null.
@return Customer The current object (for fluent API support) | [
"Sets",
"the",
"value",
"of",
"[",
"created",
"]",
"column",
"to",
"a",
"normalized",
"version",
"of",
"the",
"date",
"/",
"time",
"value",
"specified",
"."
]
| train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L590-L604 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomer.php | BaseCustomer.hydrate | public function hydrate($row, $startcol = 0, $rehydrate = false)
{
try {
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
$this->street = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->zip = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
$this->city = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
$this->country_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
$this->phone = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
$this->fax = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
$this->email = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
$this->legalform = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
$this->logo = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
$this->created = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
$this->notes = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
$this->resetModified();
$this->setNew(false);
if ($rehydrate) {
$this->ensureConsistency();
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 13; // 13 = CustomerPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating Customer object", $e);
}
} | php | public function hydrate($row, $startcol = 0, $rehydrate = false)
{
try {
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
$this->street = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->zip = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
$this->city = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
$this->country_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
$this->phone = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
$this->fax = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
$this->email = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
$this->legalform = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
$this->logo = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
$this->created = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
$this->notes = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
$this->resetModified();
$this->setNew(false);
if ($rehydrate) {
$this->ensureConsistency();
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 13; // 13 = CustomerPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating Customer object", $e);
}
} | [
"public",
"function",
"hydrate",
"(",
"$",
"row",
",",
"$",
"startcol",
"=",
"0",
",",
"$",
"rehydrate",
"=",
"false",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"id",
"=",
"(",
"$",
"row",
"[",
"$",
"startcol",
"+",
"0",
"]",
"!==",
"null",
")",
"?",
"(",
"int",
")",
"$",
"row",
"[",
"$",
"startcol",
"+",
"0",
"]",
":",
"null",
";",
"$",
"this",
"->",
"name",
"=",
"(",
"$",
"row",
"[",
"$",
"startcol",
"+",
"1",
"]",
"!==",
"null",
")",
"?",
"(",
"string",
")",
"$",
"row",
"[",
"$",
"startcol",
"+",
"1",
"]",
":",
"null",
";",
"$",
"this",
"->",
"street",
"=",
"(",
"$",
"row",
"[",
"$",
"startcol",
"+",
"2",
"]",
"!==",
"null",
")",
"?",
"(",
"string",
")",
"$",
"row",
"[",
"$",
"startcol",
"+",
"2",
"]",
":",
"null",
";",
"$",
"this",
"->",
"zip",
"=",
"(",
"$",
"row",
"[",
"$",
"startcol",
"+",
"3",
"]",
"!==",
"null",
")",
"?",
"(",
"string",
")",
"$",
"row",
"[",
"$",
"startcol",
"+",
"3",
"]",
":",
"null",
";",
"$",
"this",
"->",
"city",
"=",
"(",
"$",
"row",
"[",
"$",
"startcol",
"+",
"4",
"]",
"!==",
"null",
")",
"?",
"(",
"string",
")",
"$",
"row",
"[",
"$",
"startcol",
"+",
"4",
"]",
":",
"null",
";",
"$",
"this",
"->",
"country_id",
"=",
"(",
"$",
"row",
"[",
"$",
"startcol",
"+",
"5",
"]",
"!==",
"null",
")",
"?",
"(",
"int",
")",
"$",
"row",
"[",
"$",
"startcol",
"+",
"5",
"]",
":",
"null",
";",
"$",
"this",
"->",
"phone",
"=",
"(",
"$",
"row",
"[",
"$",
"startcol",
"+",
"6",
"]",
"!==",
"null",
")",
"?",
"(",
"string",
")",
"$",
"row",
"[",
"$",
"startcol",
"+",
"6",
"]",
":",
"null",
";",
"$",
"this",
"->",
"fax",
"=",
"(",
"$",
"row",
"[",
"$",
"startcol",
"+",
"7",
"]",
"!==",
"null",
")",
"?",
"(",
"string",
")",
"$",
"row",
"[",
"$",
"startcol",
"+",
"7",
"]",
":",
"null",
";",
"$",
"this",
"->",
"email",
"=",
"(",
"$",
"row",
"[",
"$",
"startcol",
"+",
"8",
"]",
"!==",
"null",
")",
"?",
"(",
"string",
")",
"$",
"row",
"[",
"$",
"startcol",
"+",
"8",
"]",
":",
"null",
";",
"$",
"this",
"->",
"legalform",
"=",
"(",
"$",
"row",
"[",
"$",
"startcol",
"+",
"9",
"]",
"!==",
"null",
")",
"?",
"(",
"string",
")",
"$",
"row",
"[",
"$",
"startcol",
"+",
"9",
"]",
":",
"null",
";",
"$",
"this",
"->",
"logo",
"=",
"(",
"$",
"row",
"[",
"$",
"startcol",
"+",
"10",
"]",
"!==",
"null",
")",
"?",
"(",
"string",
")",
"$",
"row",
"[",
"$",
"startcol",
"+",
"10",
"]",
":",
"null",
";",
"$",
"this",
"->",
"created",
"=",
"(",
"$",
"row",
"[",
"$",
"startcol",
"+",
"11",
"]",
"!==",
"null",
")",
"?",
"(",
"string",
")",
"$",
"row",
"[",
"$",
"startcol",
"+",
"11",
"]",
":",
"null",
";",
"$",
"this",
"->",
"notes",
"=",
"(",
"$",
"row",
"[",
"$",
"startcol",
"+",
"12",
"]",
"!==",
"null",
")",
"?",
"(",
"string",
")",
"$",
"row",
"[",
"$",
"startcol",
"+",
"12",
"]",
":",
"null",
";",
"$",
"this",
"->",
"resetModified",
"(",
")",
";",
"$",
"this",
"->",
"setNew",
"(",
"false",
")",
";",
"if",
"(",
"$",
"rehydrate",
")",
"{",
"$",
"this",
"->",
"ensureConsistency",
"(",
")",
";",
"}",
"$",
"this",
"->",
"postHydrate",
"(",
"$",
"row",
",",
"$",
"startcol",
",",
"$",
"rehydrate",
")",
";",
"return",
"$",
"startcol",
"+",
"13",
";",
"// 13 = CustomerPeer::NUM_HYDRATE_COLUMNS.",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"throw",
"new",
"PropelException",
"(",
"\"Error populating Customer object\"",
",",
"$",
"e",
")",
";",
"}",
"}"
]
| Hydrates (populates) the object variables with values from the database resultset.
An offset (0-based "start column") is specified so that objects can be hydrated
with a subset of the columns in the resultset rows. This is needed, for example,
for results of JOIN queries where the resultset row includes columns from two or
more tables.
@param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
@param int $startcol 0-based offset column which indicates which resultset column to start with.
@param boolean $rehydrate Whether this object is being re-hydrated from the database.
@return int next starting column
@throws PropelException - Any caught Exception will be rewrapped as a PropelException. | [
"Hydrates",
"(",
"populates",
")",
"the",
"object",
"variables",
"with",
"values",
"from",
"the",
"database",
"resultset",
"."
]
| train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L655-L686 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomer.php | BaseCustomer.doSave | protected function doSave(PropelPDO $con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aCountry !== null) {
if ($this->aCountry->isModified() || $this->aCountry->isNew()) {
$affectedRows += $this->aCountry->save($con);
}
$this->setCountry($this->aCountry);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
} else {
$this->doUpdate($con);
}
$affectedRows += 1;
$this->resetModified();
}
if ($this->remoteAppsScheduledForDeletion !== null) {
if (!$this->remoteAppsScheduledForDeletion->isEmpty()) {
foreach ($this->remoteAppsScheduledForDeletion as $remoteApp) {
// need to save related object because we set the relation to null
$remoteApp->save($con);
}
$this->remoteAppsScheduledForDeletion = null;
}
}
if ($this->collRemoteApps !== null) {
foreach ($this->collRemoteApps as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->userCustomerRelationsScheduledForDeletion !== null) {
if (!$this->userCustomerRelationsScheduledForDeletion->isEmpty()) {
UserCustomerRelationQuery::create()
->filterByPrimaryKeys($this->userCustomerRelationsScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->userCustomerRelationsScheduledForDeletion = null;
}
}
if ($this->collUserCustomerRelations !== null) {
foreach ($this->collUserCustomerRelations as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
} | php | protected function doSave(PropelPDO $con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aCountry !== null) {
if ($this->aCountry->isModified() || $this->aCountry->isNew()) {
$affectedRows += $this->aCountry->save($con);
}
$this->setCountry($this->aCountry);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
} else {
$this->doUpdate($con);
}
$affectedRows += 1;
$this->resetModified();
}
if ($this->remoteAppsScheduledForDeletion !== null) {
if (!$this->remoteAppsScheduledForDeletion->isEmpty()) {
foreach ($this->remoteAppsScheduledForDeletion as $remoteApp) {
// need to save related object because we set the relation to null
$remoteApp->save($con);
}
$this->remoteAppsScheduledForDeletion = null;
}
}
if ($this->collRemoteApps !== null) {
foreach ($this->collRemoteApps as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->userCustomerRelationsScheduledForDeletion !== null) {
if (!$this->userCustomerRelationsScheduledForDeletion->isEmpty()) {
UserCustomerRelationQuery::create()
->filterByPrimaryKeys($this->userCustomerRelationsScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->userCustomerRelationsScheduledForDeletion = null;
}
}
if ($this->collUserCustomerRelations !== null) {
foreach ($this->collUserCustomerRelations as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
} | [
"protected",
"function",
"doSave",
"(",
"PropelPDO",
"$",
"con",
")",
"{",
"$",
"affectedRows",
"=",
"0",
";",
"// initialize var to track total num of affected rows",
"if",
"(",
"!",
"$",
"this",
"->",
"alreadyInSave",
")",
"{",
"$",
"this",
"->",
"alreadyInSave",
"=",
"true",
";",
"// We call the save method on the following object(s) if they",
"// were passed to this object by their corresponding set",
"// method. This object relates to these object(s) by a",
"// foreign key reference.",
"if",
"(",
"$",
"this",
"->",
"aCountry",
"!==",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"aCountry",
"->",
"isModified",
"(",
")",
"||",
"$",
"this",
"->",
"aCountry",
"->",
"isNew",
"(",
")",
")",
"{",
"$",
"affectedRows",
"+=",
"$",
"this",
"->",
"aCountry",
"->",
"save",
"(",
"$",
"con",
")",
";",
"}",
"$",
"this",
"->",
"setCountry",
"(",
"$",
"this",
"->",
"aCountry",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isNew",
"(",
")",
"||",
"$",
"this",
"->",
"isModified",
"(",
")",
")",
"{",
"// persist changes",
"if",
"(",
"$",
"this",
"->",
"isNew",
"(",
")",
")",
"{",
"$",
"this",
"->",
"doInsert",
"(",
"$",
"con",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"doUpdate",
"(",
"$",
"con",
")",
";",
"}",
"$",
"affectedRows",
"+=",
"1",
";",
"$",
"this",
"->",
"resetModified",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"remoteAppsScheduledForDeletion",
"!==",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"remoteAppsScheduledForDeletion",
"->",
"isEmpty",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"remoteAppsScheduledForDeletion",
"as",
"$",
"remoteApp",
")",
"{",
"// need to save related object because we set the relation to null",
"$",
"remoteApp",
"->",
"save",
"(",
"$",
"con",
")",
";",
"}",
"$",
"this",
"->",
"remoteAppsScheduledForDeletion",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"$",
"this",
"->",
"collRemoteApps",
"!==",
"null",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"collRemoteApps",
"as",
"$",
"referrerFK",
")",
"{",
"if",
"(",
"!",
"$",
"referrerFK",
"->",
"isDeleted",
"(",
")",
"&&",
"(",
"$",
"referrerFK",
"->",
"isNew",
"(",
")",
"||",
"$",
"referrerFK",
"->",
"isModified",
"(",
")",
")",
")",
"{",
"$",
"affectedRows",
"+=",
"$",
"referrerFK",
"->",
"save",
"(",
"$",
"con",
")",
";",
"}",
"}",
"}",
"if",
"(",
"$",
"this",
"->",
"userCustomerRelationsScheduledForDeletion",
"!==",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"userCustomerRelationsScheduledForDeletion",
"->",
"isEmpty",
"(",
")",
")",
"{",
"UserCustomerRelationQuery",
"::",
"create",
"(",
")",
"->",
"filterByPrimaryKeys",
"(",
"$",
"this",
"->",
"userCustomerRelationsScheduledForDeletion",
"->",
"getPrimaryKeys",
"(",
"false",
")",
")",
"->",
"delete",
"(",
"$",
"con",
")",
";",
"$",
"this",
"->",
"userCustomerRelationsScheduledForDeletion",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"$",
"this",
"->",
"collUserCustomerRelations",
"!==",
"null",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"collUserCustomerRelations",
"as",
"$",
"referrerFK",
")",
"{",
"if",
"(",
"!",
"$",
"referrerFK",
"->",
"isDeleted",
"(",
")",
"&&",
"(",
"$",
"referrerFK",
"->",
"isNew",
"(",
")",
"||",
"$",
"referrerFK",
"->",
"isModified",
"(",
")",
")",
")",
"{",
"$",
"affectedRows",
"+=",
"$",
"referrerFK",
"->",
"save",
"(",
"$",
"con",
")",
";",
"}",
"}",
"}",
"$",
"this",
"->",
"alreadyInSave",
"=",
"false",
";",
"}",
"return",
"$",
"affectedRows",
";",
"}"
]
| Performs the work of inserting or updating the row in the database.
If the object is new, it inserts it; otherwise an update is performed.
All related objects are also updated in this method.
@param PropelPDO $con
@return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
@throws PropelException
@see save() | [
"Performs",
"the",
"work",
"of",
"inserting",
"or",
"updating",
"the",
"row",
"in",
"the",
"database",
"."
]
| train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L858-L927 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomer.php | BaseCustomer.doInsert | protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = CustomerPeer::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . CustomerPeer::ID . ')');
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(CustomerPeer::ID)) {
$modifiedColumns[':p' . $index++] = '`id`';
}
if ($this->isColumnModified(CustomerPeer::NAME)) {
$modifiedColumns[':p' . $index++] = '`name`';
}
if ($this->isColumnModified(CustomerPeer::STREET)) {
$modifiedColumns[':p' . $index++] = '`street`';
}
if ($this->isColumnModified(CustomerPeer::ZIP)) {
$modifiedColumns[':p' . $index++] = '`zip`';
}
if ($this->isColumnModified(CustomerPeer::CITY)) {
$modifiedColumns[':p' . $index++] = '`city`';
}
if ($this->isColumnModified(CustomerPeer::COUNTRY_ID)) {
$modifiedColumns[':p' . $index++] = '`country_id`';
}
if ($this->isColumnModified(CustomerPeer::PHONE)) {
$modifiedColumns[':p' . $index++] = '`phone`';
}
if ($this->isColumnModified(CustomerPeer::FAX)) {
$modifiedColumns[':p' . $index++] = '`fax`';
}
if ($this->isColumnModified(CustomerPeer::EMAIL)) {
$modifiedColumns[':p' . $index++] = '`email`';
}
if ($this->isColumnModified(CustomerPeer::LEGALFORM)) {
$modifiedColumns[':p' . $index++] = '`legalform`';
}
if ($this->isColumnModified(CustomerPeer::LOGO)) {
$modifiedColumns[':p' . $index++] = '`logo`';
}
if ($this->isColumnModified(CustomerPeer::CREATED)) {
$modifiedColumns[':p' . $index++] = '`created`';
}
if ($this->isColumnModified(CustomerPeer::NOTES)) {
$modifiedColumns[':p' . $index++] = '`notes`';
}
$sql = sprintf(
'INSERT INTO `customer` (%s) VALUES (%s)',
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
try {
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case '`id`':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
case '`name`':
$stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
break;
case '`street`':
$stmt->bindValue($identifier, $this->street, PDO::PARAM_STR);
break;
case '`zip`':
$stmt->bindValue($identifier, $this->zip, PDO::PARAM_STR);
break;
case '`city`':
$stmt->bindValue($identifier, $this->city, PDO::PARAM_STR);
break;
case '`country_id`':
$stmt->bindValue($identifier, $this->country_id, PDO::PARAM_INT);
break;
case '`phone`':
$stmt->bindValue($identifier, $this->phone, PDO::PARAM_STR);
break;
case '`fax`':
$stmt->bindValue($identifier, $this->fax, PDO::PARAM_STR);
break;
case '`email`':
$stmt->bindValue($identifier, $this->email, PDO::PARAM_STR);
break;
case '`legalform`':
$stmt->bindValue($identifier, $this->legalform, PDO::PARAM_STR);
break;
case '`logo`':
$stmt->bindValue($identifier, $this->logo, PDO::PARAM_STR);
break;
case '`created`':
$stmt->bindValue($identifier, $this->created, PDO::PARAM_STR);
break;
case '`notes`':
$stmt->bindValue($identifier, $this->notes, PDO::PARAM_STR);
break;
}
}
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
}
try {
$pk = $con->lastInsertId();
} catch (Exception $e) {
throw new PropelException('Unable to get autoincrement id.', $e);
}
$this->setId($pk);
$this->setNew(false);
} | php | protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = CustomerPeer::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . CustomerPeer::ID . ')');
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(CustomerPeer::ID)) {
$modifiedColumns[':p' . $index++] = '`id`';
}
if ($this->isColumnModified(CustomerPeer::NAME)) {
$modifiedColumns[':p' . $index++] = '`name`';
}
if ($this->isColumnModified(CustomerPeer::STREET)) {
$modifiedColumns[':p' . $index++] = '`street`';
}
if ($this->isColumnModified(CustomerPeer::ZIP)) {
$modifiedColumns[':p' . $index++] = '`zip`';
}
if ($this->isColumnModified(CustomerPeer::CITY)) {
$modifiedColumns[':p' . $index++] = '`city`';
}
if ($this->isColumnModified(CustomerPeer::COUNTRY_ID)) {
$modifiedColumns[':p' . $index++] = '`country_id`';
}
if ($this->isColumnModified(CustomerPeer::PHONE)) {
$modifiedColumns[':p' . $index++] = '`phone`';
}
if ($this->isColumnModified(CustomerPeer::FAX)) {
$modifiedColumns[':p' . $index++] = '`fax`';
}
if ($this->isColumnModified(CustomerPeer::EMAIL)) {
$modifiedColumns[':p' . $index++] = '`email`';
}
if ($this->isColumnModified(CustomerPeer::LEGALFORM)) {
$modifiedColumns[':p' . $index++] = '`legalform`';
}
if ($this->isColumnModified(CustomerPeer::LOGO)) {
$modifiedColumns[':p' . $index++] = '`logo`';
}
if ($this->isColumnModified(CustomerPeer::CREATED)) {
$modifiedColumns[':p' . $index++] = '`created`';
}
if ($this->isColumnModified(CustomerPeer::NOTES)) {
$modifiedColumns[':p' . $index++] = '`notes`';
}
$sql = sprintf(
'INSERT INTO `customer` (%s) VALUES (%s)',
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
try {
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case '`id`':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
case '`name`':
$stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
break;
case '`street`':
$stmt->bindValue($identifier, $this->street, PDO::PARAM_STR);
break;
case '`zip`':
$stmt->bindValue($identifier, $this->zip, PDO::PARAM_STR);
break;
case '`city`':
$stmt->bindValue($identifier, $this->city, PDO::PARAM_STR);
break;
case '`country_id`':
$stmt->bindValue($identifier, $this->country_id, PDO::PARAM_INT);
break;
case '`phone`':
$stmt->bindValue($identifier, $this->phone, PDO::PARAM_STR);
break;
case '`fax`':
$stmt->bindValue($identifier, $this->fax, PDO::PARAM_STR);
break;
case '`email`':
$stmt->bindValue($identifier, $this->email, PDO::PARAM_STR);
break;
case '`legalform`':
$stmt->bindValue($identifier, $this->legalform, PDO::PARAM_STR);
break;
case '`logo`':
$stmt->bindValue($identifier, $this->logo, PDO::PARAM_STR);
break;
case '`created`':
$stmt->bindValue($identifier, $this->created, PDO::PARAM_STR);
break;
case '`notes`':
$stmt->bindValue($identifier, $this->notes, PDO::PARAM_STR);
break;
}
}
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
}
try {
$pk = $con->lastInsertId();
} catch (Exception $e) {
throw new PropelException('Unable to get autoincrement id.', $e);
}
$this->setId($pk);
$this->setNew(false);
} | [
"protected",
"function",
"doInsert",
"(",
"PropelPDO",
"$",
"con",
")",
"{",
"$",
"modifiedColumns",
"=",
"array",
"(",
")",
";",
"$",
"index",
"=",
"0",
";",
"$",
"this",
"->",
"modifiedColumns",
"[",
"]",
"=",
"CustomerPeer",
"::",
"ID",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"id",
")",
"{",
"throw",
"new",
"PropelException",
"(",
"'Cannot insert a value for auto-increment primary key ('",
".",
"CustomerPeer",
"::",
"ID",
".",
"')'",
")",
";",
"}",
"// check the columns in natural order for more readable SQL queries",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"CustomerPeer",
"::",
"ID",
")",
")",
"{",
"$",
"modifiedColumns",
"[",
"':p'",
".",
"$",
"index",
"++",
"]",
"=",
"'`id`'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"CustomerPeer",
"::",
"NAME",
")",
")",
"{",
"$",
"modifiedColumns",
"[",
"':p'",
".",
"$",
"index",
"++",
"]",
"=",
"'`name`'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"CustomerPeer",
"::",
"STREET",
")",
")",
"{",
"$",
"modifiedColumns",
"[",
"':p'",
".",
"$",
"index",
"++",
"]",
"=",
"'`street`'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"CustomerPeer",
"::",
"ZIP",
")",
")",
"{",
"$",
"modifiedColumns",
"[",
"':p'",
".",
"$",
"index",
"++",
"]",
"=",
"'`zip`'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"CustomerPeer",
"::",
"CITY",
")",
")",
"{",
"$",
"modifiedColumns",
"[",
"':p'",
".",
"$",
"index",
"++",
"]",
"=",
"'`city`'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"CustomerPeer",
"::",
"COUNTRY_ID",
")",
")",
"{",
"$",
"modifiedColumns",
"[",
"':p'",
".",
"$",
"index",
"++",
"]",
"=",
"'`country_id`'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"CustomerPeer",
"::",
"PHONE",
")",
")",
"{",
"$",
"modifiedColumns",
"[",
"':p'",
".",
"$",
"index",
"++",
"]",
"=",
"'`phone`'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"CustomerPeer",
"::",
"FAX",
")",
")",
"{",
"$",
"modifiedColumns",
"[",
"':p'",
".",
"$",
"index",
"++",
"]",
"=",
"'`fax`'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"CustomerPeer",
"::",
"EMAIL",
")",
")",
"{",
"$",
"modifiedColumns",
"[",
"':p'",
".",
"$",
"index",
"++",
"]",
"=",
"'`email`'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"CustomerPeer",
"::",
"LEGALFORM",
")",
")",
"{",
"$",
"modifiedColumns",
"[",
"':p'",
".",
"$",
"index",
"++",
"]",
"=",
"'`legalform`'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"CustomerPeer",
"::",
"LOGO",
")",
")",
"{",
"$",
"modifiedColumns",
"[",
"':p'",
".",
"$",
"index",
"++",
"]",
"=",
"'`logo`'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"CustomerPeer",
"::",
"CREATED",
")",
")",
"{",
"$",
"modifiedColumns",
"[",
"':p'",
".",
"$",
"index",
"++",
"]",
"=",
"'`created`'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"CustomerPeer",
"::",
"NOTES",
")",
")",
"{",
"$",
"modifiedColumns",
"[",
"':p'",
".",
"$",
"index",
"++",
"]",
"=",
"'`notes`'",
";",
"}",
"$",
"sql",
"=",
"sprintf",
"(",
"'INSERT INTO `customer` (%s) VALUES (%s)'",
",",
"implode",
"(",
"', '",
",",
"$",
"modifiedColumns",
")",
",",
"implode",
"(",
"', '",
",",
"array_keys",
"(",
"$",
"modifiedColumns",
")",
")",
")",
";",
"try",
"{",
"$",
"stmt",
"=",
"$",
"con",
"->",
"prepare",
"(",
"$",
"sql",
")",
";",
"foreach",
"(",
"$",
"modifiedColumns",
"as",
"$",
"identifier",
"=>",
"$",
"columnName",
")",
"{",
"switch",
"(",
"$",
"columnName",
")",
"{",
"case",
"'`id`'",
":",
"$",
"stmt",
"->",
"bindValue",
"(",
"$",
"identifier",
",",
"$",
"this",
"->",
"id",
",",
"PDO",
"::",
"PARAM_INT",
")",
";",
"break",
";",
"case",
"'`name`'",
":",
"$",
"stmt",
"->",
"bindValue",
"(",
"$",
"identifier",
",",
"$",
"this",
"->",
"name",
",",
"PDO",
"::",
"PARAM_STR",
")",
";",
"break",
";",
"case",
"'`street`'",
":",
"$",
"stmt",
"->",
"bindValue",
"(",
"$",
"identifier",
",",
"$",
"this",
"->",
"street",
",",
"PDO",
"::",
"PARAM_STR",
")",
";",
"break",
";",
"case",
"'`zip`'",
":",
"$",
"stmt",
"->",
"bindValue",
"(",
"$",
"identifier",
",",
"$",
"this",
"->",
"zip",
",",
"PDO",
"::",
"PARAM_STR",
")",
";",
"break",
";",
"case",
"'`city`'",
":",
"$",
"stmt",
"->",
"bindValue",
"(",
"$",
"identifier",
",",
"$",
"this",
"->",
"city",
",",
"PDO",
"::",
"PARAM_STR",
")",
";",
"break",
";",
"case",
"'`country_id`'",
":",
"$",
"stmt",
"->",
"bindValue",
"(",
"$",
"identifier",
",",
"$",
"this",
"->",
"country_id",
",",
"PDO",
"::",
"PARAM_INT",
")",
";",
"break",
";",
"case",
"'`phone`'",
":",
"$",
"stmt",
"->",
"bindValue",
"(",
"$",
"identifier",
",",
"$",
"this",
"->",
"phone",
",",
"PDO",
"::",
"PARAM_STR",
")",
";",
"break",
";",
"case",
"'`fax`'",
":",
"$",
"stmt",
"->",
"bindValue",
"(",
"$",
"identifier",
",",
"$",
"this",
"->",
"fax",
",",
"PDO",
"::",
"PARAM_STR",
")",
";",
"break",
";",
"case",
"'`email`'",
":",
"$",
"stmt",
"->",
"bindValue",
"(",
"$",
"identifier",
",",
"$",
"this",
"->",
"email",
",",
"PDO",
"::",
"PARAM_STR",
")",
";",
"break",
";",
"case",
"'`legalform`'",
":",
"$",
"stmt",
"->",
"bindValue",
"(",
"$",
"identifier",
",",
"$",
"this",
"->",
"legalform",
",",
"PDO",
"::",
"PARAM_STR",
")",
";",
"break",
";",
"case",
"'`logo`'",
":",
"$",
"stmt",
"->",
"bindValue",
"(",
"$",
"identifier",
",",
"$",
"this",
"->",
"logo",
",",
"PDO",
"::",
"PARAM_STR",
")",
";",
"break",
";",
"case",
"'`created`'",
":",
"$",
"stmt",
"->",
"bindValue",
"(",
"$",
"identifier",
",",
"$",
"this",
"->",
"created",
",",
"PDO",
"::",
"PARAM_STR",
")",
";",
"break",
";",
"case",
"'`notes`'",
":",
"$",
"stmt",
"->",
"bindValue",
"(",
"$",
"identifier",
",",
"$",
"this",
"->",
"notes",
",",
"PDO",
"::",
"PARAM_STR",
")",
";",
"break",
";",
"}",
"}",
"$",
"stmt",
"->",
"execute",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"Propel",
"::",
"log",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
",",
"Propel",
"::",
"LOG_ERR",
")",
";",
"throw",
"new",
"PropelException",
"(",
"sprintf",
"(",
"'Unable to execute INSERT statement [%s]'",
",",
"$",
"sql",
")",
",",
"$",
"e",
")",
";",
"}",
"try",
"{",
"$",
"pk",
"=",
"$",
"con",
"->",
"lastInsertId",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"throw",
"new",
"PropelException",
"(",
"'Unable to get autoincrement id.'",
",",
"$",
"e",
")",
";",
"}",
"$",
"this",
"->",
"setId",
"(",
"$",
"pk",
")",
";",
"$",
"this",
"->",
"setNew",
"(",
"false",
")",
";",
"}"
]
| Insert the row in the database.
@param PropelPDO $con
@throws PropelException
@see doSave() | [
"Insert",
"the",
"row",
"in",
"the",
"database",
"."
]
| train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L937-L1053 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomer.php | BaseCustomer.doValidate | protected function doValidate($columns = null)
{
if (!$this->alreadyInValidation) {
$this->alreadyInValidation = true;
$retval = null;
$failureMap = array();
// We call the validate method on the following object(s) if they
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aCountry !== null) {
if (!$this->aCountry->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aCountry->getValidationFailures());
}
}
if (($retval = CustomerPeer::doValidate($this, $columns)) !== true) {
$failureMap = array_merge($failureMap, $retval);
}
if ($this->collRemoteApps !== null) {
foreach ($this->collRemoteApps as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
if ($this->collUserCustomerRelations !== null) {
foreach ($this->collUserCustomerRelations as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
$this->alreadyInValidation = false;
}
return (!empty($failureMap) ? $failureMap : true);
} | php | protected function doValidate($columns = null)
{
if (!$this->alreadyInValidation) {
$this->alreadyInValidation = true;
$retval = null;
$failureMap = array();
// We call the validate method on the following object(s) if they
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aCountry !== null) {
if (!$this->aCountry->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aCountry->getValidationFailures());
}
}
if (($retval = CustomerPeer::doValidate($this, $columns)) !== true) {
$failureMap = array_merge($failureMap, $retval);
}
if ($this->collRemoteApps !== null) {
foreach ($this->collRemoteApps as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
if ($this->collUserCustomerRelations !== null) {
foreach ($this->collUserCustomerRelations as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
$this->alreadyInValidation = false;
}
return (!empty($failureMap) ? $failureMap : true);
} | [
"protected",
"function",
"doValidate",
"(",
"$",
"columns",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"alreadyInValidation",
")",
"{",
"$",
"this",
"->",
"alreadyInValidation",
"=",
"true",
";",
"$",
"retval",
"=",
"null",
";",
"$",
"failureMap",
"=",
"array",
"(",
")",
";",
"// We call the validate method on the following object(s) if they",
"// were passed to this object by their corresponding set",
"// method. This object relates to these object(s) by a",
"// foreign key reference.",
"if",
"(",
"$",
"this",
"->",
"aCountry",
"!==",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"aCountry",
"->",
"validate",
"(",
"$",
"columns",
")",
")",
"{",
"$",
"failureMap",
"=",
"array_merge",
"(",
"$",
"failureMap",
",",
"$",
"this",
"->",
"aCountry",
"->",
"getValidationFailures",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"(",
"$",
"retval",
"=",
"CustomerPeer",
"::",
"doValidate",
"(",
"$",
"this",
",",
"$",
"columns",
")",
")",
"!==",
"true",
")",
"{",
"$",
"failureMap",
"=",
"array_merge",
"(",
"$",
"failureMap",
",",
"$",
"retval",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"collRemoteApps",
"!==",
"null",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"collRemoteApps",
"as",
"$",
"referrerFK",
")",
"{",
"if",
"(",
"!",
"$",
"referrerFK",
"->",
"validate",
"(",
"$",
"columns",
")",
")",
"{",
"$",
"failureMap",
"=",
"array_merge",
"(",
"$",
"failureMap",
",",
"$",
"referrerFK",
"->",
"getValidationFailures",
"(",
")",
")",
";",
"}",
"}",
"}",
"if",
"(",
"$",
"this",
"->",
"collUserCustomerRelations",
"!==",
"null",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"collUserCustomerRelations",
"as",
"$",
"referrerFK",
")",
"{",
"if",
"(",
"!",
"$",
"referrerFK",
"->",
"validate",
"(",
"$",
"columns",
")",
")",
"{",
"$",
"failureMap",
"=",
"array_merge",
"(",
"$",
"failureMap",
",",
"$",
"referrerFK",
"->",
"getValidationFailures",
"(",
")",
")",
";",
"}",
"}",
"}",
"$",
"this",
"->",
"alreadyInValidation",
"=",
"false",
";",
"}",
"return",
"(",
"!",
"empty",
"(",
"$",
"failureMap",
")",
"?",
"$",
"failureMap",
":",
"true",
")",
";",
"}"
]
| This function performs the validation work for complex object models.
In addition to checking the current object, all related objects will
also be validated. If all pass then <code>true</code> is returned; otherwise
an aggregated array of ValidationFailed objects will be returned.
@param array $columns Array of column names to validate.
@return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise. | [
"This",
"function",
"performs",
"the",
"validation",
"work",
"for",
"complex",
"object",
"models",
"."
]
| train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1122-L1169 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.