repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
mgallegos/decima-accounting | src/Mgallegos/DecimaAccounting/Accounting/Repositories/Account/EloquentAccount.php | EloquentAccount.byParent | public function byParent($id, $databaseConnectionName = null)
{
if(empty($databaseConnectionName))
{
$databaseConnectionName = $this->databaseConnectionName;
}
return $this->Account->setConnection($databaseConnectionName)
->where('parent_account_id', '=', $id)
->orderBy('key', 'asc')
->get();
} | php | public function byParent($id, $databaseConnectionName = null)
{
if(empty($databaseConnectionName))
{
$databaseConnectionName = $this->databaseConnectionName;
}
return $this->Account->setConnection($databaseConnectionName)
->where('parent_account_id', '=', $id)
->orderBy('key', 'asc')
->get();
} | [
"public",
"function",
"byParent",
"(",
"$",
"id",
",",
"$",
"databaseConnectionName",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"databaseConnectionName",
")",
")",
"{",
"$",
"databaseConnectionName",
"=",
"$",
"this",
"->",
"databaseConnectionName",... | Retrieve accounts by parent
@param int $id Organization id
@return Illuminate\Database\Eloquent\Collection | [
"Retrieve",
"accounts",
"by",
"parent"
] | 6410585303a13892e64e9dfeacbae0ca212b458b | https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Repositories/Account/EloquentAccount.php#L135-L146 | train |
byrokrat/autogiro | src/Visitor/PayeeVisitor.php | PayeeVisitor.beforePayeeBankgiro | public function beforePayeeBankgiro(Node $node): void
{
if (!$this->payeeBg) {
$this->payeeBg = (string)$node->getValueFrom('Number');
}
if ($node->getValueFrom('Number') != $this->payeeBg) {
$this->getErrorObject()->addError(
"Non-matching payee bankgiro numbers (expecting: %s, found: %s) on line %s",
$this->payeeBg,
(string)$node->getValueFrom('Number'),
(string)$node->getLineNr()
);
}
} | php | public function beforePayeeBankgiro(Node $node): void
{
if (!$this->payeeBg) {
$this->payeeBg = (string)$node->getValueFrom('Number');
}
if ($node->getValueFrom('Number') != $this->payeeBg) {
$this->getErrorObject()->addError(
"Non-matching payee bankgiro numbers (expecting: %s, found: %s) on line %s",
$this->payeeBg,
(string)$node->getValueFrom('Number'),
(string)$node->getLineNr()
);
}
} | [
"public",
"function",
"beforePayeeBankgiro",
"(",
"Node",
"$",
"node",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"payeeBg",
")",
"{",
"$",
"this",
"->",
"payeeBg",
"=",
"(",
"string",
")",
"$",
"node",
"->",
"getValueFrom",
"(",
"'Num... | Validate payee bankgiro number | [
"Validate",
"payee",
"bankgiro",
"number"
] | 7035467af18e991c0c130d83294b0779aa3e1583 | https://github.com/byrokrat/autogiro/blob/7035467af18e991c0c130d83294b0779aa3e1583/src/Visitor/PayeeVisitor.php#L56-L70 | train |
byrokrat/autogiro | src/Visitor/PayeeVisitor.php | PayeeVisitor.beforePayeeBgcNumber | public function beforePayeeBgcNumber(Node $node): void
{
if (!$this->payeeBgcNr) {
$this->payeeBgcNr = (string)$node->getValue();
}
if ($node->getValue() != $this->payeeBgcNr) {
$this->getErrorObject()->addError(
"Non-matching payee BGC customer numbers (expecting: %s, found: %s) on line %s",
$this->payeeBgcNr,
(string)$node->getValue(),
(string)$node->getLineNr()
);
}
} | php | public function beforePayeeBgcNumber(Node $node): void
{
if (!$this->payeeBgcNr) {
$this->payeeBgcNr = (string)$node->getValue();
}
if ($node->getValue() != $this->payeeBgcNr) {
$this->getErrorObject()->addError(
"Non-matching payee BGC customer numbers (expecting: %s, found: %s) on line %s",
$this->payeeBgcNr,
(string)$node->getValue(),
(string)$node->getLineNr()
);
}
} | [
"public",
"function",
"beforePayeeBgcNumber",
"(",
"Node",
"$",
"node",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"payeeBgcNr",
")",
"{",
"$",
"this",
"->",
"payeeBgcNr",
"=",
"(",
"string",
")",
"$",
"node",
"->",
"getValue",
"(",
")... | Validate payee BGC customer number | [
"Validate",
"payee",
"BGC",
"customer",
"number"
] | 7035467af18e991c0c130d83294b0779aa3e1583 | https://github.com/byrokrat/autogiro/blob/7035467af18e991c0c130d83294b0779aa3e1583/src/Visitor/PayeeVisitor.php#L75-L89 | train |
Due/php-ecom-sdk | lib/Transactions.php | Transactions.all | public static function all(array $arg_params)
{
//validate params
$data = self::getParams($arg_params);
$url = '/ecommerce/transactions';
$filters = '';
if(!empty($data['page'])&&ctype_digit($data['page'])){
$filters .= 'page='.$data['page'];
}
if(!empty($filters))$filters='?'.$filters;
//submit to api
$transactions_data = APIRequests::request(
$url.$filters,
APIRequests::METHOD_GET
);
//return response
return self::toListObj($transactions_data['body']);
} | php | public static function all(array $arg_params)
{
//validate params
$data = self::getParams($arg_params);
$url = '/ecommerce/transactions';
$filters = '';
if(!empty($data['page'])&&ctype_digit($data['page'])){
$filters .= 'page='.$data['page'];
}
if(!empty($filters))$filters='?'.$filters;
//submit to api
$transactions_data = APIRequests::request(
$url.$filters,
APIRequests::METHOD_GET
);
//return response
return self::toListObj($transactions_data['body']);
} | [
"public",
"static",
"function",
"all",
"(",
"array",
"$",
"arg_params",
")",
"{",
"//validate params",
"$",
"data",
"=",
"self",
"::",
"getParams",
"(",
"$",
"arg_params",
")",
";",
"$",
"url",
"=",
"'/ecommerce/transactions'",
";",
"$",
"filters",
"=",
"'... | Get Transactions Data
@param array $arg_params
@return StdClass
@throws \Exception | [
"Get",
"Transactions",
"Data"
] | 4c2e4040469bb159e62461363ec133b6faf0a7ae | https://github.com/Due/php-ecom-sdk/blob/4c2e4040469bb159e62461363ec133b6faf0a7ae/lib/Transactions.php#L85-L104 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Core/Engine/ModuleFactory.php | ModuleFactory.httpDigestParse | private static function httpDigestParse($txt)
{
// protect against missing data
$needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1);
$data = array();
$keys = implode('|', array_keys($needed_parts));
preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER);
foreach ($matches as $m) {
$data[$m[1]] = $m[3] ? $m[3] : $m[4];
unset($needed_parts[$m[1]]);
}
return $needed_parts ? false : $data;
} | php | private static function httpDigestParse($txt)
{
// protect against missing data
$needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1);
$data = array();
$keys = implode('|', array_keys($needed_parts));
preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER);
foreach ($matches as $m) {
$data[$m[1]] = $m[3] ? $m[3] : $m[4];
unset($needed_parts[$m[1]]);
}
return $needed_parts ? false : $data;
} | [
"private",
"static",
"function",
"httpDigestParse",
"(",
"$",
"txt",
")",
"{",
"// protect against missing data",
"$",
"needed_parts",
"=",
"array",
"(",
"'nonce'",
"=>",
"1",
",",
"'nc'",
"=>",
"1",
",",
"'cnonce'",
"=>",
"1",
",",
"'qop'",
"=>",
"1",
","... | function to parse the http auth header | [
"function",
"to",
"parse",
"the",
"http",
"auth",
"header"
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Engine/ModuleFactory.php#L230-L245 | train |
Malwarebytes/Altamira | src/Altamira/Series.php | Series.setOption | public function setOption( $name, $value )
{
$this->jsWriter->setSeriesOption( $this->getTitle(), $name, $value );
return $this;
} | php | public function setOption( $name, $value )
{
$this->jsWriter->setSeriesOption( $this->getTitle(), $name, $value );
return $this;
} | [
"public",
"function",
"setOption",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"jsWriter",
"->",
"setSeriesOption",
"(",
"$",
"this",
"->",
"getTitle",
"(",
")",
",",
"$",
"name",
",",
"$",
"value",
")",
";",
"return",
"$",
"t... | Sets an option for this specific series within the JsWriter
@param string $name
@param string $value
@return \Altamira\Series provides fluent interface | [
"Sets",
"an",
"option",
"for",
"this",
"specific",
"series",
"within",
"the",
"JsWriter"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/Series.php#L182-L187 | train |
Malwarebytes/Altamira | src/Altamira/Series.php | Series.setLineWidth | public function setLineWidth( $val )
{
if ( $this->jsWriter instanceof \Altamira\JsWriter\Ability\Lineable ) {
$this->jsWriter->setSeriesLineWidth( $this->getTitle(), $val );
}
return $this;
} | php | public function setLineWidth( $val )
{
if ( $this->jsWriter instanceof \Altamira\JsWriter\Ability\Lineable ) {
$this->jsWriter->setSeriesLineWidth( $this->getTitle(), $val );
}
return $this;
} | [
"public",
"function",
"setLineWidth",
"(",
"$",
"val",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"jsWriter",
"instanceof",
"\\",
"Altamira",
"\\",
"JsWriter",
"\\",
"Ability",
"\\",
"Lineable",
")",
"{",
"$",
"this",
"->",
"jsWriter",
"->",
"setSeriesLineWid... | Sets the line width for the series
@param string|int $val
@return \Altamira\Series provides fluent interface | [
"Sets",
"the",
"line",
"width",
"for",
"the",
"series"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/Series.php#L213-L219 | train |
TheBnl/event-tickets | code/fields/SummaryField.php | SummaryField.Field | public function Field($properties = array())
{
$context = $this;
$properties['Editable'] = $this->editable;
$properties['Reservation'] = $this->getReservation();
$properties['Attendees'] = $this->editable
? $this->getEditableAttendees()
: $this->getReservation()->Attendees();
if (count($properties)) {
$context = $context->customise($properties);
}
$this->extend('onBeforeRender', $context);
$result = $context->renderWith($this->getTemplates());
if (is_string($result)) {
$result = trim($result);
} else {
if ($result instanceof DBField) {
$result->setValue(trim($result->getValue()));
}
}
return $result;
} | php | public function Field($properties = array())
{
$context = $this;
$properties['Editable'] = $this->editable;
$properties['Reservation'] = $this->getReservation();
$properties['Attendees'] = $this->editable
? $this->getEditableAttendees()
: $this->getReservation()->Attendees();
if (count($properties)) {
$context = $context->customise($properties);
}
$this->extend('onBeforeRender', $context);
$result = $context->renderWith($this->getTemplates());
if (is_string($result)) {
$result = trim($result);
} else {
if ($result instanceof DBField) {
$result->setValue(trim($result->getValue()));
}
}
return $result;
} | [
"public",
"function",
"Field",
"(",
"$",
"properties",
"=",
"array",
"(",
")",
")",
"{",
"$",
"context",
"=",
"$",
"this",
";",
"$",
"properties",
"[",
"'Editable'",
"]",
"=",
"$",
"this",
"->",
"editable",
";",
"$",
"properties",
"[",
"'Reservation'",... | Get the field customized with tickets and reservation
@param array $properties
@return \HTMLText|string | [
"Get",
"the",
"field",
"customized",
"with",
"tickets",
"and",
"reservation"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/fields/SummaryField.php#L78-L104 | train |
orkestra/OrkestraPdfBundle | Factory/TcPdfFactory.php | TcPdfFactory.create | public function create(array $options = array())
{
$reflClass = $this->getReflectionClass($options);
$options = array_merge(array(
'orientation' => 'P',
'unit' => 'mm',
'format' => 'USLETTER',
'unicode' => true,
'encoding' => 'UTF-8',
'diskcache' => true,
'pdfa' => false,
'printHeader' => false,
'printFooter' => false,
'margins' => array(15, 27, 15),
'autoPageBreak' => array(true, 25),
), $options);
$pdf = $reflClass->newInstanceArgs($this->getConstructorOptions($options));
foreach ($options as $option => $arguments) {
if (is_callable(array($pdf, 'set' . $option))) {
if (!is_array($arguments)) {
if (null === $arguments) {
$arguments = array();
} else {
$arguments = array($arguments);
}
}
call_user_func_array(array($pdf, 'set' . $option), $arguments);
}
}
return new TcPdf($pdf);
} | php | public function create(array $options = array())
{
$reflClass = $this->getReflectionClass($options);
$options = array_merge(array(
'orientation' => 'P',
'unit' => 'mm',
'format' => 'USLETTER',
'unicode' => true,
'encoding' => 'UTF-8',
'diskcache' => true,
'pdfa' => false,
'printHeader' => false,
'printFooter' => false,
'margins' => array(15, 27, 15),
'autoPageBreak' => array(true, 25),
), $options);
$pdf = $reflClass->newInstanceArgs($this->getConstructorOptions($options));
foreach ($options as $option => $arguments) {
if (is_callable(array($pdf, 'set' . $option))) {
if (!is_array($arguments)) {
if (null === $arguments) {
$arguments = array();
} else {
$arguments = array($arguments);
}
}
call_user_func_array(array($pdf, 'set' . $option), $arguments);
}
}
return new TcPdf($pdf);
} | [
"public",
"function",
"create",
"(",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"reflClass",
"=",
"$",
"this",
"->",
"getReflectionClass",
"(",
"$",
"options",
")",
";",
"$",
"options",
"=",
"array_merge",
"(",
"array",
"(",
"'orie... | Create a new TcPdf
@param array $options
@return \Orkestra\Bundle\PdfBundle\Pdf\PdfInterface|\Orkestra\Bundle\PdfBundle\Pdf\TcPdf | [
"Create",
"a",
"new",
"TcPdf"
] | 45979a93b662e81787116f26b53362911878c685 | https://github.com/orkestra/OrkestraPdfBundle/blob/45979a93b662e81787116f26b53362911878c685/Factory/TcPdfFactory.php#L28-L63 | train |
orkestra/OrkestraPdfBundle | Factory/TcPdfFactory.php | TcPdfFactory.getConstructorOptions | protected function getConstructorOptions(array &$options)
{
$ctorOptions = array(
'orientation' => isset($options['orientation']) ? $options['orientation'] : 'P',
'unit' => isset($options['unit']) ? $options['unit'] : 'mm',
'format' => isset($options['format']) ? $options['format'] : 'A4',
'unicode' => isset($options['unicode']) ? $options['unicode'] : true,
'encoding' => isset($options['encoding']) ? $options['encoding'] : 'UTF-8',
// Diskcache actually defaults to false, but caching is a good thing, so we will default to true
'diskcache' => isset($options['diskcache']) ? $options['diskcache'] : true,
'pdfa' => isset($options['pdfa']) ? $options['pdfa'] : false
);
unset(
$options['orientation'],
$options['unit'],
$options['format'],
$options['unicode'],
$options['encoding'],
$options['diskcache'],
$options['pdfa']
);
return array_values($ctorOptions);
} | php | protected function getConstructorOptions(array &$options)
{
$ctorOptions = array(
'orientation' => isset($options['orientation']) ? $options['orientation'] : 'P',
'unit' => isset($options['unit']) ? $options['unit'] : 'mm',
'format' => isset($options['format']) ? $options['format'] : 'A4',
'unicode' => isset($options['unicode']) ? $options['unicode'] : true,
'encoding' => isset($options['encoding']) ? $options['encoding'] : 'UTF-8',
// Diskcache actually defaults to false, but caching is a good thing, so we will default to true
'diskcache' => isset($options['diskcache']) ? $options['diskcache'] : true,
'pdfa' => isset($options['pdfa']) ? $options['pdfa'] : false
);
unset(
$options['orientation'],
$options['unit'],
$options['format'],
$options['unicode'],
$options['encoding'],
$options['diskcache'],
$options['pdfa']
);
return array_values($ctorOptions);
} | [
"protected",
"function",
"getConstructorOptions",
"(",
"array",
"&",
"$",
"options",
")",
"{",
"$",
"ctorOptions",
"=",
"array",
"(",
"'orientation'",
"=>",
"isset",
"(",
"$",
"options",
"[",
"'orientation'",
"]",
")",
"?",
"$",
"options",
"[",
"'orientation... | Returns an array of constructor arguments
This method unsets any constructor arguments in the given options array
@param array $options
@return array | [
"Returns",
"an",
"array",
"of",
"constructor",
"arguments"
] | 45979a93b662e81787116f26b53362911878c685 | https://github.com/orkestra/OrkestraPdfBundle/blob/45979a93b662e81787116f26b53362911878c685/Factory/TcPdfFactory.php#L74-L98 | train |
TheBnl/event-tickets | code/session/ReservationSession.php | ReservationSession.start | public static function start(CalendarEvent $event)
{
$reservation = Reservation::create();
$reservation->EventID = $event->ID;
$reservation->write();
self::set($reservation);
return $reservation;
} | php | public static function start(CalendarEvent $event)
{
$reservation = Reservation::create();
$reservation->EventID = $event->ID;
$reservation->write();
self::set($reservation);
return $reservation;
} | [
"public",
"static",
"function",
"start",
"(",
"CalendarEvent",
"$",
"event",
")",
"{",
"$",
"reservation",
"=",
"Reservation",
"::",
"create",
"(",
")",
";",
"$",
"reservation",
"->",
"EventID",
"=",
"$",
"event",
"->",
"ID",
";",
"$",
"reservation",
"->... | Start the ticket session
@param CalendarEvent $event
@return Reservation | [
"Start",
"the",
"ticket",
"session"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/session/ReservationSession.php#L53-L60 | train |
TheBnl/event-tickets | code/session/ReservationSession.php | ReservationSession.end | public static function end()
{
// If the session is ended while in cart or pending state, remove the reservation.
// The session is only ended in these states when iffy business is going on.
if (in_array(self::get()->Status, array('CART', 'PENDING'))) {
self::get()->delete();
}
Session::set(self::KEY, null);
Session::clear(self::KEY);
} | php | public static function end()
{
// If the session is ended while in cart or pending state, remove the reservation.
// The session is only ended in these states when iffy business is going on.
if (in_array(self::get()->Status, array('CART', 'PENDING'))) {
self::get()->delete();
}
Session::set(self::KEY, null);
Session::clear(self::KEY);
} | [
"public",
"static",
"function",
"end",
"(",
")",
"{",
"// If the session is ended while in cart or pending state, remove the reservation.",
"// The session is only ended in these states when iffy business is going on.",
"if",
"(",
"in_array",
"(",
"self",
"::",
"get",
"(",
")",
"... | End the Ticket session | [
"End",
"the",
"Ticket",
"session"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/session/ReservationSession.php#L65-L75 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/LocalRecords/Model/Base/Record.php | Record.setPlayer | public function setPlayer(Player $v = null)
{
if ($v === null) {
$this->setPlayerId(NULL);
} else {
$this->setPlayerId($v->getId());
}
$this->aPlayer = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Player object, it will not be re-added.
if ($v !== null) {
$v->addRecord($this);
}
return $this;
} | php | public function setPlayer(Player $v = null)
{
if ($v === null) {
$this->setPlayerId(NULL);
} else {
$this->setPlayerId($v->getId());
}
$this->aPlayer = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Player object, it will not be re-added.
if ($v !== null) {
$v->addRecord($this);
}
return $this;
} | [
"public",
"function",
"setPlayer",
"(",
"Player",
"$",
"v",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"v",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"setPlayerId",
"(",
"NULL",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"setPlayerId",
"(",
"$"... | Declares an association between this object and a Player object.
@param Player $v
@return $this|\eXpansion\Bundle\LocalRecords\Model\Record The current object (for fluent API support)
@throws PropelException | [
"Declares",
"an",
"association",
"between",
"this",
"object",
"and",
"a",
"Player",
"object",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/LocalRecords/Model/Base/Record.php#L1557-L1575 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/LocalRecords/Model/Base/Record.php | Record.getPlayer | public function getPlayer(ConnectionInterface $con = null)
{
if ($this->aPlayer === null && ($this->player_id !== null)) {
$this->aPlayer = PlayerQuery::create()->findPk($this->player_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
$this->aPlayer->addRecords($this);
*/
}
return $this->aPlayer;
} | php | public function getPlayer(ConnectionInterface $con = null)
{
if ($this->aPlayer === null && ($this->player_id !== null)) {
$this->aPlayer = PlayerQuery::create()->findPk($this->player_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
$this->aPlayer->addRecords($this);
*/
}
return $this->aPlayer;
} | [
"public",
"function",
"getPlayer",
"(",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"aPlayer",
"===",
"null",
"&&",
"(",
"$",
"this",
"->",
"player_id",
"!==",
"null",
")",
")",
"{",
"$",
"this",
"->",
"aPl... | Get the associated Player object
@param ConnectionInterface $con Optional Connection object.
@return Player The associated Player object.
@throws PropelException | [
"Get",
"the",
"associated",
"Player",
"object"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/LocalRecords/Model/Base/Record.php#L1585-L1599 | train |
TheBnl/event-tickets | code/extensions/TicketExtension.php | TicketExtension.createDefaultFields | public function createDefaultFields()
{
$fields = Attendee::config()->get('default_fields');
if (!$this->owner->Fields()->exists()) {
foreach ($fields as $fieldName => $config) {
$field = UserField::createDefaultField($fieldName, $config);
$this->owner->Fields()->add($field);
}
}
} | php | public function createDefaultFields()
{
$fields = Attendee::config()->get('default_fields');
if (!$this->owner->Fields()->exists()) {
foreach ($fields as $fieldName => $config) {
$field = UserField::createDefaultField($fieldName, $config);
$this->owner->Fields()->add($field);
}
}
} | [
"public",
"function",
"createDefaultFields",
"(",
")",
"{",
"$",
"fields",
"=",
"Attendee",
"::",
"config",
"(",
")",
"->",
"get",
"(",
"'default_fields'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"owner",
"->",
"Fields",
"(",
")",
"->",
"exists",
... | Creates and sets up the default fields | [
"Creates",
"and",
"sets",
"up",
"the",
"default",
"fields"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/extensions/TicketExtension.php#L134-L143 | train |
TheBnl/event-tickets | code/extensions/TicketExtension.php | TicketExtension.updateCMSActions | public function updateCMSActions(FieldList $actions)
{
$checkInButton = new LiteralField('StartCheckIn',
"<a class='action ss-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only'
id='Edit_StartCheckIn'
role='button'
href='{$this->owner->Link('checkin')}'
target='_blank'>
Start check in
</a>"
);
if ($this->owner->Attendees()->exists()) {
$actions->push($checkInButton);
}
} | php | public function updateCMSActions(FieldList $actions)
{
$checkInButton = new LiteralField('StartCheckIn',
"<a class='action ss-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only'
id='Edit_StartCheckIn'
role='button'
href='{$this->owner->Link('checkin')}'
target='_blank'>
Start check in
</a>"
);
if ($this->owner->Attendees()->exists()) {
$actions->push($checkInButton);
}
} | [
"public",
"function",
"updateCMSActions",
"(",
"FieldList",
"$",
"actions",
")",
"{",
"$",
"checkInButton",
"=",
"new",
"LiteralField",
"(",
"'StartCheckIn'",
",",
"\"<a class='action ss-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only'\n ... | Extend the page actions with an start check in action
@param FieldList $actions | [
"Extend",
"the",
"page",
"actions",
"with",
"an",
"start",
"check",
"in",
"action"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/extensions/TicketExtension.php#L150-L165 | train |
TheBnl/event-tickets | code/extensions/TicketExtension.php | TicketExtension.getTicketSaleStartDate | public function getTicketSaleStartDate()
{
$saleStart = null;
if (($tickets = $this->owner->Tickets())) {
/** @var Ticket $ticket */
foreach ($tickets as $ticket) {
if (($date = $ticket->getAvailableFrom()) && strtotime($date) < strtotime($saleStart) || $saleStart === null) {
$saleStart = $date;
}
}
}
return $saleStart;
} | php | public function getTicketSaleStartDate()
{
$saleStart = null;
if (($tickets = $this->owner->Tickets())) {
/** @var Ticket $ticket */
foreach ($tickets as $ticket) {
if (($date = $ticket->getAvailableFrom()) && strtotime($date) < strtotime($saleStart) || $saleStart === null) {
$saleStart = $date;
}
}
}
return $saleStart;
} | [
"public",
"function",
"getTicketSaleStartDate",
"(",
")",
"{",
"$",
"saleStart",
"=",
"null",
";",
"if",
"(",
"(",
"$",
"tickets",
"=",
"$",
"this",
"->",
"owner",
"->",
"Tickets",
"(",
")",
")",
")",
"{",
"/** @var Ticket $ticket */",
"foreach",
"(",
"$... | get The sale start date
@return \SS_DateTime | [
"get",
"The",
"sale",
"start",
"date"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/extensions/TicketExtension.php#L201-L214 | train |
TheBnl/event-tickets | code/extensions/TicketExtension.php | TicketExtension.getEventExpired | public function getEventExpired()
{
$expired = false;
if (($tickets = $this->owner->Tickets()) && $expired = $tickets->exists()) {
/** @var Ticket $ticket */
foreach ($tickets as $ticket) {
$expired = (!$ticket->validateDate() && $expired);
}
}
return $expired;
} | php | public function getEventExpired()
{
$expired = false;
if (($tickets = $this->owner->Tickets()) && $expired = $tickets->exists()) {
/** @var Ticket $ticket */
foreach ($tickets as $ticket) {
$expired = (!$ticket->validateDate() && $expired);
}
}
return $expired;
} | [
"public",
"function",
"getEventExpired",
"(",
")",
"{",
"$",
"expired",
"=",
"false",
";",
"if",
"(",
"(",
"$",
"tickets",
"=",
"$",
"this",
"->",
"owner",
"->",
"Tickets",
"(",
")",
")",
"&&",
"$",
"expired",
"=",
"$",
"tickets",
"->",
"exists",
"... | Check if the event is expired, either by unavailable tickets or because the date has passed
@return bool | [
"Check",
"if",
"the",
"event",
"is",
"expired",
"either",
"by",
"unavailable",
"tickets",
"or",
"because",
"the",
"date",
"has",
"passed"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/extensions/TicketExtension.php#L221-L232 | train |
TheBnl/event-tickets | code/extensions/TicketExtension.php | TicketExtension.getGuestList | public function getGuestList()
{
$reservationClass = Reservation::singleton()->getClassName();
$attendeeClass = Attendee::singleton()->getClassName();
return Attendee::get()
->leftJoin($reservationClass, "`$attendeeClass`.`ReservationID` = `$reservationClass`.`ID`")
->filter(array(
'EventID' => $this->owner->ID
))
->filterAny(array(
'ReservationID' => 0,
'Status' => Reservation::STATUS_PAID
));
} | php | public function getGuestList()
{
$reservationClass = Reservation::singleton()->getClassName();
$attendeeClass = Attendee::singleton()->getClassName();
return Attendee::get()
->leftJoin($reservationClass, "`$attendeeClass`.`ReservationID` = `$reservationClass`.`ID`")
->filter(array(
'EventID' => $this->owner->ID
))
->filterAny(array(
'ReservationID' => 0,
'Status' => Reservation::STATUS_PAID
));
} | [
"public",
"function",
"getGuestList",
"(",
")",
"{",
"$",
"reservationClass",
"=",
"Reservation",
"::",
"singleton",
"(",
")",
"->",
"getClassName",
"(",
")",
";",
"$",
"attendeeClass",
"=",
"Attendee",
"::",
"singleton",
"(",
")",
"->",
"getClassName",
"(",... | Get only the attendees who are certain to attend
Also includes attendees without any reservation, these are manually added
@return \DataList | [
"Get",
"only",
"the",
"attendees",
"who",
"are",
"certain",
"to",
"attend",
"Also",
"includes",
"attendees",
"without",
"any",
"reservation",
"these",
"are",
"manually",
"added"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/extensions/TicketExtension.php#L250-L263 | train |
TheBnl/event-tickets | code/extensions/TicketExtension.php | TicketExtension.getSuccessContent | public function getSuccessContent()
{
if (!empty($this->owner->SuccessMessage)) {
return $this->owner->dbObject('SuccessMessage');
} else {
return SiteConfig::current_site_config()->dbObject('SuccessMessage');
}
} | php | public function getSuccessContent()
{
if (!empty($this->owner->SuccessMessage)) {
return $this->owner->dbObject('SuccessMessage');
} else {
return SiteConfig::current_site_config()->dbObject('SuccessMessage');
}
} | [
"public",
"function",
"getSuccessContent",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"owner",
"->",
"SuccessMessage",
")",
")",
"{",
"return",
"$",
"this",
"->",
"owner",
"->",
"dbObject",
"(",
"'SuccessMessage'",
")",
";",
"}",
"... | Get the success message
@return mixed|string | [
"Get",
"the",
"success",
"message"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/extensions/TicketExtension.php#L282-L289 | train |
TheBnl/event-tickets | code/extensions/TicketExtension.php | TicketExtension.getMailContent | public function getMailContent()
{
if (!empty($this->owner->SuccessMessageMail)) {
return $this->owner->dbObject('SuccessMessageMail');
} else {
return SiteConfig::current_site_config()->dbObject('SuccessMessageMail');
}
} | php | public function getMailContent()
{
if (!empty($this->owner->SuccessMessageMail)) {
return $this->owner->dbObject('SuccessMessageMail');
} else {
return SiteConfig::current_site_config()->dbObject('SuccessMessageMail');
}
} | [
"public",
"function",
"getMailContent",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"owner",
"->",
"SuccessMessageMail",
")",
")",
"{",
"return",
"$",
"this",
"->",
"owner",
"->",
"dbObject",
"(",
"'SuccessMessageMail'",
")",
";",
"}"... | Get the mail message
@return mixed|string | [
"Get",
"the",
"mail",
"message"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/extensions/TicketExtension.php#L296-L303 | train |
TheBnl/event-tickets | code/extensions/TicketExtension.php | TicketExtension.canCreateTickets | public function canCreateTickets()
{
$currentDate = $this->owner->getController()->CurrentDate();
if ($currentDate && $currentDate->exists()) {
return $currentDate->dbObject('StartDate')->InFuture();
}
return false;
} | php | public function canCreateTickets()
{
$currentDate = $this->owner->getController()->CurrentDate();
if ($currentDate && $currentDate->exists()) {
return $currentDate->dbObject('StartDate')->InFuture();
}
return false;
} | [
"public",
"function",
"canCreateTickets",
"(",
")",
"{",
"$",
"currentDate",
"=",
"$",
"this",
"->",
"owner",
"->",
"getController",
"(",
")",
"->",
"CurrentDate",
"(",
")",
";",
"if",
"(",
"$",
"currentDate",
"&&",
"$",
"currentDate",
"->",
"exists",
"(... | Check if the current event can have tickets
@return bool | [
"Check",
"if",
"the",
"current",
"event",
"can",
"have",
"tickets"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/extensions/TicketExtension.php#L320-L328 | train |
TheBnl/event-tickets | code/extensions/TicketExtension.php | TicketExtension.getController | public function getController()
{
return $this->controller
? $this->controller
: $this->controller = CalendarEvent_Controller::create($this->owner);
} | php | public function getController()
{
return $this->controller
? $this->controller
: $this->controller = CalendarEvent_Controller::create($this->owner);
} | [
"public",
"function",
"getController",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"controller",
"?",
"$",
"this",
"->",
"controller",
":",
"$",
"this",
"->",
"controller",
"=",
"CalendarEvent_Controller",
"::",
"create",
"(",
"$",
"this",
"->",
"owner",
"... | Get the calendar controller
@return CalendarEvent_Controller | [
"Get",
"the",
"calendar",
"controller"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/extensions/TicketExtension.php#L335-L340 | train |
smartboxgroup/core-bundle | Serializer/Handler/CachedObjectHandler.php | CachedObjectHandler.getDataCacheKey | public static function getDataCacheKey($data, Context $context)
{
$group = $context->hasAttribute('groups') ? $context->getAttribute('groups') : '*';
$version = $context->hasAttribute('version') ? $context->getAttribute('version') : '*';
$dataArray = [
'data' => $data,
'serializationFormat' => $context->getFormat(),
'serializationGroups' => $group,
'serializationVersion' => $version,
];
try {
return \sha1(\serialize($dataArray));
} catch (\Exception $e) {
return;
}
} | php | public static function getDataCacheKey($data, Context $context)
{
$group = $context->hasAttribute('groups') ? $context->getAttribute('groups') : '*';
$version = $context->hasAttribute('version') ? $context->getAttribute('version') : '*';
$dataArray = [
'data' => $data,
'serializationFormat' => $context->getFormat(),
'serializationGroups' => $group,
'serializationVersion' => $version,
];
try {
return \sha1(\serialize($dataArray));
} catch (\Exception $e) {
return;
}
} | [
"public",
"static",
"function",
"getDataCacheKey",
"(",
"$",
"data",
",",
"Context",
"$",
"context",
")",
"{",
"$",
"group",
"=",
"$",
"context",
"->",
"hasAttribute",
"(",
"'groups'",
")",
"?",
"$",
"context",
"->",
"getAttribute",
"(",
"'groups'",
")",
... | Returns the caching key of the given data or null if it can not be cached.
@param $data
@param Context $context
@return null|string | [
"Returns",
"the",
"caching",
"key",
"of",
"the",
"given",
"data",
"or",
"null",
"if",
"it",
"can",
"not",
"be",
"cached",
"."
] | 88ffc0af6631efbea90425454ce0bce0c753504e | https://github.com/smartboxgroup/core-bundle/blob/88ffc0af6631efbea90425454ce0bce0c753504e/Serializer/Handler/CachedObjectHandler.php#L25-L42 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php | MapQuery.filterByFilename | public function filterByFilename($filename = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($filename)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_FILENAME, $filename, $comparison);
} | php | public function filterByFilename($filename = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($filename)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_FILENAME, $filename, $comparison);
} | [
"public",
"function",
"filterByFilename",
"(",
"$",
"filename",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"filename",
")",
")",
"{",
"$",
"compa... | Filter the query on the fileName column
Example usage:
<code>
$query->filterByFilename('fooValue'); // WHERE fileName = 'fooValue'
$query->filterByFilename('%fooValue%', Criteria::LIKE); // WHERE fileName LIKE '%fooValue%'
</code>
@param string $filename The value to use as filter.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildMapQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"fileName",
"column"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php#L442-L451 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php | MapQuery.filterByEnvironment | public function filterByEnvironment($environment = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($environment)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_ENVIRONMENT, $environment, $comparison);
} | php | public function filterByEnvironment($environment = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($environment)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_ENVIRONMENT, $environment, $comparison);
} | [
"public",
"function",
"filterByEnvironment",
"(",
"$",
"environment",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"environment",
")",
")",
"{",
"$",... | Filter the query on the environment column
Example usage:
<code>
$query->filterByEnvironment('fooValue'); // WHERE environment = 'fooValue'
$query->filterByEnvironment('%fooValue%', Criteria::LIKE); // WHERE environment LIKE '%fooValue%'
</code>
@param string $environment The value to use as filter.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildMapQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"environment",
"column"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php#L492-L501 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php | MapQuery.filterByMood | public function filterByMood($mood = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($mood)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_MOOD, $mood, $comparison);
} | php | public function filterByMood($mood = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($mood)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_MOOD, $mood, $comparison);
} | [
"public",
"function",
"filterByMood",
"(",
"$",
"mood",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"mood",
")",
")",
"{",
"$",
"comparison",
"=... | Filter the query on the mood column
Example usage:
<code>
$query->filterByMood('fooValue'); // WHERE mood = 'fooValue'
$query->filterByMood('%fooValue%', Criteria::LIKE); // WHERE mood LIKE '%fooValue%'
</code>
@param string $mood The value to use as filter.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildMapQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"mood",
"column"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php#L517-L526 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php | MapQuery.filterByBronzetime | public function filterByBronzetime($bronzetime = null, $comparison = null)
{
if (is_array($bronzetime)) {
$useMinMax = false;
if (isset($bronzetime['min'])) {
$this->addUsingAlias(MapTableMap::COL_BRONZETIME, $bronzetime['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($bronzetime['max'])) {
$this->addUsingAlias(MapTableMap::COL_BRONZETIME, $bronzetime['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_BRONZETIME, $bronzetime, $comparison);
} | php | public function filterByBronzetime($bronzetime = null, $comparison = null)
{
if (is_array($bronzetime)) {
$useMinMax = false;
if (isset($bronzetime['min'])) {
$this->addUsingAlias(MapTableMap::COL_BRONZETIME, $bronzetime['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($bronzetime['max'])) {
$this->addUsingAlias(MapTableMap::COL_BRONZETIME, $bronzetime['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_BRONZETIME, $bronzetime, $comparison);
} | [
"public",
"function",
"filterByBronzetime",
"(",
"$",
"bronzetime",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"bronzetime",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
... | Filter the query on the bronzeTime column
Example usage:
<code>
$query->filterByBronzetime(1234); // WHERE bronzeTime = 1234
$query->filterByBronzetime(array(12, 34)); // WHERE bronzeTime IN (12, 34)
$query->filterByBronzetime(array('min' => 12)); // WHERE bronzeTime > 12
</code>
@param mixed $bronzetime The value to use as filter.
Use scalar values for equality.
Use array values for in_array() equivalent.
Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildMapQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"bronzeTime",
"column"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php#L546-L567 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php | MapQuery.filterBySilvertime | public function filterBySilvertime($silvertime = null, $comparison = null)
{
if (is_array($silvertime)) {
$useMinMax = false;
if (isset($silvertime['min'])) {
$this->addUsingAlias(MapTableMap::COL_SILVERTIME, $silvertime['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($silvertime['max'])) {
$this->addUsingAlias(MapTableMap::COL_SILVERTIME, $silvertime['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_SILVERTIME, $silvertime, $comparison);
} | php | public function filterBySilvertime($silvertime = null, $comparison = null)
{
if (is_array($silvertime)) {
$useMinMax = false;
if (isset($silvertime['min'])) {
$this->addUsingAlias(MapTableMap::COL_SILVERTIME, $silvertime['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($silvertime['max'])) {
$this->addUsingAlias(MapTableMap::COL_SILVERTIME, $silvertime['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_SILVERTIME, $silvertime, $comparison);
} | [
"public",
"function",
"filterBySilvertime",
"(",
"$",
"silvertime",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"silvertime",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
... | Filter the query on the silverTime column
Example usage:
<code>
$query->filterBySilvertime(1234); // WHERE silverTime = 1234
$query->filterBySilvertime(array(12, 34)); // WHERE silverTime IN (12, 34)
$query->filterBySilvertime(array('min' => 12)); // WHERE silverTime > 12
</code>
@param mixed $silvertime The value to use as filter.
Use scalar values for equality.
Use array values for in_array() equivalent.
Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildMapQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"silverTime",
"column"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php#L587-L608 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php | MapQuery.filterByGoldtime | public function filterByGoldtime($goldtime = null, $comparison = null)
{
if (is_array($goldtime)) {
$useMinMax = false;
if (isset($goldtime['min'])) {
$this->addUsingAlias(MapTableMap::COL_GOLDTIME, $goldtime['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($goldtime['max'])) {
$this->addUsingAlias(MapTableMap::COL_GOLDTIME, $goldtime['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_GOLDTIME, $goldtime, $comparison);
} | php | public function filterByGoldtime($goldtime = null, $comparison = null)
{
if (is_array($goldtime)) {
$useMinMax = false;
if (isset($goldtime['min'])) {
$this->addUsingAlias(MapTableMap::COL_GOLDTIME, $goldtime['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($goldtime['max'])) {
$this->addUsingAlias(MapTableMap::COL_GOLDTIME, $goldtime['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_GOLDTIME, $goldtime, $comparison);
} | [
"public",
"function",
"filterByGoldtime",
"(",
"$",
"goldtime",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"goldtime",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",... | Filter the query on the goldTime column
Example usage:
<code>
$query->filterByGoldtime(1234); // WHERE goldTime = 1234
$query->filterByGoldtime(array(12, 34)); // WHERE goldTime IN (12, 34)
$query->filterByGoldtime(array('min' => 12)); // WHERE goldTime > 12
</code>
@param mixed $goldtime The value to use as filter.
Use scalar values for equality.
Use array values for in_array() equivalent.
Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildMapQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"goldTime",
"column"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php#L628-L649 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php | MapQuery.filterByAuthortime | public function filterByAuthortime($authortime = null, $comparison = null)
{
if (is_array($authortime)) {
$useMinMax = false;
if (isset($authortime['min'])) {
$this->addUsingAlias(MapTableMap::COL_AUTHORTIME, $authortime['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($authortime['max'])) {
$this->addUsingAlias(MapTableMap::COL_AUTHORTIME, $authortime['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_AUTHORTIME, $authortime, $comparison);
} | php | public function filterByAuthortime($authortime = null, $comparison = null)
{
if (is_array($authortime)) {
$useMinMax = false;
if (isset($authortime['min'])) {
$this->addUsingAlias(MapTableMap::COL_AUTHORTIME, $authortime['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($authortime['max'])) {
$this->addUsingAlias(MapTableMap::COL_AUTHORTIME, $authortime['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_AUTHORTIME, $authortime, $comparison);
} | [
"public",
"function",
"filterByAuthortime",
"(",
"$",
"authortime",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"authortime",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
... | Filter the query on the authorTime column
Example usage:
<code>
$query->filterByAuthortime(1234); // WHERE authorTime = 1234
$query->filterByAuthortime(array(12, 34)); // WHERE authorTime IN (12, 34)
$query->filterByAuthortime(array('min' => 12)); // WHERE authorTime > 12
</code>
@param mixed $authortime The value to use as filter.
Use scalar values for equality.
Use array values for in_array() equivalent.
Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildMapQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"authorTime",
"column"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php#L669-L690 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php | MapQuery.filterByCopperprice | public function filterByCopperprice($copperprice = null, $comparison = null)
{
if (is_array($copperprice)) {
$useMinMax = false;
if (isset($copperprice['min'])) {
$this->addUsingAlias(MapTableMap::COL_COPPERPRICE, $copperprice['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($copperprice['max'])) {
$this->addUsingAlias(MapTableMap::COL_COPPERPRICE, $copperprice['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_COPPERPRICE, $copperprice, $comparison);
} | php | public function filterByCopperprice($copperprice = null, $comparison = null)
{
if (is_array($copperprice)) {
$useMinMax = false;
if (isset($copperprice['min'])) {
$this->addUsingAlias(MapTableMap::COL_COPPERPRICE, $copperprice['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($copperprice['max'])) {
$this->addUsingAlias(MapTableMap::COL_COPPERPRICE, $copperprice['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_COPPERPRICE, $copperprice, $comparison);
} | [
"public",
"function",
"filterByCopperprice",
"(",
"$",
"copperprice",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"copperprice",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(... | Filter the query on the copperPrice column
Example usage:
<code>
$query->filterByCopperprice(1234); // WHERE copperPrice = 1234
$query->filterByCopperprice(array(12, 34)); // WHERE copperPrice IN (12, 34)
$query->filterByCopperprice(array('min' => 12)); // WHERE copperPrice > 12
</code>
@param mixed $copperprice The value to use as filter.
Use scalar values for equality.
Use array values for in_array() equivalent.
Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildMapQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"copperPrice",
"column"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php#L710-L731 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php | MapQuery.filterByLaprace | public function filterByLaprace($laprace = null, $comparison = null)
{
if (is_string($laprace)) {
$laprace = in_array(strtolower($laprace), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(MapTableMap::COL_LAPRACE, $laprace, $comparison);
} | php | public function filterByLaprace($laprace = null, $comparison = null)
{
if (is_string($laprace)) {
$laprace = in_array(strtolower($laprace), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(MapTableMap::COL_LAPRACE, $laprace, $comparison);
} | [
"public",
"function",
"filterByLaprace",
"(",
"$",
"laprace",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"laprace",
")",
")",
"{",
"$",
"laprace",
"=",
"in_array",
"(",
"strtolower",
"(",
"$",
"laprace... | Filter the query on the lapRace column
Example usage:
<code>
$query->filterByLaprace(true); // WHERE lapRace = true
$query->filterByLaprace('yes'); // WHERE lapRace = true
</code>
@param boolean|string $laprace The value to use as filter.
Non-boolean arguments are converted using the following rules:
* 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* 0, '0', 'false', 'off', and 'no' are converted to boolean false
Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildMapQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"lapRace",
"column"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php#L751-L758 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php | MapQuery.filterByNblaps | public function filterByNblaps($nblaps = null, $comparison = null)
{
if (is_array($nblaps)) {
$useMinMax = false;
if (isset($nblaps['min'])) {
$this->addUsingAlias(MapTableMap::COL_NBLAPS, $nblaps['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($nblaps['max'])) {
$this->addUsingAlias(MapTableMap::COL_NBLAPS, $nblaps['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_NBLAPS, $nblaps, $comparison);
} | php | public function filterByNblaps($nblaps = null, $comparison = null)
{
if (is_array($nblaps)) {
$useMinMax = false;
if (isset($nblaps['min'])) {
$this->addUsingAlias(MapTableMap::COL_NBLAPS, $nblaps['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($nblaps['max'])) {
$this->addUsingAlias(MapTableMap::COL_NBLAPS, $nblaps['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_NBLAPS, $nblaps, $comparison);
} | [
"public",
"function",
"filterByNblaps",
"(",
"$",
"nblaps",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"nblaps",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"nb... | Filter the query on the nbLaps column
Example usage:
<code>
$query->filterByNblaps(1234); // WHERE nbLaps = 1234
$query->filterByNblaps(array(12, 34)); // WHERE nbLaps IN (12, 34)
$query->filterByNblaps(array('min' => 12)); // WHERE nbLaps > 12
</code>
@param mixed $nblaps The value to use as filter.
Use scalar values for equality.
Use array values for in_array() equivalent.
Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildMapQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"nbLaps",
"column"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php#L778-L799 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php | MapQuery.filterByNpcheckpoints | public function filterByNpcheckpoints($npcheckpoints = null, $comparison = null)
{
if (is_array($npcheckpoints)) {
$useMinMax = false;
if (isset($npcheckpoints['min'])) {
$this->addUsingAlias(MapTableMap::COL_NPCHECKPOINTS, $npcheckpoints['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($npcheckpoints['max'])) {
$this->addUsingAlias(MapTableMap::COL_NPCHECKPOINTS, $npcheckpoints['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_NPCHECKPOINTS, $npcheckpoints, $comparison);
} | php | public function filterByNpcheckpoints($npcheckpoints = null, $comparison = null)
{
if (is_array($npcheckpoints)) {
$useMinMax = false;
if (isset($npcheckpoints['min'])) {
$this->addUsingAlias(MapTableMap::COL_NPCHECKPOINTS, $npcheckpoints['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($npcheckpoints['max'])) {
$this->addUsingAlias(MapTableMap::COL_NPCHECKPOINTS, $npcheckpoints['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_NPCHECKPOINTS, $npcheckpoints, $comparison);
} | [
"public",
"function",
"filterByNpcheckpoints",
"(",
"$",
"npcheckpoints",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"npcheckpoints",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset"... | Filter the query on the npCheckpoints column
Example usage:
<code>
$query->filterByNpcheckpoints(1234); // WHERE npCheckpoints = 1234
$query->filterByNpcheckpoints(array(12, 34)); // WHERE npCheckpoints IN (12, 34)
$query->filterByNpcheckpoints(array('min' => 12)); // WHERE npCheckpoints > 12
</code>
@param mixed $npcheckpoints The value to use as filter.
Use scalar values for equality.
Use array values for in_array() equivalent.
Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildMapQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"npCheckpoints",
"column"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php#L819-L840 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php | MapQuery.filterByMapstyle | public function filterByMapstyle($mapstyle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($mapstyle)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_MAPSTYLE, $mapstyle, $comparison);
} | php | public function filterByMapstyle($mapstyle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($mapstyle)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MapTableMap::COL_MAPSTYLE, $mapstyle, $comparison);
} | [
"public",
"function",
"filterByMapstyle",
"(",
"$",
"mapstyle",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"mapstyle",
")",
")",
"{",
"$",
"compa... | Filter the query on the mapStyle column
Example usage:
<code>
$query->filterByMapstyle('fooValue'); // WHERE mapStyle = 'fooValue'
$query->filterByMapstyle('%fooValue%', Criteria::LIKE); // WHERE mapStyle LIKE '%fooValue%'
</code>
@param string $mapstyle The value to use as filter.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildMapQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"mapStyle",
"column"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php#L881-L890 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php | MapQuery.filterByMxmap | public function filterByMxmap($mxmap, $comparison = null)
{
if ($mxmap instanceof \eXpansion\Bundle\Maps\Model\Mxmap) {
return $this
->addUsingAlias(MapTableMap::COL_MAPUID, $mxmap->getTrackuid(), $comparison);
} elseif ($mxmap instanceof ObjectCollection) {
return $this
->useMxmapQuery()
->filterByPrimaryKeys($mxmap->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByMxmap() only accepts arguments of type \eXpansion\Bundle\Maps\Model\Mxmap or Collection');
}
} | php | public function filterByMxmap($mxmap, $comparison = null)
{
if ($mxmap instanceof \eXpansion\Bundle\Maps\Model\Mxmap) {
return $this
->addUsingAlias(MapTableMap::COL_MAPUID, $mxmap->getTrackuid(), $comparison);
} elseif ($mxmap instanceof ObjectCollection) {
return $this
->useMxmapQuery()
->filterByPrimaryKeys($mxmap->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByMxmap() only accepts arguments of type \eXpansion\Bundle\Maps\Model\Mxmap or Collection');
}
} | [
"public",
"function",
"filterByMxmap",
"(",
"$",
"mxmap",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"mxmap",
"instanceof",
"\\",
"eXpansion",
"\\",
"Bundle",
"\\",
"Maps",
"\\",
"Model",
"\\",
"Mxmap",
")",
"{",
"return",
"$",
"thi... | Filter the query by a related \eXpansion\Bundle\Maps\Model\Mxmap object
@param \eXpansion\Bundle\Maps\Model\Mxmap|ObjectCollection $mxmap the related object to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return ChildMapQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"\\",
"eXpansion",
"\\",
"Bundle",
"\\",
"Maps",
"\\",
"Model",
"\\",
"Mxmap",
"object"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php#L986-L999 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php | MapQuery.useMxmapQuery | public function useMxmapQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinMxmap($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Mxmap', '\eXpansion\Bundle\Maps\Model\MxmapQuery');
} | php | public function useMxmapQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinMxmap($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Mxmap', '\eXpansion\Bundle\Maps\Model\MxmapQuery');
} | [
"public",
"function",
"useMxmapQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"INNER_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinMxmap",
"(",
"$",
"relationAlias",
",",
"$",
"joinType",
")",
"->",
"useQu... | Use the Mxmap relation Mxmap object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \eXpansion\Bundle\Maps\Model\MxmapQuery A secondary query class using the current class as primary query | [
"Use",
"the",
"Mxmap",
"relation",
"Mxmap",
"object"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/MapQuery.php#L1044-L1049 | train |
pauci/cqrs | src/HandlerResolver/CommandHandlerResolver.php | CommandHandlerResolver.resolveHandlingMethod | protected function resolveHandlingMethod($commandType)
{
// Remove namespace
$pos = strrpos($commandType, '\\');
if ($pos !== false) {
$commandType = substr($commandType, $pos + 1);
}
// Remove "Command" suffix
if (substr($commandType, -7) === 'Command') {
$commandType = substr($commandType, 0, -7);
}
return lcfirst($commandType);
} | php | protected function resolveHandlingMethod($commandType)
{
// Remove namespace
$pos = strrpos($commandType, '\\');
if ($pos !== false) {
$commandType = substr($commandType, $pos + 1);
}
// Remove "Command" suffix
if (substr($commandType, -7) === 'Command') {
$commandType = substr($commandType, 0, -7);
}
return lcfirst($commandType);
} | [
"protected",
"function",
"resolveHandlingMethod",
"(",
"$",
"commandType",
")",
"{",
"// Remove namespace",
"$",
"pos",
"=",
"strrpos",
"(",
"$",
"commandType",
",",
"'\\\\'",
")",
";",
"if",
"(",
"$",
"pos",
"!==",
"false",
")",
"{",
"$",
"commandType",
"... | Derives command handling method name from event type
@param string $commandType
@return string | [
"Derives",
"command",
"handling",
"method",
"name",
"from",
"event",
"type"
] | 951f2a3118b5f7d93b1e173952490f4a15b8f3fb | https://github.com/pauci/cqrs/blob/951f2a3118b5f7d93b1e173952490f4a15b8f3fb/src/HandlerResolver/CommandHandlerResolver.php#L30-L44 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Util/LogWrapper.php | LogWrapper.getLogger | public static function getLogger($logName = 'default')
{
$filename = new LogConfigFilenameProcessor('log4php');
if (!$filename->Exists())
throw new NotFoundException('Log4php config file not found.');
else
\Logger::configure($filename->FullQualifiedNameAndPath());
return \Logger::getLogger($logName);
} | php | public static function getLogger($logName = 'default')
{
$filename = new LogConfigFilenameProcessor('log4php');
if (!$filename->Exists())
throw new NotFoundException('Log4php config file not found.');
else
\Logger::configure($filename->FullQualifiedNameAndPath());
return \Logger::getLogger($logName);
} | [
"public",
"static",
"function",
"getLogger",
"(",
"$",
"logName",
"=",
"'default'",
")",
"{",
"$",
"filename",
"=",
"new",
"LogConfigFilenameProcessor",
"(",
"'log4php'",
")",
";",
"if",
"(",
"!",
"$",
"filename",
"->",
"Exists",
"(",
")",
")",
"throw",
... | You can use this method if you want specific customizations to the log.
Otherwise you can instantiate this class and use the trace, warn, info, etc methods
@param string $logName
@return \Logger | [
"You",
"can",
"use",
"this",
"method",
"if",
"you",
"want",
"specific",
"customizations",
"to",
"the",
"log",
".",
"Otherwise",
"you",
"can",
"instantiate",
"this",
"class",
"and",
"use",
"the",
"trace",
"warn",
"info",
"etc",
"methods"
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Util/LogWrapper.php#L48-L58 | train |
Malwarebytes/Altamira | src/Altamira/ChartDatum/ChartDatumAbstract.php | ChartDatumAbstract.offsetGet | public function offsetGet ($offset)
{
return isset($this->datumData[$offset]) ? $this->datumData[$offset] : false;
} | php | public function offsetGet ($offset)
{
return isset($this->datumData[$offset]) ? $this->datumData[$offset] : false;
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"datumData",
"[",
"$",
"offset",
"]",
")",
"?",
"$",
"this",
"->",
"datumData",
"[",
"$",
"offset",
"]",
":",
"false",
";",
"}"
] | Returns a value for the provided offset
@see ArrayAccess::offsetGet()
@param string $offset
@return mixed value | [
"Returns",
"a",
"value",
"for",
"the",
"provided",
"offset"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/ChartDatum/ChartDatumAbstract.php#L110-L113 | train |
fontis/customergroupaccess-mage2 | src/AccessCheckFactory.php | AccessCheckFactory.create | public function create(array $data = array())
{
if (!isset($data["configPathPrefix"])) {
$data["configPathPrefix"] = $this->configPathPrefix;
}
return $this->_objectManager->create($this->_instanceName, $data);
} | php | public function create(array $data = array())
{
if (!isset($data["configPathPrefix"])) {
$data["configPathPrefix"] = $this->configPathPrefix;
}
return $this->_objectManager->create($this->_instanceName, $data);
} | [
"public",
"function",
"create",
"(",
"array",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"[",
"\"configPathPrefix\"",
"]",
")",
")",
"{",
"$",
"data",
"[",
"\"configPathPrefix\"",
"]",
"=",
"$",
"this",
... | Create class instance with specified parameters
@param array $data
@return \Fontis\CustomerGroupAccess\AccessCheck | [
"Create",
"class",
"instance",
"with",
"specified",
"parameters"
] | e5d0909961a0503e2f245cb2aebe5956bf78c2af | https://github.com/fontis/customergroupaccess-mage2/blob/e5d0909961a0503e2f245cb2aebe5956bf78c2af/src/AccessCheckFactory.php#L70-L76 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Storage/GameDataStorage.php | GameDataStorage.getServerOs | public function getServerOs()
{
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
return self::OS_WINDOWS;
} else {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'MAC') {
return self::OS_MAC;
} else {
return self::OS_LINUX;
}
}
} | php | public function getServerOs()
{
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
return self::OS_WINDOWS;
} else {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'MAC') {
return self::OS_MAC;
} else {
return self::OS_LINUX;
}
}
} | [
"public",
"function",
"getServerOs",
"(",
")",
"{",
"if",
"(",
"strtoupper",
"(",
"substr",
"(",
"PHP_OS",
",",
"0",
",",
"3",
")",
")",
"===",
"'WIN'",
")",
"{",
"return",
"self",
"::",
"OS_WINDOWS",
";",
"}",
"else",
"{",
"if",
"(",
"strtoupper",
... | Get Operating system.
@return string | [
"Get",
"Operating",
"system",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Storage/GameDataStorage.php#L255-L266 | train |
TheBnl/event-tickets | code/controllers/SummaryController.php | SummaryController.SummaryForm | public function SummaryForm()
{
$summary = new SummaryForm($this, 'SummaryForm', ReservationSession::get());
$summary->setNextStep(CheckoutSteps::nextStep($this->step));
return $summary;
} | php | public function SummaryForm()
{
$summary = new SummaryForm($this, 'SummaryForm', ReservationSession::get());
$summary->setNextStep(CheckoutSteps::nextStep($this->step));
return $summary;
} | [
"public",
"function",
"SummaryForm",
"(",
")",
"{",
"$",
"summary",
"=",
"new",
"SummaryForm",
"(",
"$",
"this",
",",
"'SummaryForm'",
",",
"ReservationSession",
"::",
"get",
"(",
")",
")",
";",
"$",
"summary",
"->",
"setNextStep",
"(",
"CheckoutSteps",
":... | Get the summary form
@return SummaryForm | [
"Get",
"the",
"summary",
"form"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/controllers/SummaryController.php#L29-L34 | train |
honeybee/trellis | src/Common/Collection/Collection.php | Collection.offsetExists | public function offsetExists($offset)
{
if (!is_int($offset) && !is_string($offset)) {
throw new RuntimeException('Invalid array offset type: '. gettype($offset));
}
return array_key_exists($offset, $this->items);
} | php | public function offsetExists($offset)
{
if (!is_int($offset) && !is_string($offset)) {
throw new RuntimeException('Invalid array offset type: '. gettype($offset));
}
return array_key_exists($offset, $this->items);
} | [
"public",
"function",
"offsetExists",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"offset",
")",
"&&",
"!",
"is_string",
"(",
"$",
"offset",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Invalid array offset type: '",
".",... | Tells whether or not an offset exists.
@param mixed $offset
@return boolean
@see http://php.net/manual/en/class.arrayaccess.php | [
"Tells",
"whether",
"or",
"not",
"an",
"offset",
"exists",
"."
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Common/Collection/Collection.php#L69-L75 | train |
honeybee/trellis | src/Common/Collection/Collection.php | Collection.getItems | public function getItems(array $keys = [])
{
$items = [];
foreach ($keys as $key) {
$items[] = $this->offsetGet($key);
}
if (empty($keys)) {
$items = $this->items;
}
return $items;
} | php | public function getItems(array $keys = [])
{
$items = [];
foreach ($keys as $key) {
$items[] = $this->offsetGet($key);
}
if (empty($keys)) {
$items = $this->items;
}
return $items;
} | [
"public",
"function",
"getItems",
"(",
"array",
"$",
"keys",
"=",
"[",
"]",
")",
"{",
"$",
"items",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"$",
"items",
"[",
"]",
"=",
"$",
"this",
"->",
"offsetGet",
"(",
... | Return a list of specific items from the collection for the given keys.
@param array $keys
@return mixed | [
"Return",
"a",
"list",
"of",
"specific",
"items",
"from",
"the",
"collection",
"for",
"the",
"given",
"keys",
"."
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Common/Collection/Collection.php#L180-L191 | train |
honeybee/trellis | src/Common/Collection/Collection.php | Collection.removeItem | public function removeItem($item)
{
$key = $this->getKey($item);
if ($key !== false) {
$this->offsetUnset($key);
}
} | php | public function removeItem($item)
{
$key = $this->getKey($item);
if ($key !== false) {
$this->offsetUnset($key);
}
} | [
"public",
"function",
"removeItem",
"(",
"$",
"item",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getKey",
"(",
"$",
"item",
")",
";",
"if",
"(",
"$",
"key",
"!==",
"false",
")",
"{",
"$",
"this",
"->",
"offsetUnset",
"(",
"$",
"key",
")",
"... | Remove the given item from the collection.
@param mixed $item | [
"Remove",
"the",
"given",
"item",
"from",
"the",
"collection",
"."
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Common/Collection/Collection.php#L198-L204 | train |
honeybee/trellis | src/Common/Collection/Collection.php | Collection.addListener | public function addListener(ListenerInterface $listener)
{
if (!in_array($listener, $this->collection_listeners, true)) {
$this->collection_listeners[] = $listener;
}
} | php | public function addListener(ListenerInterface $listener)
{
if (!in_array($listener, $this->collection_listeners, true)) {
$this->collection_listeners[] = $listener;
}
} | [
"public",
"function",
"addListener",
"(",
"ListenerInterface",
"$",
"listener",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"listener",
",",
"$",
"this",
"->",
"collection_listeners",
",",
"true",
")",
")",
"{",
"$",
"this",
"->",
"collection_listeners",... | Attaches the given listener, so it will be informed about all future changes.
@param ListenerInterface $listener | [
"Attaches",
"the",
"given",
"listener",
"so",
"it",
"will",
"be",
"informed",
"about",
"all",
"future",
"changes",
"."
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Common/Collection/Collection.php#L291-L296 | train |
honeybee/trellis | src/Common/Collection/Collection.php | Collection.removeListener | public function removeListener(ListenerInterface $listener)
{
if (false !== ($pos = array_search($listener, $this->collection_listeners, true))) {
array_splice($this->collection_listeners, $pos, 1);
}
} | php | public function removeListener(ListenerInterface $listener)
{
if (false !== ($pos = array_search($listener, $this->collection_listeners, true))) {
array_splice($this->collection_listeners, $pos, 1);
}
} | [
"public",
"function",
"removeListener",
"(",
"ListenerInterface",
"$",
"listener",
")",
"{",
"if",
"(",
"false",
"!==",
"(",
"$",
"pos",
"=",
"array_search",
"(",
"$",
"listener",
",",
"$",
"this",
"->",
"collection_listeners",
",",
"true",
")",
")",
")",
... | Removes the given listener from our list of collection-changed listeners.
@param ListenerInterface $listener | [
"Removes",
"the",
"given",
"listener",
"from",
"our",
"list",
"of",
"collection",
"-",
"changed",
"listeners",
"."
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Common/Collection/Collection.php#L303-L308 | train |
honeybee/trellis | src/Common/Collection/Collection.php | Collection.toArray | public function toArray()
{
$data = [];
foreach ($this->items as $key => $value) {
if ($value instanceof BaseObjectInterface) {
$value = $value->toArray();
}
$data[$key] = $value;
}
return $data;
} | php | public function toArray()
{
$data = [];
foreach ($this->items as $key => $value) {
if ($value instanceof BaseObjectInterface) {
$value = $value->toArray();
}
$data[$key] = $value;
}
return $data;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"BaseObjectInterface",
")",
"{",
"$"... | Returns the collection's underlying array.
@return array | [
"Returns",
"the",
"collection",
"s",
"underlying",
"array",
"."
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Common/Collection/Collection.php#L315-L326 | train |
honeybee/trellis | src/Common/Collection/Collection.php | Collection.propagateCollectionChangedEvent | protected function propagateCollectionChangedEvent(CollectionChangedEvent $event)
{
foreach ($this->collection_listeners as $listener) {
$listener->onCollectionChanged($event);
}
} | php | protected function propagateCollectionChangedEvent(CollectionChangedEvent $event)
{
foreach ($this->collection_listeners as $listener) {
$listener->onCollectionChanged($event);
}
} | [
"protected",
"function",
"propagateCollectionChangedEvent",
"(",
"CollectionChangedEvent",
"$",
"event",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"collection_listeners",
"as",
"$",
"listener",
")",
"{",
"$",
"listener",
"->",
"onCollectionChanged",
"(",
"$",
"... | Propagate the given collection-changed event to all currently attached listeners. | [
"Propagate",
"the",
"given",
"collection",
"-",
"changed",
"event",
"to",
"all",
"currently",
"attached",
"listeners",
"."
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Common/Collection/Collection.php#L331-L336 | train |
mgallegos/decima-accounting | src/Mgallegos/DecimaAccounting/Accounting/Repositories/JournalVoucher/EloquentJournalVoucherGridRepository.php | EloquentJournalVoucherGridRepository.numToLetter | protected function numToLetter($num, $uppercase = FALSE)
{
$num -= 1;
$letter = chr(($num % 26) + 97);
$letter .= (floor($num/26) > 0) ? str_repeat($letter, floor($num/26)) : '';
return ($uppercase ? strtoupper($letter) : $letter);
} | php | protected function numToLetter($num, $uppercase = FALSE)
{
$num -= 1;
$letter = chr(($num % 26) + 97);
$letter .= (floor($num/26) > 0) ? str_repeat($letter, floor($num/26)) : '';
return ($uppercase ? strtoupper($letter) : $letter);
} | [
"protected",
"function",
"numToLetter",
"(",
"$",
"num",
",",
"$",
"uppercase",
"=",
"FALSE",
")",
"{",
"$",
"num",
"-=",
"1",
";",
"$",
"letter",
"=",
"chr",
"(",
"(",
"$",
"num",
"%",
"26",
")",
"+",
"97",
")",
";",
"$",
"letter",
".=",
"(",
... | Takes a number and converts it to a-z,aa-zz,aaa-zzz, etc with uppercase option
@access protected
@param int number to convert
@param bool upper case the letter on return?
@return string letters from number input | [
"Takes",
"a",
"number",
"and",
"converts",
"it",
"to",
"a",
"-",
"z",
"aa",
"-",
"zz",
"aaa",
"-",
"zzz",
"etc",
"with",
"uppercase",
"option"
] | 6410585303a13892e64e9dfeacbae0ca212b458b | https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Repositories/JournalVoucher/EloquentJournalVoucherGridRepository.php#L646-L653 | train |
mgallegos/decima-accounting | src/Mgallegos/DecimaAccounting/Accounting/Repositories/JournalVoucher/EloquentJournalVoucherGridRepository.php | EloquentJournalVoucherGridRepository.utf8ize | protected function utf8ize($mixed)
{
if (is_array($mixed))
{
foreach ($mixed as $key => $value)
{
$mixed[$key] = self::utf8ize($value);
}
}
else if (is_string ($mixed))
{
return utf8_encode($mixed);
}
return $mixed;
} | php | protected function utf8ize($mixed)
{
if (is_array($mixed))
{
foreach ($mixed as $key => $value)
{
$mixed[$key] = self::utf8ize($value);
}
}
else if (is_string ($mixed))
{
return utf8_encode($mixed);
}
return $mixed;
} | [
"protected",
"function",
"utf8ize",
"(",
"$",
"mixed",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"mixed",
")",
")",
"{",
"foreach",
"(",
"$",
"mixed",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"mixed",
"[",
"$",
"key",
"]",
"=",
"se... | Clean the array passed in from UTF8 chars.
Lifted from http://stackoverflow.com/questions/10199017/how-to-solve-json-error-utf8-error-in-php-json-decode
Based on: http://php.net/manual/en/function.json-last-error.php#115980
@param $mixed
@return array|string | [
"Clean",
"the",
"array",
"passed",
"in",
"from",
"UTF8",
"chars",
"."
] | 6410585303a13892e64e9dfeacbae0ca212b458b | https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Repositories/JournalVoucher/EloquentJournalVoucherGridRepository.php#L664-L679 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Core/Net/OAuthClient20.php | OAuthClient20.handle | public function handle()
{
// Get Var Elements
$accessToken = $this->getAccessToken();
$state = $this->getVar("state");
// Initiate OAuth Client with Specific server configuration
$to = new $this->_className();
// Try to Handle the Authentication Process
if ($accessToken == "")
{
$code = $this->_context->get("code");
// If not received the "Code" Parameter, initiate the autorization request
if ($code == "")
{
$state = md5(uniqid(rand(), TRUE)); //CSRF protection
$this->setVar("state", $state);
$params = array(
"client_id" => $this->_client_id,
"redirect_uri" => $this->_redirect_uri,
"state" => $state,
"scope" => $this->_scope
);
if (count($this->_extraArgs) > 0)
{
$params = array_merge($params, $this->_extraArgs);
}
$req = new WebRequest($to->authorizationURL());
$req->redirect($params, $this->_window_top);
}
// Request the Access Token
if ($this->_context->get("state") == $this->getVar("state"))
{
$params = array(
"client_id" => $this->_client_id,
"redirect_uri" => $this->_redirect_uri,
"client_secret" => $this->_client_secret,
"code" => $code,
"grant_type" => "authorization_code"
);
$req = new WebRequest($to->accessTokenURL());
$result = $req->post($params);
$accessToken = $to->decodeAccessToken($result);
$this->setVar("access_token", $accessToken);
$to->setAccessToken($accessToken);
$this->saveAccessToken();
if ($this->_app_uri != "")
{
$req = new WebRequest($this->_app_uri);
$response = $req->redirect();
}
}
}
else
{
$to->setAccessToken($this->getVar('access_token'));
}
return $to;
} | php | public function handle()
{
// Get Var Elements
$accessToken = $this->getAccessToken();
$state = $this->getVar("state");
// Initiate OAuth Client with Specific server configuration
$to = new $this->_className();
// Try to Handle the Authentication Process
if ($accessToken == "")
{
$code = $this->_context->get("code");
// If not received the "Code" Parameter, initiate the autorization request
if ($code == "")
{
$state = md5(uniqid(rand(), TRUE)); //CSRF protection
$this->setVar("state", $state);
$params = array(
"client_id" => $this->_client_id,
"redirect_uri" => $this->_redirect_uri,
"state" => $state,
"scope" => $this->_scope
);
if (count($this->_extraArgs) > 0)
{
$params = array_merge($params, $this->_extraArgs);
}
$req = new WebRequest($to->authorizationURL());
$req->redirect($params, $this->_window_top);
}
// Request the Access Token
if ($this->_context->get("state") == $this->getVar("state"))
{
$params = array(
"client_id" => $this->_client_id,
"redirect_uri" => $this->_redirect_uri,
"client_secret" => $this->_client_secret,
"code" => $code,
"grant_type" => "authorization_code"
);
$req = new WebRequest($to->accessTokenURL());
$result = $req->post($params);
$accessToken = $to->decodeAccessToken($result);
$this->setVar("access_token", $accessToken);
$to->setAccessToken($accessToken);
$this->saveAccessToken();
if ($this->_app_uri != "")
{
$req = new WebRequest($this->_app_uri);
$response = $req->redirect();
}
}
}
else
{
$to->setAccessToken($this->getVar('access_token'));
}
return $to;
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"// Get Var Elements",
"$",
"accessToken",
"=",
"$",
"this",
"->",
"getAccessToken",
"(",
")",
";",
"$",
"state",
"=",
"$",
"this",
"->",
"getVar",
"(",
"\"state\"",
")",
";",
"// Initiate OAuth Client with Specif... | Handle OAuth 2.0 Flow
@return BaseOAuth20 | [
"Handle",
"OAuth",
"2",
".",
"0",
"Flow"
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Net/OAuthClient20.php#L190-L262 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Services/ChatCommands.php | ChatCommands.registerPlugin | public function registerPlugin($pluginId, ChatCommandPluginInterface $pluginService)
{
$commands = $pluginService->getChatCommands();
foreach ($commands as $command) {
$this->addCommand($pluginId, $command->getCommand(), $command);
foreach ($command->getAliases() as $alias) {
$this->addCommand($pluginId, $alias, $command);
}
}
} | php | public function registerPlugin($pluginId, ChatCommandPluginInterface $pluginService)
{
$commands = $pluginService->getChatCommands();
foreach ($commands as $command) {
$this->addCommand($pluginId, $command->getCommand(), $command);
foreach ($command->getAliases() as $alias) {
$this->addCommand($pluginId, $alias, $command);
}
}
} | [
"public",
"function",
"registerPlugin",
"(",
"$",
"pluginId",
",",
"ChatCommandPluginInterface",
"$",
"pluginService",
")",
"{",
"$",
"commands",
"=",
"$",
"pluginService",
"->",
"getChatCommands",
"(",
")",
";",
"foreach",
"(",
"$",
"commands",
"as",
"$",
"co... | Registers all chat commands of a plugin.
@param string $pluginId
@param ChatCommandPluginInterface $pluginService
@throws CommandExistException | [
"Registers",
"all",
"chat",
"commands",
"of",
"a",
"plugin",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Services/ChatCommands.php#L45-L56 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Services/ChatCommands.php | ChatCommands.deletePlugin | public function deletePlugin($pluginId)
{
if (!isset($this->commandPlugin[$pluginId])) {
return;
}
foreach ($this->commandPlugin[$pluginId] as $cmdTxt => $command) {
unset($this->commands[$cmdTxt]);
}
unset($this->commandPlugin[$pluginId]);
} | php | public function deletePlugin($pluginId)
{
if (!isset($this->commandPlugin[$pluginId])) {
return;
}
foreach ($this->commandPlugin[$pluginId] as $cmdTxt => $command) {
unset($this->commands[$cmdTxt]);
}
unset($this->commandPlugin[$pluginId]);
} | [
"public",
"function",
"deletePlugin",
"(",
"$",
"pluginId",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"commandPlugin",
"[",
"$",
"pluginId",
"]",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"commandPlugin",
... | Remove all chat commands registered for a plugin.
@param $pluginId | [
"Remove",
"all",
"chat",
"commands",
"registered",
"for",
"a",
"plugin",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Services/ChatCommands.php#L63-L73 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Services/ChatCommands.php | ChatCommands.getChatCommands | public function getChatCommands()
{
$chatCommands = [];
foreach ($this->commands as $chatCommand => $data) {
$chatCommands[$data->getCommand()] = clone $data;
}
return $chatCommands;
} | php | public function getChatCommands()
{
$chatCommands = [];
foreach ($this->commands as $chatCommand => $data) {
$chatCommands[$data->getCommand()] = clone $data;
}
return $chatCommands;
} | [
"public",
"function",
"getChatCommands",
"(",
")",
"{",
"$",
"chatCommands",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"commands",
"as",
"$",
"chatCommand",
"=>",
"$",
"data",
")",
"{",
"$",
"chatCommands",
"[",
"$",
"data",
"->",
"getComm... | Get list of all chat commands.
return array | [
"Get",
"list",
"of",
"all",
"chat",
"commands",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Services/ChatCommands.php#L91-L99 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Services/ChatCommands.php | ChatCommands.findChatCommand | protected function findChatCommand($cmdAndArgs, $depth, $orig = null)
{
if ($depth == 0) {
return [null, []];
}
if ($orig == null) {
$orig = $cmdAndArgs;
}
$cmdAndArgs = array_splice($cmdAndArgs, 0, $depth);
$parameters = array_diff($orig, $cmdAndArgs);
$command = implode(' ', $cmdAndArgs);
return isset($this->commands[$command])
? [$this->commands[$command], $parameters]
: $this->findChatCommand($cmdAndArgs, $depth - 1, $orig);
} | php | protected function findChatCommand($cmdAndArgs, $depth, $orig = null)
{
if ($depth == 0) {
return [null, []];
}
if ($orig == null) {
$orig = $cmdAndArgs;
}
$cmdAndArgs = array_splice($cmdAndArgs, 0, $depth);
$parameters = array_diff($orig, $cmdAndArgs);
$command = implode(' ', $cmdAndArgs);
return isset($this->commands[$command])
? [$this->commands[$command], $parameters]
: $this->findChatCommand($cmdAndArgs, $depth - 1, $orig);
} | [
"protected",
"function",
"findChatCommand",
"(",
"$",
"cmdAndArgs",
",",
"$",
"depth",
",",
"$",
"orig",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"depth",
"==",
"0",
")",
"{",
"return",
"[",
"null",
",",
"[",
"]",
"]",
";",
"}",
"if",
"(",
"$",
"... | Find a chat command.
@param string[] $cmdAndArgs
@param integer $depth
@return mixed | [
"Find",
"a",
"chat",
"command",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Services/ChatCommands.php#L109-L126 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Services/ChatCommands.php | ChatCommands.addCommand | protected function addCommand($pluginId, $cmdTxt, ChatCommandInterface $command)
{
if (isset($this->commands[$cmdTxt])) {
throw new CommandExistException(
"$pluginId tries to register command '$cmdTxt' already registered"
);
}
$this->commands[$cmdTxt] = $command;
$this->commandPlugin[$pluginId][$cmdTxt] = $command;
} | php | protected function addCommand($pluginId, $cmdTxt, ChatCommandInterface $command)
{
if (isset($this->commands[$cmdTxt])) {
throw new CommandExistException(
"$pluginId tries to register command '$cmdTxt' already registered"
);
}
$this->commands[$cmdTxt] = $command;
$this->commandPlugin[$pluginId][$cmdTxt] = $command;
} | [
"protected",
"function",
"addCommand",
"(",
"$",
"pluginId",
",",
"$",
"cmdTxt",
",",
"ChatCommandInterface",
"$",
"command",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"commands",
"[",
"$",
"cmdTxt",
"]",
")",
")",
"{",
"throw",
"new",
"Com... | Register a command.
@param string $pluginId
@param string $cmdTxt
@param ChatCommandInterface $command
@throws CommandExistException | [
"Register",
"a",
"command",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Services/ChatCommands.php#L137-L147 | train |
anklimsk/cakephp-theme | View/Helper/CakeThemeAppHelper.php | CakeThemeAppHelper._getOptionsForElem | protected function _getOptionsForElem($path = null) {
if (empty($path)) {
return null;
}
$result = Hash::get($this->_optionsForElem, $path);
return $result;
} | php | protected function _getOptionsForElem($path = null) {
if (empty($path)) {
return null;
}
$result = Hash::get($this->_optionsForElem, $path);
return $result;
} | [
"protected",
"function",
"_getOptionsForElem",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"path",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"result",
"=",
"Hash",
"::",
"get",
"(",
"$",
"this",
"->",
"_optionsForElem... | Return default options by path.
@param string $path Path to retrieve options
@return mixed Return default options by path. | [
"Return",
"default",
"options",
"by",
"path",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/CakeThemeAppHelper.php#L68-L75 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Menu/Plugins/Menu.php | Menu.displayMenu | protected function displayMenu()
{
foreach ($this->adminGroups->getUserGroups() as $userGroup) {
$this->menuGuiFactory->create($userGroup);
}
} | php | protected function displayMenu()
{
foreach ($this->adminGroups->getUserGroups() as $userGroup) {
$this->menuGuiFactory->create($userGroup);
}
} | [
"protected",
"function",
"displayMenu",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"adminGroups",
"->",
"getUserGroups",
"(",
")",
"as",
"$",
"userGroup",
")",
"{",
"$",
"this",
"->",
"menuGuiFactory",
"->",
"create",
"(",
"$",
"userGroup",
")",
"... | Display a menu for each user group | [
"Display",
"a",
"menu",
"for",
"each",
"user",
"group"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Menu/Plugins/Menu.php#L63-L68 | train |
anklimsk/cakephp-theme | Model/Behavior/BreadCrumbBehavior.php | BreadCrumbBehavior.getModelName | public function getModelName(Model $model, $toLowerCase = false) {
$modelName = $model->name;
if ($toLowerCase) {
$modelName = mb_strtolower($modelName);
}
return $modelName;
} | php | public function getModelName(Model $model, $toLowerCase = false) {
$modelName = $model->name;
if ($toLowerCase) {
$modelName = mb_strtolower($modelName);
}
return $modelName;
} | [
"public",
"function",
"getModelName",
"(",
"Model",
"$",
"model",
",",
"$",
"toLowerCase",
"=",
"false",
")",
"{",
"$",
"modelName",
"=",
"$",
"model",
"->",
"name",
";",
"if",
"(",
"$",
"toLowerCase",
")",
"{",
"$",
"modelName",
"=",
"mb_strtolower",
... | Return name of model that uses this behavior.
@param Model $model Model using this behavior.
@param bool $toLowerCase If True, return the model name in lowercase.
@return string Return name of model that uses this behavior. | [
"Return",
"name",
"of",
"model",
"that",
"uses",
"this",
"behavior",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Model/Behavior/BreadCrumbBehavior.php#L30-L37 | train |
anklimsk/cakephp-theme | Model/Behavior/BreadCrumbBehavior.php | BreadCrumbBehavior.getModelNamePlural | public function getModelNamePlural(Model $model, $toLowerCase = false) {
$modelName = $this->getModelName($model, $toLowerCase);
return Inflector::pluralize($modelName);
} | php | public function getModelNamePlural(Model $model, $toLowerCase = false) {
$modelName = $this->getModelName($model, $toLowerCase);
return Inflector::pluralize($modelName);
} | [
"public",
"function",
"getModelNamePlural",
"(",
"Model",
"$",
"model",
",",
"$",
"toLowerCase",
"=",
"false",
")",
"{",
"$",
"modelName",
"=",
"$",
"this",
"->",
"getModelName",
"(",
"$",
"model",
",",
"$",
"toLowerCase",
")",
";",
"return",
"Inflector",
... | Return plural name of model that uses this behavior.
@param Model $model Model using this behavior.
@param bool $toLowerCase If True, return the model name in lowercase.
@return string Return plural name of model that uses this behavior. | [
"Return",
"plural",
"name",
"of",
"model",
"that",
"uses",
"this",
"behavior",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Model/Behavior/BreadCrumbBehavior.php#L46-L50 | train |
anklimsk/cakephp-theme | Model/Behavior/BreadCrumbBehavior.php | BreadCrumbBehavior.getControllerName | public function getControllerName(Model $model) {
$modelNamePlural = $this->getModelNamePlural($model, false);
$controllerName = mb_strtolower(Inflector::underscore($modelNamePlural));
return $controllerName;
} | php | public function getControllerName(Model $model) {
$modelNamePlural = $this->getModelNamePlural($model, false);
$controllerName = mb_strtolower(Inflector::underscore($modelNamePlural));
return $controllerName;
} | [
"public",
"function",
"getControllerName",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"modelNamePlural",
"=",
"$",
"this",
"->",
"getModelNamePlural",
"(",
"$",
"model",
",",
"false",
")",
";",
"$",
"controllerName",
"=",
"mb_strtolower",
"(",
"Inflector",
"... | Return controller name.
@param Model $model Model using this behavior.
@return string Return controller name for breadcrumb. | [
"Return",
"controller",
"name",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Model/Behavior/BreadCrumbBehavior.php#L70-L75 | train |
anklimsk/cakephp-theme | Model/Behavior/BreadCrumbBehavior.php | BreadCrumbBehavior.getGroupName | public function getGroupName(Model $model) {
$modelNamePlural = $this->getModelNamePlural($model);
$groupNameCamel = Inflector::humanize(Inflector::underscore($modelNamePlural));
$groupName = mb_ucfirst(mb_strtolower($groupNameCamel));
return $groupName;
} | php | public function getGroupName(Model $model) {
$modelNamePlural = $this->getModelNamePlural($model);
$groupNameCamel = Inflector::humanize(Inflector::underscore($modelNamePlural));
$groupName = mb_ucfirst(mb_strtolower($groupNameCamel));
return $groupName;
} | [
"public",
"function",
"getGroupName",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"modelNamePlural",
"=",
"$",
"this",
"->",
"getModelNamePlural",
"(",
"$",
"model",
")",
";",
"$",
"groupNameCamel",
"=",
"Inflector",
"::",
"humanize",
"(",
"Inflector",
"::",
... | Return name of group data.
@param Model $model Model using this behavior.
@return string Return name of group data | [
"Return",
"name",
"of",
"group",
"data",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Model/Behavior/BreadCrumbBehavior.php#L95-L101 | train |
anklimsk/cakephp-theme | Model/Behavior/BreadCrumbBehavior.php | BreadCrumbBehavior.getName | public function getName(Model $model, $id = null) {
if (empty($id) || empty($model->displayField)) {
return false;
}
if (is_array($id)) {
if (!isset($id[$model->alias][$model->displayField])) {
return false;
}
$result = $id[$model->alias][$model->displayField];
} else {
$model->id = $id;
$result = $model->field($model->displayField);
}
return $result;
} | php | public function getName(Model $model, $id = null) {
if (empty($id) || empty($model->displayField)) {
return false;
}
if (is_array($id)) {
if (!isset($id[$model->alias][$model->displayField])) {
return false;
}
$result = $id[$model->alias][$model->displayField];
} else {
$model->id = $id;
$result = $model->field($model->displayField);
}
return $result;
} | [
"public",
"function",
"getName",
"(",
"Model",
"$",
"model",
",",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"id",
")",
"||",
"empty",
"(",
"$",
"model",
"->",
"displayField",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",... | Return name of data.
@param Model $model Model using this behavior.
@param int|string|array $id ID of record or array data
for retrieving name.
@return string|bool Return name of data,
or False on failure. | [
"Return",
"name",
"of",
"data",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Model/Behavior/BreadCrumbBehavior.php#L112-L128 | train |
anklimsk/cakephp-theme | Model/Behavior/BreadCrumbBehavior.php | BreadCrumbBehavior.getFullName | public function getFullName(Model $model, $id = null) {
$name = $this->getName($model, $id);
if (empty($name)) {
return false;
}
$modelName = $this->getModelName($model);
$result = $modelName . ' \'' . $name . '\'';
return $result;
} | php | public function getFullName(Model $model, $id = null) {
$name = $this->getName($model, $id);
if (empty($name)) {
return false;
}
$modelName = $this->getModelName($model);
$result = $modelName . ' \'' . $name . '\'';
return $result;
} | [
"public",
"function",
"getFullName",
"(",
"Model",
"$",
"model",
",",
"$",
"id",
"=",
"null",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getName",
"(",
"$",
"model",
",",
"$",
"id",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",... | Return full name of data.
@param Model $model Model using this behavior.
@param int|string|array $id ID of record or array data
for retrieving full name.
@return string|bool Return full name of data,
or False on failure. | [
"Return",
"full",
"name",
"of",
"data",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Model/Behavior/BreadCrumbBehavior.php#L139-L149 | train |
anklimsk/cakephp-theme | Model/Behavior/BreadCrumbBehavior.php | BreadCrumbBehavior.createBreadcrumb | public function createBreadcrumb(Model $model, $id = null, $link = null, $escape = true) {
$result = [];
if (empty($id)) {
$name = $model->getGroupName();
} else {
$name = $model->getName($id);
}
if (empty($name)) {
return $result;
}
if ($escape) {
$name = h($name);
}
if ($link === false) {
$link = null;
} else {
if (!is_array($link)) {
$link = [];
}
$plugin = $model->getPluginName();
$controller = $model->getControllerName();
if (empty($id)) {
$action = 'index';
} else {
$action = $model->getActionName();
if (empty($link)) {
$link[] = $id;
}
}
$link += compact('plugin', 'controller', 'action');
}
$name = CakeText::truncate($name, CAKE_THEME_BREADCRUMBS_TEXT_LIMIT);
$result = [
$name,
$link
];
return $result;
} | php | public function createBreadcrumb(Model $model, $id = null, $link = null, $escape = true) {
$result = [];
if (empty($id)) {
$name = $model->getGroupName();
} else {
$name = $model->getName($id);
}
if (empty($name)) {
return $result;
}
if ($escape) {
$name = h($name);
}
if ($link === false) {
$link = null;
} else {
if (!is_array($link)) {
$link = [];
}
$plugin = $model->getPluginName();
$controller = $model->getControllerName();
if (empty($id)) {
$action = 'index';
} else {
$action = $model->getActionName();
if (empty($link)) {
$link[] = $id;
}
}
$link += compact('plugin', 'controller', 'action');
}
$name = CakeText::truncate($name, CAKE_THEME_BREADCRUMBS_TEXT_LIMIT);
$result = [
$name,
$link
];
return $result;
} | [
"public",
"function",
"createBreadcrumb",
"(",
"Model",
"$",
"model",
",",
"$",
"id",
"=",
"null",
",",
"$",
"link",
"=",
"null",
",",
"$",
"escape",
"=",
"true",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"id",
... | Return an array of information for creating a breadcrumb.
@param Model $model Model using this behavior.
@param int|string|array $id ID of record or array data
for retrieving name.
@param array|bool|null $link URL for breadcrumb or False to disable auto creation.
@param bool $escape Escape conversion HTML special characters to HTML entities.
@return array Return an array of information for creating a breadcrumb. | [
"Return",
"an",
"array",
"of",
"information",
"for",
"creating",
"a",
"breadcrumb",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Model/Behavior/BreadCrumbBehavior.php#L161-L201 | train |
anklimsk/cakephp-theme | Model/Behavior/BreadCrumbBehavior.php | BreadCrumbBehavior.getBreadcrumbInfo | public function getBreadcrumbInfo(Model $model, $id = null, $includeRoot = null) {
if (!empty($id) && ($includeRoot === null)) {
$includeRoot = true;
}
$result = [];
$root = [];
if ($includeRoot) {
$root = $model->getBreadcrumbInfo();
if (empty($root)) {
return $result;
}
}
$info = $model->createBreadcrumb($id);
if (empty($info)) {
return $result;
}
if (!empty($root)) {
$result = $root;
}
$result[] = $info;
return $result;
} | php | public function getBreadcrumbInfo(Model $model, $id = null, $includeRoot = null) {
if (!empty($id) && ($includeRoot === null)) {
$includeRoot = true;
}
$result = [];
$root = [];
if ($includeRoot) {
$root = $model->getBreadcrumbInfo();
if (empty($root)) {
return $result;
}
}
$info = $model->createBreadcrumb($id);
if (empty($info)) {
return $result;
}
if (!empty($root)) {
$result = $root;
}
$result[] = $info;
return $result;
} | [
"public",
"function",
"getBreadcrumbInfo",
"(",
"Model",
"$",
"model",
",",
"$",
"id",
"=",
"null",
",",
"$",
"includeRoot",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"id",
")",
"&&",
"(",
"$",
"includeRoot",
"===",
"null",
")",
")"... | Return an array of information for creating a breadcrumbs.
@param Model $model Model using this behavior.
@param int|string|array $id ID of record or array data
for retrieving name.
@param bool|null $includeRoot If True, include information of root breadcrumb.
If Null, include information of root breadcrumb if $ID is not empty.
@return array Return an array of information for creating a breadcrumbs. | [
"Return",
"an",
"array",
"of",
"information",
"for",
"creating",
"a",
"breadcrumbs",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Model/Behavior/BreadCrumbBehavior.php#L213-L238 | train |
k-gun/oppa | src/Query/Result/Result.php | Result.detectFetchType | public final function detectFetchType($fetchType): int
{
switch (gettype($fetchType)) {
case 'NULL':
return ResultInterface::AS_OBJECT;
case 'integer':
if (in_array($fetchType, [ResultInterface::AS_OBJECT, ResultInterface::AS_ARRAY_ASC,
ResultInterface::AS_ARRAY_NUM, ResultInterface::AS_ARRAY_ASCNUM])) {
return $fetchType;
}
break;
case 'string':
// shorthands
if ($fetchType == 'array') return ResultInterface::AS_ARRAY_ASC;
if ($fetchType == 'object') return ResultInterface::AS_OBJECT;
// object, array_asc etc.
$fetchTypeConst = 'Oppa\Query\Result\ResultInterface::AS_'. strtoupper($fetchType);
if (defined($fetchTypeConst)) {
return constant($fetchTypeConst);
}
// user classes
if (class_exists($fetchType)) {
$this->setFetchObject($fetchType);
return ResultInterface::AS_OBJECT;
}
break;
}
throw new InvalidValueException("Given '{$fetchType}' fetch type is not implemented!");
} | php | public final function detectFetchType($fetchType): int
{
switch (gettype($fetchType)) {
case 'NULL':
return ResultInterface::AS_OBJECT;
case 'integer':
if (in_array($fetchType, [ResultInterface::AS_OBJECT, ResultInterface::AS_ARRAY_ASC,
ResultInterface::AS_ARRAY_NUM, ResultInterface::AS_ARRAY_ASCNUM])) {
return $fetchType;
}
break;
case 'string':
// shorthands
if ($fetchType == 'array') return ResultInterface::AS_ARRAY_ASC;
if ($fetchType == 'object') return ResultInterface::AS_OBJECT;
// object, array_asc etc.
$fetchTypeConst = 'Oppa\Query\Result\ResultInterface::AS_'. strtoupper($fetchType);
if (defined($fetchTypeConst)) {
return constant($fetchTypeConst);
}
// user classes
if (class_exists($fetchType)) {
$this->setFetchObject($fetchType);
return ResultInterface::AS_OBJECT;
}
break;
}
throw new InvalidValueException("Given '{$fetchType}' fetch type is not implemented!");
} | [
"public",
"final",
"function",
"detectFetchType",
"(",
"$",
"fetchType",
")",
":",
"int",
"{",
"switch",
"(",
"gettype",
"(",
"$",
"fetchType",
")",
")",
"{",
"case",
"'NULL'",
":",
"return",
"ResultInterface",
"::",
"AS_OBJECT",
";",
"case",
"'integer'",
... | Detect fetch type.
@param int|string $fetchType
@return int
@throws Oppa\Exception\InvalidValueException | [
"Detect",
"fetch",
"type",
"."
] | 3a20b5cc85cb3899c41737678798ec3de73a3836 | https://github.com/k-gun/oppa/blob/3a20b5cc85cb3899c41737678798ec3de73a3836/src/Query/Result/Result.php#L150-L182 | train |
k-gun/oppa | src/Query/Result/Result.php | Result.setFetchObject | public final function setFetchObject(string $fetchObject): void
{
if (!class_exists($fetchObject)) {
throw new InvalidValueException("Fetch object class '{$fetchObject}' not found!");
}
$this->fetchObject = $fetchObject;
} | php | public final function setFetchObject(string $fetchObject): void
{
if (!class_exists($fetchObject)) {
throw new InvalidValueException("Fetch object class '{$fetchObject}' not found!");
}
$this->fetchObject = $fetchObject;
} | [
"public",
"final",
"function",
"setFetchObject",
"(",
"string",
"$",
"fetchObject",
")",
":",
"void",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"fetchObject",
")",
")",
"{",
"throw",
"new",
"InvalidValueException",
"(",
"\"Fetch object class '{$fetchObject}' ... | Set fetch object.
@param string $fetchObject
@return void
@throws Oppa\Exception\InvalidValueException | [
"Set",
"fetch",
"object",
"."
] | 3a20b5cc85cb3899c41737678798ec3de73a3836 | https://github.com/k-gun/oppa/blob/3a20b5cc85cb3899c41737678798ec3de73a3836/src/Query/Result/Result.php#L228-L235 | train |
k-gun/oppa | src/Query/Result/Result.php | Result.setIds | public final function setIds(array $ids): void
{
foreach ($ids as $id) {
$this->ids[] = (int) $id;
}
} | php | public final function setIds(array $ids): void
{
foreach ($ids as $id) {
$this->ids[] = (int) $id;
}
} | [
"public",
"final",
"function",
"setIds",
"(",
"array",
"$",
"ids",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"ids",
"as",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"ids",
"[",
"]",
"=",
"(",
"int",
")",
"$",
"id",
";",
"}",
"}"
] | Set ids.
@param array $ids
@return void | [
"Set",
"ids",
"."
] | 3a20b5cc85cb3899c41737678798ec3de73a3836 | https://github.com/k-gun/oppa/blob/3a20b5cc85cb3899c41737678798ec3de73a3836/src/Query/Result/Result.php#L271-L276 | train |
k-gun/oppa | src/Query/Result/Result.php | Result.toObject | public final function toObject(): ?array
{
$data = null;
if (!empty($this->data)) {
// no need to type-cast
if (is_object($this->data[0])) {
return $this->data;
}
$data = $this->data;
foreach ($data as &$dat) {
$dat = (object) $dat;
}
}
return $data;
} | php | public final function toObject(): ?array
{
$data = null;
if (!empty($this->data)) {
// no need to type-cast
if (is_object($this->data[0])) {
return $this->data;
}
$data = $this->data;
foreach ($data as &$dat) {
$dat = (object) $dat;
}
}
return $data;
} | [
"public",
"final",
"function",
"toObject",
"(",
")",
":",
"?",
"array",
"{",
"$",
"data",
"=",
"null",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"data",
")",
")",
"{",
"// no need to type-cast",
"if",
"(",
"is_object",
"(",
"$",
"this",
... | To object.
@return ?array | [
"To",
"object",
"."
] | 3a20b5cc85cb3899c41737678798ec3de73a3836 | https://github.com/k-gun/oppa/blob/3a20b5cc85cb3899c41737678798ec3de73a3836/src/Query/Result/Result.php#L412-L427 | train |
k-gun/oppa | src/Query/Result/Result.php | Result.toClass | public final function toClass(string $class): ?array
{
$data = null;
if (!empty($this->data)) {
$data = $this->data;
foreach ($data as &$dat) {
$datClass = new $class();
foreach ((array) $dat as $key => $value) {
$datClass->{$key} = $value;
}
$dat = $datClass;
}
}
return $data;
} | php | public final function toClass(string $class): ?array
{
$data = null;
if (!empty($this->data)) {
$data = $this->data;
foreach ($data as &$dat) {
$datClass = new $class();
foreach ((array) $dat as $key => $value) {
$datClass->{$key} = $value;
}
$dat = $datClass;
}
}
return $data;
} | [
"public",
"final",
"function",
"toClass",
"(",
"string",
"$",
"class",
")",
":",
"?",
"array",
"{",
"$",
"data",
"=",
"null",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"data",
")",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"dat... | To class.
@param string $class
@return ?array | [
"To",
"class",
"."
] | 3a20b5cc85cb3899c41737678798ec3de73a3836 | https://github.com/k-gun/oppa/blob/3a20b5cc85cb3899c41737678798ec3de73a3836/src/Query/Result/Result.php#L434-L449 | train |
traderinteractive/util-arrays-php | src/Arrays.php | Arrays.copyIfKeysExist | public static function copyIfKeysExist(array $source, array &$dest, array $keyMap)
{
$callable = function (array $source, $key) {
return array_key_exists($key, $source);
};
self::copyValueIf($source, $dest, $keyMap, $callable);
} | php | public static function copyIfKeysExist(array $source, array &$dest, array $keyMap)
{
$callable = function (array $source, $key) {
return array_key_exists($key, $source);
};
self::copyValueIf($source, $dest, $keyMap, $callable);
} | [
"public",
"static",
"function",
"copyIfKeysExist",
"(",
"array",
"$",
"source",
",",
"array",
"&",
"$",
"dest",
",",
"array",
"$",
"keyMap",
")",
"{",
"$",
"callable",
"=",
"function",
"(",
"array",
"$",
"source",
",",
"$",
"key",
")",
"{",
"return",
... | Sets destination array values to be the source values if the source key exist in the source array.
@param array $source
@param array &$dest
@param array $keyMap mapping of dest keys to source keys. If $keyMap is associative, the keys will be the
destination keys. If numeric the values will be the destination keys
@return void | [
"Sets",
"destination",
"array",
"values",
"to",
"be",
"the",
"source",
"values",
"if",
"the",
"source",
"key",
"exist",
"in",
"the",
"source",
"array",
"."
] | 43dc5957b6d081996bf08f16bcdae743555281a9 | https://github.com/traderinteractive/util-arrays-php/blob/43dc5957b6d081996bf08f16bcdae743555281a9/src/Arrays.php#L80-L86 | train |
traderinteractive/util-arrays-php | src/Arrays.php | Arrays.copyIfSet | public static function copyIfSet(array $source, array &$dest, array $keyMap)
{
$callable = function (array $source, $key) {
return isset($source[$key]);
};
self::copyValueIf($source, $dest, $keyMap, $callable);
} | php | public static function copyIfSet(array $source, array &$dest, array $keyMap)
{
$callable = function (array $source, $key) {
return isset($source[$key]);
};
self::copyValueIf($source, $dest, $keyMap, $callable);
} | [
"public",
"static",
"function",
"copyIfSet",
"(",
"array",
"$",
"source",
",",
"array",
"&",
"$",
"dest",
",",
"array",
"$",
"keyMap",
")",
"{",
"$",
"callable",
"=",
"function",
"(",
"array",
"$",
"source",
",",
"$",
"key",
")",
"{",
"return",
"isse... | Sets destination array values to be the source values if the source key is set in the source array.
@param array $source
@param array &$dest
@param array $keyMap mapping of dest keys to source keys. If $keyMap is associative, the keys will be the
destination keys. If numeric the values will be the destination keys
@return void | [
"Sets",
"destination",
"array",
"values",
"to",
"be",
"the",
"source",
"values",
"if",
"the",
"source",
"key",
"is",
"set",
"in",
"the",
"source",
"array",
"."
] | 43dc5957b6d081996bf08f16bcdae743555281a9 | https://github.com/traderinteractive/util-arrays-php/blob/43dc5957b6d081996bf08f16bcdae743555281a9/src/Arrays.php#L98-L104 | train |
traderinteractive/util-arrays-php | src/Arrays.php | Arrays.project | public static function project(array $input, $key, bool $strictKeyCheck = true) : array
{
$projection = [];
foreach ($input as $itemKey => $item) {
self::ensureIsArray($item, 'a value in $input was not an array');
if (array_key_exists($key, $item)) {
$projection[$itemKey] = $item[$key];
} elseif ($strictKeyCheck) {
throw new \InvalidArgumentException('key was not in one of the $input arrays');
}
}
return $projection;
} | php | public static function project(array $input, $key, bool $strictKeyCheck = true) : array
{
$projection = [];
foreach ($input as $itemKey => $item) {
self::ensureIsArray($item, 'a value in $input was not an array');
if (array_key_exists($key, $item)) {
$projection[$itemKey] = $item[$key];
} elseif ($strictKeyCheck) {
throw new \InvalidArgumentException('key was not in one of the $input arrays');
}
}
return $projection;
} | [
"public",
"static",
"function",
"project",
"(",
"array",
"$",
"input",
",",
"$",
"key",
",",
"bool",
"$",
"strictKeyCheck",
"=",
"true",
")",
":",
"array",
"{",
"$",
"projection",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"input",
"as",
"$",
"itemKey"... | Projects values of a key into an array.
if $input = [
['key 1' => 'item 1 value 1', 'key 2' => 'item 1 value 2'],
['key 1' => 'item 2 value 1', 'key 2' => 'item 2 value 2'],
['key 1' => 'item 3 value 1'],
]
and $key = 'key 2'
and $strictKeyCheck = false
then return ['item 1 value 2', 'item 2 value 2']
but if $strictKeyCheck = true then an InvalidArgumentException occurs since 'key 2' wasnt in item 3
@param array $input the array to project from
@param string|integer $key the key which values we are to project
@param boolean $strictKeyCheck ensure key is in each $input array or not
@return array the projection
@throws \InvalidArgumentException if a value in $input was not an array
@throws \InvalidArgumentException if a key was not in one of the $input arrays | [
"Projects",
"values",
"of",
"a",
"key",
"into",
"an",
"array",
"."
] | 43dc5957b6d081996bf08f16bcdae743555281a9 | https://github.com/traderinteractive/util-arrays-php/blob/43dc5957b6d081996bf08f16bcdae743555281a9/src/Arrays.php#L150-L165 | train |
traderinteractive/util-arrays-php | src/Arrays.php | Arrays.embedInto | public static function embedInto(
array $items,
string $fieldName,
array $destination = [],
bool $overwrite = false
) : array {
foreach ($items as $key => $item) {
if (!array_key_exists($key, $destination)) {
$destination[$key] = [$fieldName => $item];
continue;
}
self::ensureIsArray($destination[$key], 'a value in $destination was not an array');
if (!$overwrite && array_key_exists($fieldName, $destination[$key])) {
throw new \Exception('$fieldName key already exists in a $destination array');
}
$destination[$key][$fieldName] = $item;
}
return $destination;
} | php | public static function embedInto(
array $items,
string $fieldName,
array $destination = [],
bool $overwrite = false
) : array {
foreach ($items as $key => $item) {
if (!array_key_exists($key, $destination)) {
$destination[$key] = [$fieldName => $item];
continue;
}
self::ensureIsArray($destination[$key], 'a value in $destination was not an array');
if (!$overwrite && array_key_exists($fieldName, $destination[$key])) {
throw new \Exception('$fieldName key already exists in a $destination array');
}
$destination[$key][$fieldName] = $item;
}
return $destination;
} | [
"public",
"static",
"function",
"embedInto",
"(",
"array",
"$",
"items",
",",
"string",
"$",
"fieldName",
",",
"array",
"$",
"destination",
"=",
"[",
"]",
",",
"bool",
"$",
"overwrite",
"=",
"false",
")",
":",
"array",
"{",
"foreach",
"(",
"$",
"items"... | Takes each item and embeds it into the destination array, returning the result.
Each item's key is used as the key in the destination array so that keys are preserved. Each resulting item in
the destination will be embedded into a field named by $fieldName. Any items that don't have an entry in
destination already will be added, not skipped.
For example, embedInto(['Joe', 'Sue'], 'lastName', [['firstName' => 'Billy'], ['firstName' => 'Bobby']]) will
return [['firstName' => 'Billy', 'lastName' => 'Joe'], ['firstName' => 'Bobby', 'lastName' => 'Sue']]
@param array $items The items to embed into the result.
@param string $fieldName The name of the field to embed the items into. This field must not exist in the
destination items already.
@param array $destination An optional array of arrays to embed the items into. If this is not provided then
empty records are assumed and the new record will be created only containing
$fieldName.
@param bool $overwrite whether to overwrite $fieldName in $destination array
@return array $destination, with all items in $items added using their keys, but underneath a nested $fieldName
key.
@throws \InvalidArgumentException if $fieldName was not a string
@throws \InvalidArgumentException if a value in $destination was not an array
@throws \Exception if $fieldName key already exists in a $destination array | [
"Takes",
"each",
"item",
"and",
"embeds",
"it",
"into",
"the",
"destination",
"array",
"returning",
"the",
"result",
"."
] | 43dc5957b6d081996bf08f16bcdae743555281a9 | https://github.com/traderinteractive/util-arrays-php/blob/43dc5957b6d081996bf08f16bcdae743555281a9/src/Arrays.php#L220-L242 | train |
traderinteractive/util-arrays-php | src/Arrays.php | Arrays.extract | public static function extract(
array $input,
$keyIndex,
$valueIndex,
string $duplicateBehavior = 'takeLast'
) : array {
if (!in_array($duplicateBehavior, ['takeFirst', 'takeLast', 'throw'])) {
throw new \InvalidArgumentException("\$duplicateBehavior was not 'takeFirst', 'takeLast', or 'throw'");
}
self::ensureValidKey($keyIndex, '$keyIndex was not a string or integer');
self::ensureValidKey($valueIndex, '$valueIndex was not a string or integer');
$result = [];
foreach ($input as $index => $array) {
self::ensureIsArray($array, '$arrays was not a multi-dimensional array');
$key = self::get($array, $keyIndex);
self::ensureValidKey(
$key,
"Value for \$arrays[{$index}][{$keyIndex}] was not a string or integer",
'\\UnexpectedValueException'
);
$value = self::get($array, $valueIndex);
if (!array_key_exists($key, $result)) {
$result[$key] = $value;
continue;
}
if ($duplicateBehavior === 'throw') {
throw new \Exception("Duplicate entry for '{$key}' found.");
}
if ($duplicateBehavior === 'takeLast') {
$result[$key] = $value;
}
}
return $result;
} | php | public static function extract(
array $input,
$keyIndex,
$valueIndex,
string $duplicateBehavior = 'takeLast'
) : array {
if (!in_array($duplicateBehavior, ['takeFirst', 'takeLast', 'throw'])) {
throw new \InvalidArgumentException("\$duplicateBehavior was not 'takeFirst', 'takeLast', or 'throw'");
}
self::ensureValidKey($keyIndex, '$keyIndex was not a string or integer');
self::ensureValidKey($valueIndex, '$valueIndex was not a string or integer');
$result = [];
foreach ($input as $index => $array) {
self::ensureIsArray($array, '$arrays was not a multi-dimensional array');
$key = self::get($array, $keyIndex);
self::ensureValidKey(
$key,
"Value for \$arrays[{$index}][{$keyIndex}] was not a string or integer",
'\\UnexpectedValueException'
);
$value = self::get($array, $valueIndex);
if (!array_key_exists($key, $result)) {
$result[$key] = $value;
continue;
}
if ($duplicateBehavior === 'throw') {
throw new \Exception("Duplicate entry for '{$key}' found.");
}
if ($duplicateBehavior === 'takeLast') {
$result[$key] = $value;
}
}
return $result;
} | [
"public",
"static",
"function",
"extract",
"(",
"array",
"$",
"input",
",",
"$",
"keyIndex",
",",
"$",
"valueIndex",
",",
"string",
"$",
"duplicateBehavior",
"=",
"'takeLast'",
")",
":",
"array",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"duplicateBehavio... | Extracts an associative array from the given multi-dimensional array.
@param array $input The multi-dimensional array.
@param string|int $keyIndex The index to be used as the key of the resulting single dimensional result array.
@param string|int $valueIndex The index to be used as the value of the resulting single dimensional result array.
If a sub array does not contain this element null will be used as the value.
@param string $duplicateBehavior Instruct how to handle duplicate resulting values, 'takeFirst', 'takeLast',
'throw'
@return array an associative array
@throws \InvalidArgumentException Thrown if $input is not an multi-dimensional array
@throws \InvalidArgumentException Thrown if $keyIndex is not an int or string
@throws \InvalidArgumentException Thrown if $valueIndex is not an int or string
@throws \InvalidArgumentException Thrown if $duplicateBehavior is not 'takeFirst', 'takeLast', 'throw'
@throws \UnexpectedValueException Thrown if a $keyIndex value is not a string or integer
@throws \Exception Thrown if $duplicatedBehavior is 'throw' and duplicate entries are found. | [
"Extracts",
"an",
"associative",
"array",
"from",
"the",
"given",
"multi",
"-",
"dimensional",
"array",
"."
] | 43dc5957b6d081996bf08f16bcdae743555281a9 | https://github.com/traderinteractive/util-arrays-php/blob/43dc5957b6d081996bf08f16bcdae743555281a9/src/Arrays.php#L283-L323 | train |
traderinteractive/util-arrays-php | src/Arrays.php | Arrays.changeKeyCase | public static function changeKeyCase(array $input, int $case = self::CASE_LOWER) : array
{
if ($case & self::CASE_UNDERSCORE) {
$input = self::underscoreKeys($input);
}
if ($case & self::CASE_CAMEL_CAPS) {
$input = self::camelCaseKeys($input);
}
if ($case & self::CASE_UPPER) {
$input = array_change_key_case($input, \CASE_UPPER);
}
if ($case & self::CASE_LOWER) {
$input = array_change_key_case($input, \CASE_LOWER);
}
return $input;
} | php | public static function changeKeyCase(array $input, int $case = self::CASE_LOWER) : array
{
if ($case & self::CASE_UNDERSCORE) {
$input = self::underscoreKeys($input);
}
if ($case & self::CASE_CAMEL_CAPS) {
$input = self::camelCaseKeys($input);
}
if ($case & self::CASE_UPPER) {
$input = array_change_key_case($input, \CASE_UPPER);
}
if ($case & self::CASE_LOWER) {
$input = array_change_key_case($input, \CASE_LOWER);
}
return $input;
} | [
"public",
"static",
"function",
"changeKeyCase",
"(",
"array",
"$",
"input",
",",
"int",
"$",
"case",
"=",
"self",
"::",
"CASE_LOWER",
")",
":",
"array",
"{",
"if",
"(",
"$",
"case",
"&",
"self",
"::",
"CASE_UNDERSCORE",
")",
"{",
"$",
"input",
"=",
... | Changes the case of all keys in an array. Numbered indices are left as is.
@param array $input The array to work on.
@param integer $case The case to which the keys should be set.
@return array Returns an array with its keys case changed. | [
"Changes",
"the",
"case",
"of",
"all",
"keys",
"in",
"an",
"array",
".",
"Numbered",
"indices",
"are",
"left",
"as",
"is",
"."
] | 43dc5957b6d081996bf08f16bcdae743555281a9 | https://github.com/traderinteractive/util-arrays-php/blob/43dc5957b6d081996bf08f16bcdae743555281a9/src/Arrays.php#L465-L484 | train |
traderinteractive/util-arrays-php | src/Arrays.php | Arrays.flatten | final public static function flatten(array $input, string $delimiter = '.') : array
{
$args = func_get_args();
$prefix = count($args) === 3 ? array_pop($args) : '';
$result = [];
foreach ($input as $key => $value) {
$newKey = $prefix . (empty($prefix) ? '' : $delimiter) . $key;
if (is_array($value)) {
$result = array_merge($result, self::flatten($value, $delimiter, $newKey));
continue;
}
$result[$newKey] = $value;
}
return $result;
} | php | final public static function flatten(array $input, string $delimiter = '.') : array
{
$args = func_get_args();
$prefix = count($args) === 3 ? array_pop($args) : '';
$result = [];
foreach ($input as $key => $value) {
$newKey = $prefix . (empty($prefix) ? '' : $delimiter) . $key;
if (is_array($value)) {
$result = array_merge($result, self::flatten($value, $delimiter, $newKey));
continue;
}
$result[$newKey] = $value;
}
return $result;
} | [
"final",
"public",
"static",
"function",
"flatten",
"(",
"array",
"$",
"input",
",",
"string",
"$",
"delimiter",
"=",
"'.'",
")",
":",
"array",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"prefix",
"=",
"count",
"(",
"$",
"args",
")",... | Converts a multi-dimensional array into a single associative array whose keys are the concatinated keys
@param array $input The array to flatten
@param string $delimiter The separator for the concatinated keys.
@return array The flattened array | [
"Converts",
"a",
"multi",
"-",
"dimensional",
"array",
"into",
"a",
"single",
"associative",
"array",
"whose",
"keys",
"are",
"the",
"concatinated",
"keys"
] | 43dc5957b6d081996bf08f16bcdae743555281a9 | https://github.com/traderinteractive/util-arrays-php/blob/43dc5957b6d081996bf08f16bcdae743555281a9/src/Arrays.php#L494-L510 | train |
anklimsk/cakephp-theme | Vendor/PhpUnoconv/symfony/process/Process.php | Process.restart | public function restart(callable $callback = null)
{
if ($this->isRunning()) {
throw new RuntimeException('Process is already running');
}
$process = clone $this;
$process->start($callback);
return $process;
} | php | public function restart(callable $callback = null)
{
if ($this->isRunning()) {
throw new RuntimeException('Process is already running');
}
$process = clone $this;
$process->start($callback);
return $process;
} | [
"public",
"function",
"restart",
"(",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isRunning",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Process is already running'",
")",
";",
"}",
"$",
"process",... | Restarts the process.
Be warned that the process is cloned before being started.
@param callable|null $callback A PHP callback to run whenever there is some
output available on STDOUT or STDERR
@return Process The new process
@throws RuntimeException When process can't be launched
@throws RuntimeException When process is already running
@see start() | [
"Restarts",
"the",
"process",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Vendor/PhpUnoconv/symfony/process/Process.php#L328-L338 | train |
anklimsk/cakephp-theme | Vendor/PhpUnoconv/symfony/process/Process.php | Process.getExitCode | public function getExitCode()
{
if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
}
$this->updateStatus(false);
return $this->exitcode;
} | php | public function getExitCode()
{
if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
}
$this->updateStatus(false);
return $this->exitcode;
} | [
"public",
"function",
"getExitCode",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enhanceSigchildCompatibility",
"&&",
"$",
"this",
"->",
"isSigchildEnabled",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'This PHP has been compiled with --en... | Returns the exit code returned by the process.
@return null|int The exit status code, null if the Process is not terminated
@throws RuntimeException In case --enable-sigchild is activated and the sigchild compatibility mode is disabled | [
"Returns",
"the",
"exit",
"code",
"returned",
"by",
"the",
"process",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Vendor/PhpUnoconv/symfony/process/Process.php#L644-L653 | train |
anklimsk/cakephp-theme | Vendor/PhpUnoconv/symfony/process/Process.php | Process.hasBeenSignaled | public function hasBeenSignaled()
{
$this->requireProcessIsTerminated(__FUNCTION__);
if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
}
return $this->processInformation['signaled'];
} | php | public function hasBeenSignaled()
{
$this->requireProcessIsTerminated(__FUNCTION__);
if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
}
return $this->processInformation['signaled'];
} | [
"public",
"function",
"hasBeenSignaled",
"(",
")",
"{",
"$",
"this",
"->",
"requireProcessIsTerminated",
"(",
"__FUNCTION__",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"enhanceSigchildCompatibility",
"&&",
"$",
"this",
"->",
"isSigchildEnabled",
"(",
")",
"... | Returns true if the child process has been terminated by an uncaught signal.
It always returns false on Windows.
@return bool
@throws RuntimeException In case --enable-sigchild is activated
@throws LogicException In case the process is not terminated | [
"Returns",
"true",
"if",
"the",
"child",
"process",
"has",
"been",
"terminated",
"by",
"an",
"uncaught",
"signal",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Vendor/PhpUnoconv/symfony/process/Process.php#L695-L704 | train |
anklimsk/cakephp-theme | Vendor/PhpUnoconv/symfony/process/Process.php | Process.addOutput | public function addOutput($line)
{
$this->lastOutputTime = microtime(true);
fseek($this->stdout, 0, SEEK_END);
fwrite($this->stdout, $line);
fseek($this->stdout, $this->incrementalOutputOffset);
} | php | public function addOutput($line)
{
$this->lastOutputTime = microtime(true);
fseek($this->stdout, 0, SEEK_END);
fwrite($this->stdout, $line);
fseek($this->stdout, $this->incrementalOutputOffset);
} | [
"public",
"function",
"addOutput",
"(",
"$",
"line",
")",
"{",
"$",
"this",
"->",
"lastOutputTime",
"=",
"microtime",
"(",
"true",
")",
";",
"fseek",
"(",
"$",
"this",
"->",
"stdout",
",",
"0",
",",
"SEEK_END",
")",
";",
"fwrite",
"(",
"$",
"this",
... | Adds a line to the STDOUT stream.
@internal
@param string $line The line to append | [
"Adds",
"a",
"line",
"to",
"the",
"STDOUT",
"stream",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Vendor/PhpUnoconv/symfony/process/Process.php#L855-L862 | train |
anklimsk/cakephp-theme | Vendor/PhpUnoconv/symfony/process/Process.php | Process.addErrorOutput | public function addErrorOutput($line)
{
$this->lastOutputTime = microtime(true);
fseek($this->stderr, 0, SEEK_END);
fwrite($this->stderr, $line);
fseek($this->stderr, $this->incrementalErrorOutputOffset);
} | php | public function addErrorOutput($line)
{
$this->lastOutputTime = microtime(true);
fseek($this->stderr, 0, SEEK_END);
fwrite($this->stderr, $line);
fseek($this->stderr, $this->incrementalErrorOutputOffset);
} | [
"public",
"function",
"addErrorOutput",
"(",
"$",
"line",
")",
"{",
"$",
"this",
"->",
"lastOutputTime",
"=",
"microtime",
"(",
"true",
")",
";",
"fseek",
"(",
"$",
"this",
"->",
"stderr",
",",
"0",
",",
"SEEK_END",
")",
";",
"fwrite",
"(",
"$",
"thi... | Adds a line to the STDERR stream.
@internal
@param string $line The line to append | [
"Adds",
"a",
"line",
"to",
"the",
"STDERR",
"stream",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Vendor/PhpUnoconv/symfony/process/Process.php#L871-L878 | train |
anklimsk/cakephp-theme | Vendor/PhpUnoconv/symfony/process/Process.php | Process.readPipesForOutput | private function readPipesForOutput($caller, $blocking = false)
{
if ($this->outputDisabled) {
throw new LogicException('Output has been disabled.');
}
$this->requireProcessIsStarted($caller);
$this->updateStatus($blocking);
} | php | private function readPipesForOutput($caller, $blocking = false)
{
if ($this->outputDisabled) {
throw new LogicException('Output has been disabled.');
}
$this->requireProcessIsStarted($caller);
$this->updateStatus($blocking);
} | [
"private",
"function",
"readPipesForOutput",
"(",
"$",
"caller",
",",
"$",
"blocking",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"outputDisabled",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"'Output has been disabled.'",
")",
";",
"}",
"$",... | Reads pipes for the freshest output.
@param string $caller The name of the method that needs fresh outputs
@param bool $blocking Whether to use blocking calls or not
@throws LogicException in case output has been disabled or process is not started | [
"Reads",
"pipes",
"for",
"the",
"freshest",
"output",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Vendor/PhpUnoconv/symfony/process/Process.php#L1355-L1364 | train |
TheBnl/event-tickets | code/model/Attendee.php | Attendee.getBetterButtonsActions | public function getBetterButtonsActions()
{
/** @var FieldList $fields */
$fields = parent::getBetterButtonsActions();
if ($this->TicketFile()->exists() && !empty($this->getEmail())) {
$fields->push(BetterButtonCustomAction::create('sendTicket', _t('Attendee.SEND', 'Send the ticket')));
}
if (!empty($this->getName()) && !empty($this->getEmail())) {
$fields->push(BetterButtonCustomAction::create('createTicketFile', _t('Attendee.CREATE_TICKET', 'Create the ticket')));
}
return $fields;
} | php | public function getBetterButtonsActions()
{
/** @var FieldList $fields */
$fields = parent::getBetterButtonsActions();
if ($this->TicketFile()->exists() && !empty($this->getEmail())) {
$fields->push(BetterButtonCustomAction::create('sendTicket', _t('Attendee.SEND', 'Send the ticket')));
}
if (!empty($this->getName()) && !empty($this->getEmail())) {
$fields->push(BetterButtonCustomAction::create('createTicketFile', _t('Attendee.CREATE_TICKET', 'Create the ticket')));
}
return $fields;
} | [
"public",
"function",
"getBetterButtonsActions",
"(",
")",
"{",
"/** @var FieldList $fields */",
"$",
"fields",
"=",
"parent",
"::",
"getBetterButtonsActions",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"TicketFile",
"(",
")",
"->",
"exists",
"(",
")",
"&&",... | Add utility actions to the attendee details view
@return FieldList | [
"Add",
"utility",
"actions",
"to",
"the",
"attendee",
"details",
"view"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/model/Attendee.php#L182-L195 | train |
TheBnl/event-tickets | code/model/Attendee.php | Attendee.onBeforeWrite | public function onBeforeWrite()
{
// Set the title of the attendee
$this->Title = $this->getName();
// Generate the ticket code
if ($this->exists() && empty($this->TicketCode)) {
$this->TicketCode = $this->generateTicketCode();
}
if (
$this->getEmail()
&& $this->getName()
&& !$this->TicketFile()->exists()
&& !$this->TicketQRCode()->exists()
) {
$this->createQRCode();
$this->createTicketFile();
}
if ($fields = $this->Fields()) {
foreach ($fields as $field) {
if ($value = $this->{"$field->Name[$field->ID]"}) {
//$cache = self::getCacheFactory();
//$cache->save(serialize($value), $this->getFieldCacheKey($field));
$fields->add($field->ID, array('Value' => $value));
}
}
}
parent::onBeforeWrite();
} | php | public function onBeforeWrite()
{
// Set the title of the attendee
$this->Title = $this->getName();
// Generate the ticket code
if ($this->exists() && empty($this->TicketCode)) {
$this->TicketCode = $this->generateTicketCode();
}
if (
$this->getEmail()
&& $this->getName()
&& !$this->TicketFile()->exists()
&& !$this->TicketQRCode()->exists()
) {
$this->createQRCode();
$this->createTicketFile();
}
if ($fields = $this->Fields()) {
foreach ($fields as $field) {
if ($value = $this->{"$field->Name[$field->ID]"}) {
//$cache = self::getCacheFactory();
//$cache->save(serialize($value), $this->getFieldCacheKey($field));
$fields->add($field->ID, array('Value' => $value));
}
}
}
parent::onBeforeWrite();
} | [
"public",
"function",
"onBeforeWrite",
"(",
")",
"{",
"// Set the title of the attendee",
"$",
"this",
"->",
"Title",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"// Generate the ticket code",
"if",
"(",
"$",
"this",
"->",
"exists",
"(",
")",
"&&",
"em... | Set the title and ticket code before writing | [
"Set",
"the",
"title",
"and",
"ticket",
"code",
"before",
"writing"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/model/Attendee.php#L200-L231 | train |
TheBnl/event-tickets | code/model/Attendee.php | Attendee.onBeforeDelete | public function onBeforeDelete()
{
// If an attendee is deleted from the guest list remove it's qr code
// after deleting the code it's not validatable anymore, simply here for cleanup
if ($this->TicketQRCode()->exists()) {
$this->TicketQRCode()->delete();
}
// cleanup the ticket file
if ($this->TicketFile()->exists()) {
$this->TicketFile()->delete();
}
if ($this->Fields()->exists()) {
$this->Fields()->removeAll();
}
parent::onBeforeDelete();
} | php | public function onBeforeDelete()
{
// If an attendee is deleted from the guest list remove it's qr code
// after deleting the code it's not validatable anymore, simply here for cleanup
if ($this->TicketQRCode()->exists()) {
$this->TicketQRCode()->delete();
}
// cleanup the ticket file
if ($this->TicketFile()->exists()) {
$this->TicketFile()->delete();
}
if ($this->Fields()->exists()) {
$this->Fields()->removeAll();
}
parent::onBeforeDelete();
} | [
"public",
"function",
"onBeforeDelete",
"(",
")",
"{",
"// If an attendee is deleted from the guest list remove it's qr code",
"// after deleting the code it's not validatable anymore, simply here for cleanup",
"if",
"(",
"$",
"this",
"->",
"TicketQRCode",
"(",
")",
"->",
"exists",... | Delete any stray files before deleting the object | [
"Delete",
"any",
"stray",
"files",
"before",
"deleting",
"the",
"object"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/model/Attendee.php#L244-L262 | train |
TheBnl/event-tickets | code/model/Attendee.php | Attendee.getName | public function getName()
{
$mainContact = $this->Reservation()->MainContact();
if ($this->getSurname()) {
return trim("{$this->getFirstName()} {$this->getSurname()}");
} elseif ($mainContact->exists() && $mainContact->getSurname()) {
return _t('Attendee.GUEST_OF', 'Guest of {name}', null, array('name' => $mainContact->getName()));
} else {
return null;
}
} | php | public function getName()
{
$mainContact = $this->Reservation()->MainContact();
if ($this->getSurname()) {
return trim("{$this->getFirstName()} {$this->getSurname()}");
} elseif ($mainContact->exists() && $mainContact->getSurname()) {
return _t('Attendee.GUEST_OF', 'Guest of {name}', null, array('name' => $mainContact->getName()));
} else {
return null;
}
} | [
"public",
"function",
"getName",
"(",
")",
"{",
"$",
"mainContact",
"=",
"$",
"this",
"->",
"Reservation",
"(",
")",
"->",
"MainContact",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getSurname",
"(",
")",
")",
"{",
"return",
"trim",
"(",
"\"{$this-... | Get the combined first and last nave for display on the ticket and attendee list
@return string|null | [
"Get",
"the",
"combined",
"first",
"and",
"last",
"nave",
"for",
"display",
"on",
"the",
"ticket",
"and",
"attendee",
"list"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/model/Attendee.php#L309-L319 | train |
TheBnl/event-tickets | code/model/Attendee.php | Attendee.getTableFields | public function getTableFields()
{
$fields = new ArrayList();
foreach (self::config()->get('table_fields') as $field) {
$data = new ViewableData();
$data->Header = _t("Attendee.$field", $field);
$data->Value = $this->{$field};
$fields->add($data);
}
return $fields;
} | php | public function getTableFields()
{
$fields = new ArrayList();
foreach (self::config()->get('table_fields') as $field) {
$data = new ViewableData();
$data->Header = _t("Attendee.$field", $field);
$data->Value = $this->{$field};
$fields->add($data);
}
return $fields;
} | [
"public",
"function",
"getTableFields",
"(",
")",
"{",
"$",
"fields",
"=",
"new",
"ArrayList",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"config",
"(",
")",
"->",
"get",
"(",
"'table_fields'",
")",
"as",
"$",
"field",
")",
"{",
"$",
"data",
"=",
... | Get the table fields for this attendee
@return ArrayList | [
"Get",
"the",
"table",
"fields",
"for",
"this",
"attendee"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/model/Attendee.php#L357-L367 | train |
TheBnl/event-tickets | code/model/Attendee.php | Attendee.createQRCode | public function createQRCode()
{
$folder = $this->fileFolder();
$relativeFilePath = "/{$folder->Filename}{$this->TicketCode}.png";
$absoluteFilePath = Director::baseFolder() . $relativeFilePath;
if (!$image = Image::get()->find('Filename', $relativeFilePath)) {
// Generate the QR code
$renderer = new BaconQrCode\Renderer\Image\Png();
$renderer->setHeight(256);
$renderer->setWidth(256);
$writer = new BaconQrCode\Writer($renderer);
if (self::config()->get('qr_as_link')) {
$writer->writeFile($this->getCheckInLink(), $absoluteFilePath);
} else {
$writer->writeFile($this->TicketCode, $absoluteFilePath);
}
// Store the image in an image object
$image = Image::create();
$image->ParentID = $folder->ID;
$image->OwnerID = (Member::currentUser()) ? Member::currentUser()->ID : 0;
$image->Title = $this->TicketCode;
$image->setFilename($relativeFilePath);
$image->write();
// Attach the QR code to the Attendee
$this->TicketQRCodeID = $image->ID;
$this->write();
}
return $image;
} | php | public function createQRCode()
{
$folder = $this->fileFolder();
$relativeFilePath = "/{$folder->Filename}{$this->TicketCode}.png";
$absoluteFilePath = Director::baseFolder() . $relativeFilePath;
if (!$image = Image::get()->find('Filename', $relativeFilePath)) {
// Generate the QR code
$renderer = new BaconQrCode\Renderer\Image\Png();
$renderer->setHeight(256);
$renderer->setWidth(256);
$writer = new BaconQrCode\Writer($renderer);
if (self::config()->get('qr_as_link')) {
$writer->writeFile($this->getCheckInLink(), $absoluteFilePath);
} else {
$writer->writeFile($this->TicketCode, $absoluteFilePath);
}
// Store the image in an image object
$image = Image::create();
$image->ParentID = $folder->ID;
$image->OwnerID = (Member::currentUser()) ? Member::currentUser()->ID : 0;
$image->Title = $this->TicketCode;
$image->setFilename($relativeFilePath);
$image->write();
// Attach the QR code to the Attendee
$this->TicketQRCodeID = $image->ID;
$this->write();
}
return $image;
} | [
"public",
"function",
"createQRCode",
"(",
")",
"{",
"$",
"folder",
"=",
"$",
"this",
"->",
"fileFolder",
"(",
")",
";",
"$",
"relativeFilePath",
"=",
"\"/{$folder->Filename}{$this->TicketCode}.png\"",
";",
"$",
"absoluteFilePath",
"=",
"Director",
"::",
"baseFold... | Create a QRCode for the attendee based on the Ticket code
@return Image | [
"Create",
"a",
"QRCode",
"for",
"the",
"attendee",
"based",
"on",
"the",
"Ticket",
"code"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/model/Attendee.php#L396-L428 | train |
TheBnl/event-tickets | code/model/Attendee.php | Attendee.createTicketFile | public function createTicketFile()
{
// Find or make a folder
$folder = $this->fileFolder();
$relativeFilePath = "/{$folder->Filename}{$this->TicketCode}.pdf";
$absoluteFilePath = Director::baseFolder() . $relativeFilePath;
if (!$this->TicketQRCode()->exists()) {
$this->createQRCode();
}
if (!$file = File::get()->find('Filename', $relativeFilePath)) {
$file = File::create();
$file->ParentID = $folder->ID;
$file->OwnerID = (Member::currentUser()) ? Member::currentUser()->ID : 0;
$file->Title = $this->TicketCode;
$file->setFilename($relativeFilePath);
$file->write();
}
// Set the template and parse the data
$template = new SSViewer('PrintableTicket');
$html = $template->process($this->data());// getViewableData());
// Create a DomPDF instance
$domPDF = new Dompdf();
$domPDF->loadHtml($html);
$domPDF->setPaper('A4');
$domPDF->getOptions()->setDpi(150);
$domPDF->render();
// Save the pdf stream as a file
file_put_contents($absoluteFilePath, $domPDF->output());
// Attach the ticket file to the Attendee
$this->TicketFileID = $file->ID;
$this->write();
return $file;
} | php | public function createTicketFile()
{
// Find or make a folder
$folder = $this->fileFolder();
$relativeFilePath = "/{$folder->Filename}{$this->TicketCode}.pdf";
$absoluteFilePath = Director::baseFolder() . $relativeFilePath;
if (!$this->TicketQRCode()->exists()) {
$this->createQRCode();
}
if (!$file = File::get()->find('Filename', $relativeFilePath)) {
$file = File::create();
$file->ParentID = $folder->ID;
$file->OwnerID = (Member::currentUser()) ? Member::currentUser()->ID : 0;
$file->Title = $this->TicketCode;
$file->setFilename($relativeFilePath);
$file->write();
}
// Set the template and parse the data
$template = new SSViewer('PrintableTicket');
$html = $template->process($this->data());// getViewableData());
// Create a DomPDF instance
$domPDF = new Dompdf();
$domPDF->loadHtml($html);
$domPDF->setPaper('A4');
$domPDF->getOptions()->setDpi(150);
$domPDF->render();
// Save the pdf stream as a file
file_put_contents($absoluteFilePath, $domPDF->output());
// Attach the ticket file to the Attendee
$this->TicketFileID = $file->ID;
$this->write();
return $file;
} | [
"public",
"function",
"createTicketFile",
"(",
")",
"{",
"// Find or make a folder",
"$",
"folder",
"=",
"$",
"this",
"->",
"fileFolder",
"(",
")",
";",
"$",
"relativeFilePath",
"=",
"\"/{$folder->Filename}{$this->TicketCode}.pdf\"",
";",
"$",
"absoluteFilePath",
"=",... | Creates a printable ticket for the attendee
@return File | [
"Creates",
"a",
"printable",
"ticket",
"for",
"the",
"attendee"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/model/Attendee.php#L435-L474 | train |
TheBnl/event-tickets | code/model/Attendee.php | Attendee.sendTicket | public function sendTicket()
{
// Get the mail sender or fallback to the admin email
if (empty($from = Reservation::config()->get('mail_sender'))) {
$from = Config::inst()->get('Email', 'admin_email');
}
$email = new Email();
$email->setSubject(_t(
'AttendeeMail.TITLE',
'Your ticket for {event}',
null,
array(
'event' => $this->Event()->Title
)
));
$email->setFrom($from);
$email->setTo($this->getEmail());
$email->setTemplate('AttendeeMail');
$email->populateTemplate($this);
$this->extend('updateTicketMail', $email);
return $email->send();
} | php | public function sendTicket()
{
// Get the mail sender or fallback to the admin email
if (empty($from = Reservation::config()->get('mail_sender'))) {
$from = Config::inst()->get('Email', 'admin_email');
}
$email = new Email();
$email->setSubject(_t(
'AttendeeMail.TITLE',
'Your ticket for {event}',
null,
array(
'event' => $this->Event()->Title
)
));
$email->setFrom($from);
$email->setTo($this->getEmail());
$email->setTemplate('AttendeeMail');
$email->populateTemplate($this);
$this->extend('updateTicketMail', $email);
return $email->send();
} | [
"public",
"function",
"sendTicket",
"(",
")",
"{",
"// Get the mail sender or fallback to the admin email",
"if",
"(",
"empty",
"(",
"$",
"from",
"=",
"Reservation",
"::",
"config",
"(",
")",
"->",
"get",
"(",
"'mail_sender'",
")",
")",
")",
"{",
"$",
"from",
... | Send the attendee ticket
@return mixed | [
"Send",
"the",
"attendee",
"ticket"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/model/Attendee.php#L481-L503 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/ScriptMethods/AbstractScriptMethod.php | AbstractScriptMethod.get | public function get($function)
{
$this->toDispatch[] = $function;
if (is_null($this->dataProvider)) {
$this->currentData = null;
$this->dispatchData();
return;
}
if (is_null($this->currentData)) {
if (!$this->callMade) {
$this->callMade = true;
$this->dataProvider->request();
}
return;
}
$this->dispatchData();
} | php | public function get($function)
{
$this->toDispatch[] = $function;
if (is_null($this->dataProvider)) {
$this->currentData = null;
$this->dispatchData();
return;
}
if (is_null($this->currentData)) {
if (!$this->callMade) {
$this->callMade = true;
$this->dataProvider->request();
}
return;
}
$this->dispatchData();
} | [
"public",
"function",
"get",
"(",
"$",
"function",
")",
"{",
"$",
"this",
"->",
"toDispatch",
"[",
"]",
"=",
"$",
"function",
";",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"dataProvider",
")",
")",
"{",
"$",
"this",
"->",
"currentData",
"=",
"... | Get TM.Scores or SM.Scores.
@param callback $function
@return void | [
"Get",
"TM",
".",
"Scores",
"or",
"SM",
".",
"Scores",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/ScriptMethods/AbstractScriptMethod.php#L35-L54 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/ScriptMethods/AbstractScriptMethod.php | AbstractScriptMethod.dispatchData | protected function dispatchData()
{
foreach ($this->toDispatch as $callback) {
$callback($this->currentData);
}
$this->toDispatch = [];
$this->callMade = false;
} | php | protected function dispatchData()
{
foreach ($this->toDispatch as $callback) {
$callback($this->currentData);
}
$this->toDispatch = [];
$this->callMade = false;
} | [
"protected",
"function",
"dispatchData",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"toDispatch",
"as",
"$",
"callback",
")",
"{",
"$",
"callback",
"(",
"$",
"this",
"->",
"currentData",
")",
";",
"}",
"$",
"this",
"->",
"toDispatch",
"=",
"[",
... | Dispatch data. | [
"Dispatch",
"data",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/ScriptMethods/AbstractScriptMethod.php#L85-L93 | train |
BenGorUser/UserBundle | src/BenGorUser/UserBundle/Controller/Api/RemoveController.php | RemoveController.removeAction | public function removeAction(Request $request, $userClass)
{
$form = $this->get('form.factory')->createNamedBuilder('', RemoveType::class, null, [
'csrf_protection' => false,
])->getForm();
$form->handleRequest($request);
if ($form->isValid()) {
try {
$this->get('bengor_user.' . $userClass . '.api_command_bus')->handle(
$form->getData()
);
return new JsonResponse();
} catch (UserDoesNotExistException $exception) {
return new JsonResponse(
sprintf(
'The "%s" user id does not exist',
$form->getData()->id()
),
400
);
}
}
return new JsonResponse(FormErrorSerializer::errors($form), 400);
} | php | public function removeAction(Request $request, $userClass)
{
$form = $this->get('form.factory')->createNamedBuilder('', RemoveType::class, null, [
'csrf_protection' => false,
])->getForm();
$form->handleRequest($request);
if ($form->isValid()) {
try {
$this->get('bengor_user.' . $userClass . '.api_command_bus')->handle(
$form->getData()
);
return new JsonResponse();
} catch (UserDoesNotExistException $exception) {
return new JsonResponse(
sprintf(
'The "%s" user id does not exist',
$form->getData()->id()
),
400
);
}
}
return new JsonResponse(FormErrorSerializer::errors($form), 400);
} | [
"public",
"function",
"removeAction",
"(",
"Request",
"$",
"request",
",",
"$",
"userClass",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"get",
"(",
"'form.factory'",
")",
"->",
"createNamedBuilder",
"(",
"''",
",",
"RemoveType",
"::",
"class",
",",
"... | Remove ser password action.
@param Request $request The request
@param string $userClass Extra parameter that contains the user type
@return \Symfony\Component\HttpFoundation\JsonResponse | [
"Remove",
"ser",
"password",
"action",
"."
] | a6d0173496c269a6c80e1319d42eaed4b3bbbd4a | https://github.com/BenGorUser/UserBundle/blob/a6d0173496c269a6c80e1319d42eaed4b3bbbd4a/src/BenGorUser/UserBundle/Controller/Api/RemoveController.php#L37-L63 | train |
anklimsk/cakephp-theme | Vendor/PhpUnoconv/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php | AbstractBinary.run | protected function run(Process $process, $bypassErrors = false, $listeners = null)
{
if (null !== $listeners) {
if (!is_array($listeners)) {
$listeners = array($listeners);
}
$listenersManager = clone $this->listenersManager;
foreach ($listeners as $listener) {
$listenersManager->register($listener, $this);
}
} else {
$listenersManager = $this->listenersManager;
}
return $this->processRunner->run($process, $listenersManager->storage, $bypassErrors);
} | php | protected function run(Process $process, $bypassErrors = false, $listeners = null)
{
if (null !== $listeners) {
if (!is_array($listeners)) {
$listeners = array($listeners);
}
$listenersManager = clone $this->listenersManager;
foreach ($listeners as $listener) {
$listenersManager->register($listener, $this);
}
} else {
$listenersManager = $this->listenersManager;
}
return $this->processRunner->run($process, $listenersManager->storage, $bypassErrors);
} | [
"protected",
"function",
"run",
"(",
"Process",
"$",
"process",
",",
"$",
"bypassErrors",
"=",
"false",
",",
"$",
"listeners",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"listeners",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"listene... | Executes a process, logs events
@param Process $process
@param Boolean $bypassErrors Set to true to disable throwing ExecutionFailureExceptions
@param ListenerInterface|array $listeners A listener or an array of listener to register for this unique run
@return string The Process output
@throws ExecutionFailureException in case of process failure. | [
"Executes",
"a",
"process",
"logs",
"events"
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Vendor/PhpUnoconv/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php#L193-L210 | train |
dazzle-php/throwable | src/Throwable/Throwable.php | Throwable.parseThrowableMessage | public static function parseThrowableMessage($ex)
{
$message = $ex['message'];
if ($ex['isError'] && strpos($message, ' in ') !== false)
{
$message = preg_replace('#([a-zA-Z0-9-_]+?)/#siU', '', $message);
$message = preg_replace('#/#si', '', $message, 1);
}
else
{
$message = trim($message, '"');
$file = str_replace('.php', '', basename($ex['file']));
$line = $ex['line'];
$message = '"' . $message . '" in ' . $file . ':' . $line;
}
return '[' . static::getBasename($ex['class']) . '] ' . $message;
} | php | public static function parseThrowableMessage($ex)
{
$message = $ex['message'];
if ($ex['isError'] && strpos($message, ' in ') !== false)
{
$message = preg_replace('#([a-zA-Z0-9-_]+?)/#siU', '', $message);
$message = preg_replace('#/#si', '', $message, 1);
}
else
{
$message = trim($message, '"');
$file = str_replace('.php', '', basename($ex['file']));
$line = $ex['line'];
$message = '"' . $message . '" in ' . $file . ':' . $line;
}
return '[' . static::getBasename($ex['class']) . '] ' . $message;
} | [
"public",
"static",
"function",
"parseThrowableMessage",
"(",
"$",
"ex",
")",
"{",
"$",
"message",
"=",
"$",
"ex",
"[",
"'message'",
"]",
";",
"if",
"(",
"$",
"ex",
"[",
"'isError'",
"]",
"&&",
"strpos",
"(",
"$",
"message",
",",
"' in '",
")",
"!=="... | Parse Throwable message to proper format.
@param string[] $ex
@return string | [
"Parse",
"Throwable",
"message",
"to",
"proper",
"format",
"."
] | daeec7b8857763765db686412886831704720bd0 | https://github.com/dazzle-php/throwable/blob/daeec7b8857763765db686412886831704720bd0/src/Throwable/Throwable.php#L13-L31 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.