repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
nicklaw5/larapi | src/Larapi.php | Larapi.notAvailable | public function notAvailable($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_SERVICE_UNAVAILABLE, $headers);
} | php | public function notAvailable($msg = '', $errorCode = null, $headers = [])
{
return $this->getErrorResponse($msg, $errorCode, self::HTTP_SERVICE_UNAVAILABLE, $headers);
} | [
"public",
"function",
"notAvailable",
"(",
"$",
"msg",
"=",
"''",
",",
"$",
"errorCode",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"getErrorResponse",
"(",
"$",
"msg",
",",
"$",
"errorCode",
",",
"self",
... | Returns 503 Not Available HTTP Response
@param string $msg
@param int $errorCode
@param array $headers
@return json | [
"Returns",
"503",
"Not",
"Available",
"HTTP",
"Response"
] | train | https://github.com/nicklaw5/larapi/blob/fb3493118bb9c6ce01567230c09e8402ac148d0e/src/Larapi.php#L227-L230 |
phpmob/changmin | src/PhpMob/CoreBundle/Form/Type/WebUserType.php | WebUserType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options): void
{
parent::buildForm($builder, $options);
$builder
->add('firstName', TextType::class, [
'label' => 'phpmob.form.user.first_name',
'required' => false,
])
... | php | public function buildForm(FormBuilderInterface $builder, array $options): void
{
parent::buildForm($builder, $options);
$builder
->add('firstName', TextType::class, [
'label' => 'phpmob.form.user.first_name',
'required' => false,
])
... | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
":",
"void",
"{",
"parent",
"::",
"buildForm",
"(",
"$",
"builder",
",",
"$",
"options",
")",
";",
"$",
"builder",
"->",
"add",
"(",
"'firs... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CoreBundle/Form/Type/WebUserType.php#L19-L70 |
fyuze/framework | src/Fyuze/Kernel/Services/Debug.php | Debug.bootstrap | public function bootstrap()
{
$this->registry->make('toolbar')
->addCollector(new Response($this->registry->make('response')), true);
} | php | public function bootstrap()
{
$this->registry->make('toolbar')
->addCollector(new Response($this->registry->make('response')), true);
} | [
"public",
"function",
"bootstrap",
"(",
")",
"{",
"$",
"this",
"->",
"registry",
"->",
"make",
"(",
"'toolbar'",
")",
"->",
"addCollector",
"(",
"new",
"Response",
"(",
"$",
"this",
"->",
"registry",
"->",
"make",
"(",
"'response'",
")",
")",
",",
"tru... | Once the has started | [
"Once",
"the",
"has",
"started"
] | train | https://github.com/fyuze/framework/blob/89b3984f7225e24bfcdafb090ee197275b3222c9/src/Fyuze/Kernel/Services/Debug.php#L16-L20 |
teneleven/GeolocatorBundle | Command/GeocodeCommand.php | GeocodeCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$geocoder = $this->getContainer()->get('teneleven.geolocator.geocoder');
$manager = $this->getContainer()->get('doctrine.orm.entity_manager');
$providers = $this->getContainer()->get('teneleven.geolocator.providers'... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$geocoder = $this->getContainer()->get('teneleven.geolocator.geocoder');
$manager = $this->getContainer()->get('doctrine.orm.entity_manager');
$providers = $this->getContainer()->get('teneleven.geolocator.providers'... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"geocoder",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'teneleven.geolocator.geocoder'",
")",
";",
"$",
"... | {@inheritDoc} | [
"{"
] | train | https://github.com/teneleven/GeolocatorBundle/blob/4ead8e783a91577f2a67aa302b79641d4b9e99ad/Command/GeocodeCommand.php#L46-L105 |
VincentChalnot/SidusEAVFilterBundle | Filter/Type/DateRangeFilterType.php | DateRangeFilterType.handleData | public function handleData(QueryHandlerInterface $queryHandler, FilterInterface $filter, $data): void
{
if (!$queryHandler instanceof EAVQueryHandlerInterface) {
throw new BadQueryHandlerException($queryHandler, EAVQueryHandlerInterface::class);
}
if (!$queryHandler->isEAVFilter(... | php | public function handleData(QueryHandlerInterface $queryHandler, FilterInterface $filter, $data): void
{
if (!$queryHandler instanceof EAVQueryHandlerInterface) {
throw new BadQueryHandlerException($queryHandler, EAVQueryHandlerInterface::class);
}
if (!$queryHandler->isEAVFilter(... | [
"public",
"function",
"handleData",
"(",
"QueryHandlerInterface",
"$",
"queryHandler",
",",
"FilterInterface",
"$",
"filter",
",",
"$",
"data",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"queryHandler",
"instanceof",
"EAVQueryHandlerInterface",
")",
"{",
"throw... | {@inheritdoc}
@throws \LogicException
@throws \UnexpectedValueException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/VincentChalnot/SidusEAVFilterBundle/blob/25a9e0495fae30cb96ecded56c50cf7fe70c9032/Filter/Type/DateRangeFilterType.php#L23-L60 |
qcubed/orm | install/project/qcubed/Codegen/CodegenBase.php | CodegenBase.pluralize | protected function pluralize($strName)
{
// Special Rules go Here
switch (true) {
case ($strName == 'person'):
return 'people';
case ($strName == 'Person'):
return 'People';
case ($strName == 'PERSON'):
return 'PEOPL... | php | protected function pluralize($strName)
{
// Special Rules go Here
switch (true) {
case ($strName == 'person'):
return 'people';
case ($strName == 'Person'):
return 'People';
case ($strName == 'PERSON'):
return 'PEOPL... | [
"protected",
"function",
"pluralize",
"(",
"$",
"strName",
")",
"{",
"// Special Rules go Here",
"switch",
"(",
"true",
")",
"{",
"case",
"(",
"$",
"strName",
"==",
"'person'",
")",
":",
"return",
"'people'",
";",
"case",
"(",
"$",
"strName",
"==",
"'Perso... | QCodeGen::pluralize()
Example: Overriding the Pluralize method
@param string $strName
@return string | [
"QCodeGen",
"::",
"pluralize",
"()"
] | train | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/install/project/qcubed/Codegen/CodegenBase.php#L54-L73 |
drsdre/yii2-xmlsoccer | models/Player.php | Player.beforeSave | public function beforeSave($insert)
{
$this->date_of_birth = (empty($this->date_of_birth)) ? null : strtotime($this->date_of_birth);
$this->date_of_signing = (empty($this->date_of_signing)) ? null : strtotime($this->date_of_signing);
return parent::beforeSave($insert);
} | php | public function beforeSave($insert)
{
$this->date_of_birth = (empty($this->date_of_birth)) ? null : strtotime($this->date_of_birth);
$this->date_of_signing = (empty($this->date_of_signing)) ? null : strtotime($this->date_of_signing);
return parent::beforeSave($insert);
} | [
"public",
"function",
"beforeSave",
"(",
"$",
"insert",
")",
"{",
"$",
"this",
"->",
"date_of_birth",
"=",
"(",
"empty",
"(",
"$",
"this",
"->",
"date_of_birth",
")",
")",
"?",
"null",
":",
"strtotime",
"(",
"$",
"this",
"->",
"date_of_birth",
")",
";"... | {@inheritdoc} | [
"{"
] | train | https://github.com/drsdre/yii2-xmlsoccer/blob/a746edee6269ed0791bac6c6165a946adc30d994/models/Player.php#L93-L98 |
drsdre/yii2-xmlsoccer | models/Player.php | Player.afterFind | public function afterFind()
{
if (\Yii::$app->has('formatter')) {
if (!empty($this->date_of_birth)) {
$this->date_of_birth = \Yii::$app->formatter->asDate($this->date_of_birth);
}
if (!empty($this->date_of_signing)) {
$this->date_of_signing... | php | public function afterFind()
{
if (\Yii::$app->has('formatter')) {
if (!empty($this->date_of_birth)) {
$this->date_of_birth = \Yii::$app->formatter->asDate($this->date_of_birth);
}
if (!empty($this->date_of_signing)) {
$this->date_of_signing... | [
"public",
"function",
"afterFind",
"(",
")",
"{",
"if",
"(",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"has",
"(",
"'formatter'",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"date_of_birth",
")",
")",
"{",
"$",
"this",
"->",
"date_... | {@inheritdoc}
@throws \yii\base\InvalidConfigException | [
"{"
] | train | https://github.com/drsdre/yii2-xmlsoccer/blob/a746edee6269ed0791bac6c6165a946adc30d994/models/Player.php#L104-L115 |
titon/db | src/Titon/Db/Repository.php | Repository.addBehavior | public function addBehavior(Behavior $behavior) {
$behavior->setRepository($this);
$this->_behaviors[$behavior->getAlias()] = $behavior;
$this->attachObject($behavior->getAlias(), $behavior);
if ($behavior instanceof Listener) {
$this->on('db', $behavior);
}
... | php | public function addBehavior(Behavior $behavior) {
$behavior->setRepository($this);
$this->_behaviors[$behavior->getAlias()] = $behavior;
$this->attachObject($behavior->getAlias(), $behavior);
if ($behavior instanceof Listener) {
$this->on('db', $behavior);
}
... | [
"public",
"function",
"addBehavior",
"(",
"Behavior",
"$",
"behavior",
")",
"{",
"$",
"behavior",
"->",
"setRepository",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"_behaviors",
"[",
"$",
"behavior",
"->",
"getAlias",
"(",
")",
"]",
"=",
"$",
"beha... | Add a behavior.
@param \Titon\Db\Behavior $behavior
@return $this | [
"Add",
"a",
"behavior",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L142-L154 |
titon/db | src/Titon/Db/Repository.php | Repository.aggregate | public function aggregate(Query $query, $function, $field) {
$query->fields(
Query::func(strtoupper($function), [$field => Func::FIELD])->asAlias('aggregate')
);
$results = $this->getDriver()
->setContext('read')
->executeQuery($query)
->find();
... | php | public function aggregate(Query $query, $function, $field) {
$query->fields(
Query::func(strtoupper($function), [$field => Func::FIELD])->asAlias('aggregate')
);
$results = $this->getDriver()
->setContext('read')
->executeQuery($query)
->find();
... | [
"public",
"function",
"aggregate",
"(",
"Query",
"$",
"query",
",",
"$",
"function",
",",
"$",
"field",
")",
"{",
"$",
"query",
"->",
"fields",
"(",
"Query",
"::",
"func",
"(",
"strtoupper",
"(",
"$",
"function",
")",
",",
"[",
"$",
"field",
"=>",
... | Perform an aggregation on the database and return the calculated value.
The currently supported aggregates are `avg`, `count`, `min`, `max`, and `sum`.
@param \Titon\Db\Query $query
@param string $function
@param string $field
@return int | [
"Perform",
"an",
"aggregation",
"on",
"the",
"database",
"and",
"return",
"the",
"calculated",
"value",
".",
"The",
"currently",
"supported",
"aggregates",
"are",
"avg",
"count",
"min",
"max",
"and",
"sum",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L178-L193 |
titon/db | src/Titon/Db/Repository.php | Repository.castResults | public function castResults(Event $event, array &$results, $finder) {
$columns = $this->getSchema()->getColumns();
$driver = $this->getDriver();
$entityClass = $this->getEntity();
foreach ($results as $i => $result) {
foreach ($result as $field => $value) {
i... | php | public function castResults(Event $event, array &$results, $finder) {
$columns = $this->getSchema()->getColumns();
$driver = $this->getDriver();
$entityClass = $this->getEntity();
foreach ($results as $i => $result) {
foreach ($result as $field => $value) {
i... | [
"public",
"function",
"castResults",
"(",
"Event",
"$",
"event",
",",
"array",
"&",
"$",
"results",
",",
"$",
"finder",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
"->",
"getSchema",
"(",
")",
"->",
"getColumns",
"(",
")",
";",
"$",
"driver",
"=",
... | Type cast the results and wrap each result in an entity after a find operation.
@param \Titon\Event\Event $event
@param array $results
@param string $finder | [
"Type",
"cast",
"the",
"results",
"and",
"wrap",
"each",
"result",
"in",
"an",
"entity",
"after",
"a",
"find",
"operation",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L202-L222 |
titon/db | src/Titon/Db/Repository.php | Repository.create | public function create($data, array $options = []) {
return $this->query(Query::INSERT)->save($data, $options);
} | php | public function create($data, array $options = []) {
return $this->query(Query::INSERT)->save($data, $options);
} | [
"public",
"function",
"create",
"(",
"$",
"data",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"query",
"(",
"Query",
"::",
"INSERT",
")",
"->",
"save",
"(",
"$",
"data",
",",
"$",
"options",
")",
";",
"}"
] | Insert data into the database as a new record.
If any related data exists, insert new records after joining them to the original record.
Validate schema data and related data structure before inserting.
@param array|\Titon\Type\Contract\Arrayable $data
@param array $options
@return int The record ID on success, 0 on f... | [
"Insert",
"data",
"into",
"the",
"database",
"as",
"a",
"new",
"record",
".",
"If",
"any",
"related",
"data",
"exists",
"insert",
"new",
"records",
"after",
"joining",
"them",
"to",
"the",
"original",
"record",
".",
"Validate",
"schema",
"data",
"and",
"re... | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L233-L235 |
titon/db | src/Titon/Db/Repository.php | Repository.createMany | public function createMany(array $data, $allowPk = false, array $options = []) {
$pk = $this->getPrimaryKey();
$columns = $this->getSchema()->getColumns();
$records = [];
$defaults = [];
if ($columns) {
foreach ($columns as $key => $column) {
$default... | php | public function createMany(array $data, $allowPk = false, array $options = []) {
$pk = $this->getPrimaryKey();
$columns = $this->getSchema()->getColumns();
$records = [];
$defaults = [];
if ($columns) {
foreach ($columns as $key => $column) {
$default... | [
"public",
"function",
"createMany",
"(",
"array",
"$",
"data",
",",
"$",
"allowPk",
"=",
"false",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"pk",
"=",
"$",
"this",
"->",
"getPrimaryKey",
"(",
")",
";",
"$",
"columns",
"=",
"$",
... | Insert multiple records into the database using a single query.
Missing fields will be added with an empty value or the schema default value.
Does not support callbacks or transactions.
@uses Titon\Utility\Hash
@param array $data Multi-dimensional array of records
@param bool $allowPk If true will allow primary key f... | [
"Insert",
"multiple",
"records",
"into",
"the",
"database",
"using",
"a",
"single",
"query",
".",
"Missing",
"fields",
"will",
"be",
"added",
"with",
"an",
"empty",
"value",
"or",
"the",
"schema",
"default",
"value",
".",
"Does",
"not",
"support",
"callbacks... | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L249-L287 |
titon/db | src/Titon/Db/Repository.php | Repository.createTable | public function createTable(array $options = [], array $attributes = []) {
$schema = $this->getSchema();
$schema->addOptions($options);
// Create the table
$status = (bool) $this->query(Query::CREATE_TABLE)
->attribute($attributes)
->schema($schema)
-... | php | public function createTable(array $options = [], array $attributes = []) {
$schema = $this->getSchema();
$schema->addOptions($options);
// Create the table
$status = (bool) $this->query(Query::CREATE_TABLE)
->attribute($attributes)
->schema($schema)
-... | [
"public",
"function",
"createTable",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"schema",
"=",
"$",
"this",
"->",
"getSchema",
"(",
")",
";",
"$",
"schema",
"->",
"addOptions",
"(",
"... | Create a database table and indexes based off the tables schema.
The schema must be an array of column data.
@param array $options
@param array $attributes
@return bool | [
"Create",
"a",
"database",
"table",
"and",
"indexes",
"based",
"off",
"the",
"tables",
"schema",
".",
"The",
"schema",
"must",
"be",
"an",
"array",
"of",
"column",
"data",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L297-L317 |
titon/db | src/Titon/Db/Repository.php | Repository.decrement | public function decrement($id, array $fields) {
$data = [];
foreach ($fields as $field => $step) {
$data[$field] = Query::expr($field, '-', $step);
}
$query = $this->query(Query::UPDATE);
if ($id instanceof Closure) {
$query->bindCallback($id);
... | php | public function decrement($id, array $fields) {
$data = [];
foreach ($fields as $field => $step) {
$data[$field] = Query::expr($field, '-', $step);
}
$query = $this->query(Query::UPDATE);
if ($id instanceof Closure) {
$query->bindCallback($id);
... | [
"public",
"function",
"decrement",
"(",
"$",
"id",
",",
"array",
"$",
"fields",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
"=>",
"$",
"step",
")",
"{",
"$",
"data",
"[",
"$",
"field",
"]",
"=",... | Decrement the value of a field(s) using a step number.
Will update all records, or a single record.
@param int|int[]|\Closure $id
@param array $fields
@return int | [
"Decrement",
"the",
"value",
"of",
"a",
"field",
"(",
"s",
")",
"using",
"a",
"step",
"number",
".",
"Will",
"update",
"all",
"records",
"or",
"a",
"single",
"record",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L327-L344 |
titon/db | src/Titon/Db/Repository.php | Repository.delete | public function delete($id, array $options = []) {
return $this->query(Query::DELETE)
->where($this->getPrimaryKey(), $id)
->save([], $options);
} | php | public function delete($id, array $options = []) {
return $this->query(Query::DELETE)
->where($this->getPrimaryKey(), $id)
->save([], $options);
} | [
"public",
"function",
"delete",
"(",
"$",
"id",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"query",
"(",
"Query",
"::",
"DELETE",
")",
"->",
"where",
"(",
"$",
"this",
"->",
"getPrimaryKey",
"(",
")",
",",
... | Delete a record by ID.
@param int|int[] $id
@param array $options
@return int The count of records deleted | [
"Delete",
"a",
"record",
"by",
"ID",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L353-L357 |
titon/db | src/Titon/Db/Repository.php | Repository.deleteMany | public function deleteMany(Closure $conditions, array $options = []) {
$query = $this->query(Query::DELETE)->bindCallback($conditions);
// Validate that this won't delete all records
$where = $query->getWhere()->getParams();
if (empty($where)) {
throw new InvalidQueryExcept... | php | public function deleteMany(Closure $conditions, array $options = []) {
$query = $this->query(Query::DELETE)->bindCallback($conditions);
// Validate that this won't delete all records
$where = $query->getWhere()->getParams();
if (empty($where)) {
throw new InvalidQueryExcept... | [
"public",
"function",
"deleteMany",
"(",
"Closure",
"$",
"conditions",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"query",
"(",
"Query",
"::",
"DELETE",
")",
"->",
"bindCallback",
"(",
"$",
"conditions"... | Delete multiple records with conditions.
@param \Closure $conditions
@param array $options
@return int The count of records deleted
@throws \Titon\Db\Exception\InvalidQueryException | [
"Delete",
"multiple",
"records",
"with",
"conditions",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L367-L378 |
titon/db | src/Titon/Db/Repository.php | Repository.exists | public function exists($id) {
return (bool) $this->select()->where($this->getPrimaryKey(), $id)->count();
} | php | public function exists($id) {
return (bool) $this->select()->where($this->getPrimaryKey(), $id)->count();
} | [
"public",
"function",
"exists",
"(",
"$",
"id",
")",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"select",
"(",
")",
"->",
"where",
"(",
"$",
"this",
"->",
"getPrimaryKey",
"(",
")",
",",
"$",
"id",
")",
"->",
"count",
"(",
")",
";",
"}... | Check if a record with an ID exists.
@param int $id
@return bool | [
"Check",
"if",
"a",
"record",
"with",
"an",
"ID",
"exists",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L395-L397 |
titon/db | src/Titon/Db/Repository.php | Repository.filterData | public function filterData(Event $event, Query $query, $id, array &$data) {
if ($columns = $this->getSchema()->getColumns()) {
$data = array_intersect_key($data, $columns);
}
return true;
} | php | public function filterData(Event $event, Query $query, $id, array &$data) {
if ($columns = $this->getSchema()->getColumns()) {
$data = array_intersect_key($data, $columns);
}
return true;
} | [
"public",
"function",
"filterData",
"(",
"Event",
"$",
"event",
",",
"Query",
"$",
"query",
",",
"$",
"id",
",",
"array",
"&",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"columns",
"=",
"$",
"this",
"->",
"getSchema",
"(",
")",
"->",
"getColumns",
"(",... | Filter out invalid columns before a save operation.
@param \Titon\Event\Event $event
@param \Titon\Db\Query $query
@param int|int[] $id
@param array $data
@return bool | [
"Filter",
"out",
"invalid",
"columns",
"before",
"a",
"save",
"operation",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L408-L414 |
titon/db | src/Titon/Db/Repository.php | Repository.find | public function find(Query $query, $type, array $options = []) {
$options = $options + [
'before' => true,
'after' => true,
'collection' => $this->getConfig('collection')
];
$finder = $this->getFinder($type);
$state = null;
if ($options['befo... | php | public function find(Query $query, $type, array $options = []) {
$options = $options + [
'before' => true,
'after' => true,
'collection' => $this->getConfig('collection')
];
$finder = $this->getFinder($type);
$state = null;
if ($options['befo... | [
"public",
"function",
"find",
"(",
"Query",
"$",
"query",
",",
"$",
"type",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"options",
"+",
"[",
"'before'",
"=>",
"true",
",",
"'after'",
"=>",
"true",
",",
"'collect... | All-in-one method for fetching results from a query.
Depending on the type of finder, the returned results will differ.
Before a fetch is executed, a `preFind` event will be triggered.
If this event returns a falsey value, the find will exit and
return a `noResults` value based on the current finder.
If this event ret... | [
"All",
"-",
"in",
"-",
"one",
"method",
"for",
"fetching",
"results",
"from",
"a",
"query",
".",
"Depending",
"on",
"the",
"type",
"of",
"finder",
"the",
"returned",
"results",
"will",
"differ",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L447-L490 |
titon/db | src/Titon/Db/Repository.php | Repository.findID | public function findID(Query $query) {
$pk = $this->getPrimaryKey();
// Gather ID from where clause
foreach ($query->getWhere()->getParams() as $param) {
if ($param instanceof Expr && $param->getField() === $pk && in_array($param->getOperator(), ['=', 'in'])) {
retur... | php | public function findID(Query $query) {
$pk = $this->getPrimaryKey();
// Gather ID from where clause
foreach ($query->getWhere()->getParams() as $param) {
if ($param instanceof Expr && $param->getField() === $pk && in_array($param->getOperator(), ['=', 'in'])) {
retur... | [
"public",
"function",
"findID",
"(",
"Query",
"$",
"query",
")",
"{",
"$",
"pk",
"=",
"$",
"this",
"->",
"getPrimaryKey",
"(",
")",
";",
"// Gather ID from where clause",
"foreach",
"(",
"$",
"query",
"->",
"getWhere",
"(",
")",
"->",
"getParams",
"(",
"... | Find the a primary key value within a query. Begin by looping through the where clause and match any value
that equates to the PK field. If none can be found, do a select query for a list of IDs.
@param \Titon\Db\Query $query
@return int|int[] | [
"Find",
"the",
"a",
"primary",
"key",
"value",
"within",
"a",
"query",
".",
"Begin",
"by",
"looping",
"through",
"the",
"where",
"clause",
"and",
"match",
"any",
"value",
"that",
"equates",
"to",
"the",
"PK",
"field",
".",
"If",
"none",
"can",
"be",
"f... | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L499-L524 |
titon/db | src/Titon/Db/Repository.php | Repository.getBehavior | public function getBehavior($alias) {
if ($this->hasBehavior($alias)) {
return $this->_behaviors[$alias];
}
throw new MissingBehaviorException(sprintf('Behavior %s does not exist', $alias));
} | php | public function getBehavior($alias) {
if ($this->hasBehavior($alias)) {
return $this->_behaviors[$alias];
}
throw new MissingBehaviorException(sprintf('Behavior %s does not exist', $alias));
} | [
"public",
"function",
"getBehavior",
"(",
"$",
"alias",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasBehavior",
"(",
"$",
"alias",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_behaviors",
"[",
"$",
"alias",
"]",
";",
"}",
"throw",
"new",
"MissingBeha... | Return a behavior by alias.
@param string $alias
@return \Titon\Db\Behavior
@throws \Titon\Db\Exception\MissingBehaviorException | [
"Return",
"a",
"behavior",
"by",
"alias",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L542-L548 |
titon/db | src/Titon/Db/Repository.php | Repository.getDisplayField | public function getDisplayField() {
return $this->cache(__METHOD__, function() {
$fields = $this->getConfig('displayField');
$schema = $this->getSchema();
foreach ((array) $fields as $field) {
if ($schema->hasColumn($field)) {
return $fiel... | php | public function getDisplayField() {
return $this->cache(__METHOD__, function() {
$fields = $this->getConfig('displayField');
$schema = $this->getSchema();
foreach ((array) $fields as $field) {
if ($schema->hasColumn($field)) {
return $fiel... | [
"public",
"function",
"getDisplayField",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"cache",
"(",
"__METHOD__",
",",
"function",
"(",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"getConfig",
"(",
"'displayField'",
")",
";",
"$",
"schema",
"=",
"$... | Return the field used as the display field.
@return string | [
"Return",
"the",
"field",
"used",
"as",
"the",
"display",
"field",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L587-L600 |
titon/db | src/Titon/Db/Repository.php | Repository.getDriver | public function getDriver() {
if ($this->_driver) {
return $this->_driver;
}
return $this->_driver = $this->getDatabase()->getDriver($this->getConnectionKey());
} | php | public function getDriver() {
if ($this->_driver) {
return $this->_driver;
}
return $this->_driver = $this->getDatabase()->getDriver($this->getConnectionKey());
} | [
"public",
"function",
"getDriver",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_driver",
")",
"{",
"return",
"$",
"this",
"->",
"_driver",
";",
"}",
"return",
"$",
"this",
"->",
"_driver",
"=",
"$",
"this",
"->",
"getDatabase",
"(",
")",
"->",
"g... | Return the driver defined by key.
@uses Titon\Common\Registry
@return \Titon\Db\Driver | [
"Return",
"the",
"driver",
"defined",
"by",
"key",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L609-L615 |
titon/db | src/Titon/Db/Repository.php | Repository.getFinder | public function getFinder($key) {
if (isset($this->_finders[$key])) {
return $this->_finders[$key];
}
throw new MissingFinderException(sprintf('Finder %s does not exist', $key));
} | php | public function getFinder($key) {
if (isset($this->_finders[$key])) {
return $this->_finders[$key];
}
throw new MissingFinderException(sprintf('Finder %s does not exist', $key));
} | [
"public",
"function",
"getFinder",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_finders",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_finders",
"[",
"$",
"key",
"]",
";",
"}",
"throw",
"new",
... | Return a finder by name.
@param string $key
@return \Titon\Db\Finder
@throws \Titon\Db\Exception\MissingFinderException | [
"Return",
"a",
"finder",
"by",
"name",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L633-L639 |
titon/db | src/Titon/Db/Repository.php | Repository.getPrimaryKey | public function getPrimaryKey() {
return $this->cache(__METHOD__, function() {
$pk = $this->getConfig('primaryKey');
$schema = $this->getSchema();
if ($schema->hasColumn($pk)) {
return $pk;
}
if ($pk = $schema->getPrimaryKey()) {
... | php | public function getPrimaryKey() {
return $this->cache(__METHOD__, function() {
$pk = $this->getConfig('primaryKey');
$schema = $this->getSchema();
if ($schema->hasColumn($pk)) {
return $pk;
}
if ($pk = $schema->getPrimaryKey()) {
... | [
"public",
"function",
"getPrimaryKey",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"cache",
"(",
"__METHOD__",
",",
"function",
"(",
")",
"{",
"$",
"pk",
"=",
"$",
"this",
"->",
"getConfig",
"(",
"'primaryKey'",
")",
";",
"$",
"schema",
"=",
"$",
"th... | Return the field used as the primary, usually the ID.
@return string | [
"Return",
"the",
"field",
"used",
"as",
"the",
"primary",
"usually",
"the",
"ID",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L655-L670 |
titon/db | src/Titon/Db/Repository.php | Repository.getSchema | public function getSchema() {
if ($this->_schema instanceof Schema) {
return $this->_schema;
// Manually defined columns
// Allows for full schema and key/index support
} else if ($this->_schema && is_array($this->_schema)) {
$columns = $this->_schema;
/... | php | public function getSchema() {
if ($this->_schema instanceof Schema) {
return $this->_schema;
// Manually defined columns
// Allows for full schema and key/index support
} else if ($this->_schema && is_array($this->_schema)) {
$columns = $this->_schema;
/... | [
"public",
"function",
"getSchema",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_schema",
"instanceof",
"Schema",
")",
"{",
"return",
"$",
"this",
"->",
"_schema",
";",
"// Manually defined columns",
"// Allows for full schema and key/index support",
"}",
"else",
... | Return a schema object that represents the database table.
@return \Titon\Db\Driver\Schema | [
"Return",
"a",
"schema",
"object",
"that",
"represents",
"the",
"database",
"table",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L677-L695 |
titon/db | src/Titon/Db/Repository.php | Repository.query | public function query($type) {
$query = $this->getDriver()->newQuery($type);
$query->setRepository($this);
$query->from($this->getTable(), $this->getAlias());
return $query;
} | php | public function query($type) {
$query = $this->getDriver()->newQuery($type);
$query->setRepository($this);
$query->from($this->getTable(), $this->getAlias());
return $query;
} | [
"public",
"function",
"query",
"(",
"$",
"type",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"getDriver",
"(",
")",
"->",
"newQuery",
"(",
"$",
"type",
")",
";",
"$",
"query",
"->",
"setRepository",
"(",
"$",
"this",
")",
";",
"$",
"query",
"... | Instantiate a new query builder.
@param string $type
@return \Titon\Db\Query | [
"Instantiate",
"a",
"new",
"query",
"builder",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L786-L792 |
titon/db | src/Titon/Db/Repository.php | Repository.read | public function read($id, array $options = [], Closure $callback = null) {
return $this->select()
->where($this->getPrimaryKey(), $id)
->bindCallback($callback)
->first($options);
} | php | public function read($id, array $options = [], Closure $callback = null) {
return $this->select()
->where($this->getPrimaryKey(), $id)
->bindCallback($callback)
->first($options);
} | [
"public",
"function",
"read",
"(",
"$",
"id",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"Closure",
"$",
"callback",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"select",
"(",
")",
"->",
"where",
"(",
"$",
"this",
"->",
"getPrimaryKe... | Fetch a single record by ID.
@param int $id
@param array $options
@param \Closure $callback
@return \Titon\Db\Entity|array | [
"Fetch",
"a",
"single",
"record",
"by",
"ID",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L802-L807 |
titon/db | src/Titon/Db/Repository.php | Repository.save | public function save(Query $query, array $options = []) {
$type = $query->getType();
if ($type === Query::DELETE) {
return $this->_processDelete($query, $options);
} else if ($type === Query::INSERT) {
return $this->_processCreate($query, $options);
} else if (... | php | public function save(Query $query, array $options = []) {
$type = $query->getType();
if ($type === Query::DELETE) {
return $this->_processDelete($query, $options);
} else if ($type === Query::INSERT) {
return $this->_processCreate($query, $options);
} else if (... | [
"public",
"function",
"save",
"(",
"Query",
"$",
"query",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"type",
"=",
"$",
"query",
"->",
"getType",
"(",
")",
";",
"if",
"(",
"$",
"type",
"===",
"Query",
"::",
"DELETE",
")",
"{",
"... | Return a count of how many rows were affected by the query.
@param \Titon\Db\Query $query
@param array $options
@return int | [
"Return",
"a",
"count",
"of",
"how",
"many",
"rows",
"were",
"affected",
"by",
"the",
"query",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L826-L841 |
titon/db | src/Titon/Db/Repository.php | Repository.update | public function update($id, $data, array $options = []) {
return $this->query(Query::UPDATE)
->where($this->getPrimaryKey(), $id)
->save($data, $options);
} | php | public function update($id, $data, array $options = []) {
return $this->query(Query::UPDATE)
->where($this->getPrimaryKey(), $id)
->save($data, $options);
} | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"$",
"data",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"query",
"(",
"Query",
"::",
"UPDATE",
")",
"->",
"where",
"(",
"$",
"this",
"->",
"getPrimaryKey"... | Update a database record based on ID.
@param int $id
@param array|\Titon\Type\Contract\Arrayable $data
@param array $options
@return int The count of records updated | [
"Update",
"a",
"database",
"record",
"based",
"on",
"ID",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L893-L897 |
titon/db | src/Titon/Db/Repository.php | Repository.updateMany | public function updateMany($data, Closure $conditions, array $options = []) {
return $this->query(Query::UPDATE)
->bindCallback($conditions)
->save($data, $options);
} | php | public function updateMany($data, Closure $conditions, array $options = []) {
return $this->query(Query::UPDATE)
->bindCallback($conditions)
->save($data, $options);
} | [
"public",
"function",
"updateMany",
"(",
"$",
"data",
",",
"Closure",
"$",
"conditions",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"query",
"(",
"Query",
"::",
"UPDATE",
")",
"->",
"bindCallback",
"(",
"$",
"... | Update multiple records with conditions.
@param array|\Titon\Type\Contract\Arrayable $data
@param \Closure $conditions
@param array $options
@return int The count of records updated
@throws \Titon\Db\Exception\InvalidQueryException | [
"Update",
"multiple",
"records",
"with",
"conditions",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L908-L912 |
titon/db | src/Titon/Db/Repository.php | Repository.upsert | public function upsert($data, $id = null, array $options = []) {
$pk = $this->getPrimaryKey();
$update = false;
// Check for an ID in the data
if (!$id && isset($data[$pk])) {
$id = $data[$pk];
}
unset($data[$pk]);
// Check for record existence
... | php | public function upsert($data, $id = null, array $options = []) {
$pk = $this->getPrimaryKey();
$update = false;
// Check for an ID in the data
if (!$id && isset($data[$pk])) {
$id = $data[$pk];
}
unset($data[$pk]);
// Check for record existence
... | [
"public",
"function",
"upsert",
"(",
"$",
"data",
",",
"$",
"id",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"pk",
"=",
"$",
"this",
"->",
"getPrimaryKey",
"(",
")",
";",
"$",
"update",
"=",
"false",
";",
"// Check f... | Either update or insert a record by checking for ID and record existence.
@param array|\Titon\Type\Contract\Arrayable $data
@param int $id
@param array $options
@return int The record ID on success, 0 on failure | [
"Either",
"update",
"or",
"insert",
"a",
"record",
"by",
"checking",
"for",
"ID",
"and",
"record",
"existence",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L922-L950 |
titon/db | src/Titon/Db/Repository.php | Repository._processCreate | protected function _processCreate(Query $query, array $options = []) {
$data = $query->getData();
$options = $options + [
'before' => true,
'after' => true
];
if ($options['before']) {
foreach (['db.preSave', 'db.preCreate'] as $event) {
... | php | protected function _processCreate(Query $query, array $options = []) {
$data = $query->getData();
$options = $options + [
'before' => true,
'after' => true
];
if ($options['before']) {
foreach (['db.preSave', 'db.preCreate'] as $event) {
... | [
"protected",
"function",
"_processCreate",
"(",
"Query",
"$",
"query",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"$",
"query",
"->",
"getData",
"(",
")",
";",
"$",
"options",
"=",
"$",
"options",
"+",
"[",
"'before'",
... | Primary method that handles the processing of insert queries.
Before a save is executed, a `preSave` and `preCreate` event will be triggered.
This event allows data to be modified before saving via references.
If this event returns a falsey value, the save will exit early and
return a 0. This allows behaviors and even... | [
"Primary",
"method",
"that",
"handles",
"the",
"processing",
"of",
"insert",
"queries",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L974-L1013 |
titon/db | src/Titon/Db/Repository.php | Repository._processDelete | protected function _processDelete(Query $query, array $options = []) {
$options = $options + [
'before' => true,
'after' => true
];
// Fetch ID
$this->id = $id = $this->findID($query);
if ($options['before']) {
$event = $this->emit('db.preDel... | php | protected function _processDelete(Query $query, array $options = []) {
$options = $options + [
'before' => true,
'after' => true
];
// Fetch ID
$this->id = $id = $this->findID($query);
if ($options['before']) {
$event = $this->emit('db.preDel... | [
"protected",
"function",
"_processDelete",
"(",
"Query",
"$",
"query",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"options",
"+",
"[",
"'before'",
"=>",
"true",
",",
"'after'",
"=>",
"true",
"]",
";",
"// Fetch ID"... | Primary method that handles the processing of delete queries.
Before a delete is executed, a `preDelete` event will be triggered.
If a falsey value is returned, exit early with a 0. If a numeric value
is returned, exit early and return the number, which acts as a virtual
affected row count (permitting behaviors to sho... | [
"Primary",
"method",
"that",
"handles",
"the",
"processing",
"of",
"delete",
"queries",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L1034-L1066 |
titon/db | src/Titon/Db/Repository.php | Repository._processUpdate | protected function _processUpdate(Query $query, array $options = []) {
$data = $query->getData();
$options = $options + [
'before' => true,
'after' => true
];
// Fetch ID
$this->id = $id = $this->findID($query);
if ($options['before']) {
... | php | protected function _processUpdate(Query $query, array $options = []) {
$data = $query->getData();
$options = $options + [
'before' => true,
'after' => true
];
// Fetch ID
$this->id = $id = $this->findID($query);
if ($options['before']) {
... | [
"protected",
"function",
"_processUpdate",
"(",
"Query",
"$",
"query",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"$",
"query",
"->",
"getData",
"(",
")",
";",
"$",
"options",
"=",
"$",
"options",
"+",
"[",
"'before'",
... | Primary method that handles the processing of update queries.
Before a save is executed, a `preSave` and `preUpdate` event will be triggered.
This event allows data to be modified before saving via references.
If this event returns a falsey value, the save will exit early and
return a 0. This allows behaviors and even... | [
"Primary",
"method",
"that",
"handles",
"the",
"processing",
"of",
"update",
"queries",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Repository.php#L1090-L1129 |
arsengoian/viper-framework | src/Viper/Daemon/DaemonHistorian.php | DaemonHistorian.clearLog | function clearLog() : void
{
@unlink($this -> errLogger -> getFile());
@unlink($this -> logger -> getFile());
@unlink($this -> errLogger -> getFile().'.shell');
@unlink($this -> logger -> getFile().'.shell');
} | php | function clearLog() : void
{
@unlink($this -> errLogger -> getFile());
@unlink($this -> logger -> getFile());
@unlink($this -> errLogger -> getFile().'.shell');
@unlink($this -> logger -> getFile().'.shell');
} | [
"function",
"clearLog",
"(",
")",
":",
"void",
"{",
"@",
"unlink",
"(",
"$",
"this",
"->",
"errLogger",
"->",
"getFile",
"(",
")",
")",
";",
"@",
"unlink",
"(",
"$",
"this",
"->",
"logger",
"->",
"getFile",
"(",
")",
")",
";",
"@",
"unlink",
"(",... | Cleans daemon log | [
"Cleans",
"daemon",
"log"
] | train | https://github.com/arsengoian/viper-framework/blob/22796c5cc219cae3ca0b4af370a347ba2acab0f2/src/Viper/Daemon/DaemonHistorian.php#L75-L81 |
phpmob/changmin | src/PhpMob/CmsBundle/Controller/PageController.php | PageController.viewAction | public function viewAction(Request $request): Response
{
$configuration = $this->requestConfigurationFactory->create($this->metadata, $request);
$this->isGrantedOr403($configuration, ResourceActions::SHOW);
/** @var DefinedTranslationInterface|TemplateAwareInterface|ResourceInterface $reso... | php | public function viewAction(Request $request): Response
{
$configuration = $this->requestConfigurationFactory->create($this->metadata, $request);
$this->isGrantedOr403($configuration, ResourceActions::SHOW);
/** @var DefinedTranslationInterface|TemplateAwareInterface|ResourceInterface $reso... | [
"public",
"function",
"viewAction",
"(",
"Request",
"$",
"request",
")",
":",
"Response",
"{",
"$",
"configuration",
"=",
"$",
"this",
"->",
"requestConfigurationFactory",
"->",
"create",
"(",
"$",
"this",
"->",
"metadata",
",",
"$",
"request",
")",
";",
"... | @param Request $request
@return Response | [
"@param",
"Request",
"$request"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CmsBundle/Controller/PageController.php#L41-L82 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/map/UserRoleTableMap.php | UserRoleTableMap.initialize | public function initialize()
{
// attributes
$this->setName('user_role');
$this->setPhpName('UserRole');
$this->setClassname('Slashworks\\BackendBundle\\Model\\UserRole');
$this->setPackage('src.Slashworks.BackendBundle.Model');
$this->setUseIdGenerator(false);
... | php | public function initialize()
{
// attributes
$this->setName('user_role');
$this->setPhpName('UserRole');
$this->setClassname('Slashworks\\BackendBundle\\Model\\UserRole');
$this->setPackage('src.Slashworks.BackendBundle.Model');
$this->setUseIdGenerator(false);
... | [
"public",
"function",
"initialize",
"(",
")",
"{",
"// attributes",
"$",
"this",
"->",
"setName",
"(",
"'user_role'",
")",
";",
"$",
"this",
"->",
"setPhpName",
"(",
"'UserRole'",
")",
";",
"$",
"this",
"->",
"setClassname",
"(",
"'Slashworks\\\\BackendBundle\... | Initialize the table attributes, columns and validators
Relations are not initialized by this method since they are lazy loaded
@return void
@throws PropelException | [
"Initialize",
"the",
"table",
"attributes",
"columns",
"and",
"validators",
"Relations",
"are",
"not",
"initialized",
"by",
"this",
"method",
"since",
"they",
"are",
"lazy",
"loaded"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/map/UserRoleTableMap.php#L36-L48 |
andrelohmann/silverstripe-geolocation | code/helpers/GeoFunctions.php | GeoFunctions.calcOneOnLng | public static function calcOneOnLng($geo_lat, $scale = 'km'){
switch(strtolower($scale)){
case 'miles':
$earth = 3960;
break;
case 'km':
default:
$earth = 6371;
break;
}
//Point 1 cords
... | php | public static function calcOneOnLng($geo_lat, $scale = 'km'){
switch(strtolower($scale)){
case 'miles':
$earth = 3960;
break;
case 'km':
default:
$earth = 6371;
break;
}
//Point 1 cords
... | [
"public",
"static",
"function",
"calcOneOnLng",
"(",
"$",
"geo_lat",
",",
"$",
"scale",
"=",
"'km'",
")",
"{",
"switch",
"(",
"strtolower",
"(",
"$",
"scale",
")",
")",
"{",
"case",
"'miles'",
":",
"$",
"earth",
"=",
"3960",
";",
"break",
";",
"case"... | errechnet, wieviel Grad Länge bei einem gegebenen Grad Breite = 1KM entsprechen | [
"errechnet",
"wieviel",
"Grad",
"Länge",
"bei",
"einem",
"gegebenen",
"Grad",
"Breite",
"=",
"1KM",
"entsprechen"
] | train | https://github.com/andrelohmann/silverstripe-geolocation/blob/124062008d8fa25b631bf5bb69b2ca79b53ef81b/code/helpers/GeoFunctions.php#L18-L43 |
webforge-labs/psc-cms | lib/Psc/CMS/UploadManager.php | UploadManager.store | public function store(File $file, $description = NULL, $flags = 0x000000) {
$hash = $file->getSha1();
if ($flags & self::IF_NOT_EXISTS) {
try {
$uplFile = $this->load($hash);
if (($flags & self::UPDATE_ORIGINALNAME) && $file instanceof \Psc\System\UploadedFile) {
$u... | php | public function store(File $file, $description = NULL, $flags = 0x000000) {
$hash = $file->getSha1();
if ($flags & self::IF_NOT_EXISTS) {
try {
$uplFile = $this->load($hash);
if (($flags & self::UPDATE_ORIGINALNAME) && $file instanceof \Psc\System\UploadedFile) {
$u... | [
"public",
"function",
"store",
"(",
"File",
"$",
"file",
",",
"$",
"description",
"=",
"NULL",
",",
"$",
"flags",
"=",
"0x000000",
")",
"{",
"$",
"hash",
"=",
"$",
"file",
"->",
"getSha1",
"(",
")",
";",
"if",
"(",
"$",
"flags",
"&",
"self",
"::"... | Speichert eine gewöhnliche Datei als UploadedFile | [
"Speichert",
"eine",
"gewöhnliche",
"Datei",
"als",
"UploadedFile"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/UploadManager.php#L68-L102 |
webforge-labs/psc-cms | lib/Psc/CMS/UploadManager.php | UploadManager.load | public function load($input) {
try {
if ($input instanceof File) {
$input = $input->getSha1();
}
if (is_numeric($input)) {
$uplFile = $this->getRepository()->hydrate((int) $input);
/*
} elseif (is_string($input) && (mb_strpos($input,'/') !== FALSE || mb_strpos($i... | php | public function load($input) {
try {
if ($input instanceof File) {
$input = $input->getSha1();
}
if (is_numeric($input)) {
$uplFile = $this->getRepository()->hydrate((int) $input);
/*
} elseif (is_string($input) && (mb_strpos($input,'/') !== FALSE || mb_strpos($i... | [
"public",
"function",
"load",
"(",
"$",
"input",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"input",
"instanceof",
"File",
")",
"{",
"$",
"input",
"=",
"$",
"input",
"->",
"getSha1",
"(",
")",
";",
"}",
"if",
"(",
"is_numeric",
"(",
"$",
"input",
")",... | Lädt eine Datei aus der Datenbank
@params $input
@param int $input die ID des Entities
//@param string $input der gespeicherte sourcePath des Entities (muss / oder \ enthalten)
@param string $input der sha1 hash des Contents der Datei
@return Psc\CMS\UploadedFile
@throws Psc\CMS\UploadedFileNotFoundException | [
"Lädt",
"eine",
"Datei",
"aus",
"der",
"Datenbank"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/UploadManager.php#L115-L142 |
webforge-labs/psc-cms | lib/Psc/CMS/UploadManager.php | UploadManager.getSourceFile | public function getSourceFile(UploadedFile $uplFile) {
$hash = $uplFile->getHash();
$loaded = FALSE;
return $this->cache->load(array(mb_substr($hash, 0, 1), $hash), $loaded);
} | php | public function getSourceFile(UploadedFile $uplFile) {
$hash = $uplFile->getHash();
$loaded = FALSE;
return $this->cache->load(array(mb_substr($hash, 0, 1), $hash), $loaded);
} | [
"public",
"function",
"getSourceFile",
"(",
"UploadedFile",
"$",
"uplFile",
")",
"{",
"$",
"hash",
"=",
"$",
"uplFile",
"->",
"getHash",
"(",
")",
";",
"$",
"loaded",
"=",
"FALSE",
";",
"return",
"$",
"this",
"->",
"cache",
"->",
"load",
"(",
"array",
... | Gibt für eine UploadedFile die SourceFile (Binary) zurück
@TODO bei anderen Caches die kein FileCache sind muss hier noch die Datei temporär erzeugt werden (sense?)
@return Webforge\Common\System\File | [
"Gibt",
"für",
"eine",
"UploadedFile",
"die",
"SourceFile",
"(",
"Binary",
")",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/UploadManager.php#L182-L186 |
aedart/laravel-helpers | src/Traits/View/BladeTrait.php | BladeTrait.getBlade | public function getBlade(): ?BladeCompiler
{
if (!$this->hasBlade()) {
$this->setBlade($this->getDefaultBlade());
}
return $this->blade;
} | php | public function getBlade(): ?BladeCompiler
{
if (!$this->hasBlade()) {
$this->setBlade($this->getDefaultBlade());
}
return $this->blade;
} | [
"public",
"function",
"getBlade",
"(",
")",
":",
"?",
"BladeCompiler",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasBlade",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setBlade",
"(",
"$",
"this",
"->",
"getDefaultBlade",
"(",
")",
")",
";",
"}",
"retur... | Get blade
If no blade has been set, this method will
set and return a default blade, if any such
value is available
@see getDefaultBlade()
@return BladeCompiler|null blade or null if none blade has been set | [
"Get",
"blade"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/View/BladeTrait.php#L54-L60 |
aedart/laravel-helpers | src/Traits/View/BladeTrait.php | BladeTrait.getDefaultBlade | public function getDefaultBlade(): ?BladeCompiler
{
// The blade compiler is usually only available, once
// Laravel's view service provider has been initialised.
// Thus, before just returning the Blade Facade's root
// instance, we must make sure that the view facade
// act... | php | public function getDefaultBlade(): ?BladeCompiler
{
// The blade compiler is usually only available, once
// Laravel's view service provider has been initialised.
// Thus, before just returning the Blade Facade's root
// instance, we must make sure that the view facade
// act... | [
"public",
"function",
"getDefaultBlade",
"(",
")",
":",
"?",
"BladeCompiler",
"{",
"// The blade compiler is usually only available, once",
"// Laravel's view service provider has been initialised.",
"// Thus, before just returning the Blade Facade's root",
"// instance, we must make sure th... | Get a default blade value, if any is available
@return BladeCompiler|null A default blade value or Null if no default value is available | [
"Get",
"a",
"default",
"blade",
"value",
"if",
"any",
"is",
"available"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/View/BladeTrait.php#L77-L89 |
redaigbaria/oauth2 | src/Exception/OAuthException.php | OAuthException.getHttpHeaders | public function getHttpHeaders()
{
$headers = [];
switch ($this->httpStatusCode) {
case 401:
$headers[] = 'HTTP/1.1 401 Unauthorized';
break;
case 500:
$headers[] = 'HTTP/1.1 500 Internal Server Error';
break;
... | php | public function getHttpHeaders()
{
$headers = [];
switch ($this->httpStatusCode) {
case 401:
$headers[] = 'HTTP/1.1 401 Unauthorized';
break;
case 500:
$headers[] = 'HTTP/1.1 500 Internal Server Error';
break;
... | [
"public",
"function",
"getHttpHeaders",
"(",
")",
"{",
"$",
"headers",
"=",
"[",
"]",
";",
"switch",
"(",
"$",
"this",
"->",
"httpStatusCode",
")",
"{",
"case",
"401",
":",
"$",
"headers",
"[",
"]",
"=",
"'HTTP/1.1 401 Unauthorized'",
";",
"break",
";",
... | Get all headers that have to be send with the error response
@return array Array with header values | [
"Get",
"all",
"headers",
"that",
"have",
"to",
"be",
"send",
"with",
"the",
"error",
"response"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/Exception/OAuthException.php#L95-L144 |
ClanCats/Core | src/classes/CCStorage.php | CCStorage.add | public static function add( $key, $path, $url = null )
{
static::$paths[$key] = $path;
if ( !is_null( $url ) )
{
static::$urls[$key] = $url;
}
} | php | public static function add( $key, $path, $url = null )
{
static::$paths[$key] = $path;
if ( !is_null( $url ) )
{
static::$urls[$key] = $url;
}
} | [
"public",
"static",
"function",
"add",
"(",
"$",
"key",
",",
"$",
"path",
",",
"$",
"url",
"=",
"null",
")",
"{",
"static",
"::",
"$",
"paths",
"[",
"$",
"key",
"]",
"=",
"$",
"path",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"url",
")",
")",... | Adds a new storage directory
@param string $key
@param string $path
@param string $url
@return void | [
"Adds",
"a",
"new",
"storage",
"directory"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStorage.php#L75-L83 |
ClanCats/Core | src/classes/CCStorage.php | CCStorage.file | public static function file( $file )
{
$params = array_merge( static::$params, array(
'time' => time(),
'fingerprint' => \CCSession::fingerprint(),
'random' => CCStr::random(),
));
foreach( $params as $param => $value )
{
$file = str_replace( ':'.$param, $value, $file );
}
return $file;
... | php | public static function file( $file )
{
$params = array_merge( static::$params, array(
'time' => time(),
'fingerprint' => \CCSession::fingerprint(),
'random' => CCStr::random(),
));
foreach( $params as $param => $value )
{
$file = str_replace( ':'.$param, $value, $file );
}
return $file;
... | [
"public",
"static",
"function",
"file",
"(",
"$",
"file",
")",
"{",
"$",
"params",
"=",
"array_merge",
"(",
"static",
"::",
"$",
"params",
",",
"array",
"(",
"'time'",
"=>",
"time",
"(",
")",
",",
"'fingerprint'",
"=>",
"\\",
"CCSession",
"::",
"finger... | Prepares a file with the parameters
@param string $file
@return $file | [
"Prepares",
"a",
"file",
"with",
"the",
"parameters"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStorage.php#L91-L105 |
ClanCats/Core | src/classes/CCStorage.php | CCStorage.path | public static function path( $file = null, $key = null )
{
// get the storage key
if ( is_null( $key ) )
{
$key = static::$default;
}
// check if path exists
if ( !isset( static::$paths[$key] ) )
{
throw new CCException( 'CCStorage - use of undefined storage path '.$key.'.' );
}
if ( st... | php | public static function path( $file = null, $key = null )
{
// get the storage key
if ( is_null( $key ) )
{
$key = static::$default;
}
// check if path exists
if ( !isset( static::$paths[$key] ) )
{
throw new CCException( 'CCStorage - use of undefined storage path '.$key.'.' );
}
if ( st... | [
"public",
"static",
"function",
"path",
"(",
"$",
"file",
"=",
"null",
",",
"$",
"key",
"=",
"null",
")",
"{",
"// get the storage key",
"if",
"(",
"is_null",
"(",
"$",
"key",
")",
")",
"{",
"$",
"key",
"=",
"static",
"::",
"$",
"default",
";",
"}"... | Get a storage path ( absolute )
@param string $file
@param string $key
@return string | [
"Get",
"a",
"storage",
"path",
"(",
"absolute",
")"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStorage.php#L114-L134 |
ClanCats/Core | src/classes/CCStorage.php | CCStorage.url | public static function url( $file = null, $key = null )
{
// get the storage key
if ( is_null( $key ) )
{
$key = static::$default;
}
// check if path exists
if ( !isset( static::$urls[$key] ) )
{
throw new CCException( 'CCStorage - use of undefined public url '.$key.'.' );
}
return CCUrl::... | php | public static function url( $file = null, $key = null )
{
// get the storage key
if ( is_null( $key ) )
{
$key = static::$default;
}
// check if path exists
if ( !isset( static::$urls[$key] ) )
{
throw new CCException( 'CCStorage - use of undefined public url '.$key.'.' );
}
return CCUrl::... | [
"public",
"static",
"function",
"url",
"(",
"$",
"file",
"=",
"null",
",",
"$",
"key",
"=",
"null",
")",
"{",
"// get the storage key",
"if",
"(",
"is_null",
"(",
"$",
"key",
")",
")",
"{",
"$",
"key",
"=",
"static",
"::",
"$",
"default",
";",
"}",... | Get the public url to a file if available
@param string $file
@param string $key
@return string | [
"Get",
"the",
"public",
"url",
"to",
"a",
"file",
"if",
"available"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStorage.php#L143-L158 |
ClanCats/Core | src/classes/CCStorage.php | CCStorage.write | public static function write( $file, $content, $key = null )
{
return CCFile::write( static::path( $file, $key ), $content );
} | php | public static function write( $file, $content, $key = null )
{
return CCFile::write( static::path( $file, $key ), $content );
} | [
"public",
"static",
"function",
"write",
"(",
"$",
"file",
",",
"$",
"content",
",",
"$",
"key",
"=",
"null",
")",
"{",
"return",
"CCFile",
"::",
"write",
"(",
"static",
"::",
"path",
"(",
"$",
"file",
",",
"$",
"key",
")",
",",
"$",
"content",
"... | Write a file to the storage
@param string $file
@param string $key
@return string | [
"Write",
"a",
"file",
"to",
"the",
"storage"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCStorage.php#L167-L170 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.setComment | public function setComment($newComment = NULL) {
if ($this->isFinalized) {
return FALSE;
}
$this->zipComment = $newComment;
return TRUE;
} | php | public function setComment($newComment = NULL) {
if ($this->isFinalized) {
return FALSE;
}
$this->zipComment = $newComment;
return TRUE;
} | [
"public",
"function",
"setComment",
"(",
"$",
"newComment",
"=",
"NULL",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isFinalized",
")",
"{",
"return",
"FALSE",
";",
"}",
"$",
"this",
"->",
"zipComment",
"=",
"$",
"newComment",
";",
"return",
"TRUE",
";",
... | Set Zip archive comment.
@param string $newComment New comment. NULL to clear.
@return bool $success | [
"Set",
"Zip",
"archive",
"comment",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L139-L146 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.setZipFile | public function setZipFile($fileName) {
if (is_file($fileName)) {
unlink($fileName);
}
$fd=fopen($fileName, "x+b");
if (is_resource($this->zipFile)) {
rewind($this->zipFile);
while (!feof($this->zipFile)) {
fwrite($fd, fread($this->zipF... | php | public function setZipFile($fileName) {
if (is_file($fileName)) {
unlink($fileName);
}
$fd=fopen($fileName, "x+b");
if (is_resource($this->zipFile)) {
rewind($this->zipFile);
while (!feof($this->zipFile)) {
fwrite($fd, fread($this->zipF... | [
"public",
"function",
"setZipFile",
"(",
"$",
"fileName",
")",
"{",
"if",
"(",
"is_file",
"(",
"$",
"fileName",
")",
")",
"{",
"unlink",
"(",
"$",
"fileName",
")",
";",
"}",
"$",
"fd",
"=",
"fopen",
"(",
"$",
"fileName",
",",
"\"x+b\"",
")",
";",
... | Set zip file to write zip data to.
This will cause all present and future data written to this class to be written to this file.
This can be used at any time, even after the Zip Archive have been finalized. Any previous file will be closed.
Warning: If the given file already exists, it will be overwritten.
@param stri... | [
"Set",
"zip",
"file",
"to",
"write",
"zip",
"data",
"to",
".",
"This",
"will",
"cause",
"all",
"present",
"and",
"future",
"data",
"written",
"to",
"this",
"class",
"to",
"be",
"written",
"to",
"this",
"file",
".",
"This",
"can",
"be",
"used",
"at",
... | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L157-L176 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.addDirectory | public function addDirectory($directoryPath, $timestamp = 0, $fileComment = NULL, $extFileAttr = self::EXT_FILE_ATTR_DIR) {
if ($this->isFinalized) {
return FALSE;
}
$directoryPath = str_replace("\\", "/", $directoryPath);
$directoryPath = rtrim($directoryPath, "/");
... | php | public function addDirectory($directoryPath, $timestamp = 0, $fileComment = NULL, $extFileAttr = self::EXT_FILE_ATTR_DIR) {
if ($this->isFinalized) {
return FALSE;
}
$directoryPath = str_replace("\\", "/", $directoryPath);
$directoryPath = rtrim($directoryPath, "/");
... | [
"public",
"function",
"addDirectory",
"(",
"$",
"directoryPath",
",",
"$",
"timestamp",
"=",
"0",
",",
"$",
"fileComment",
"=",
"NULL",
",",
"$",
"extFileAttr",
"=",
"self",
"::",
"EXT_FILE_ATTR_DIR",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isFinalized",
... | Add an empty directory entry to the zip archive.
Basically this is only used if an empty directory is added.
@param string $directoryPath Directory Path and name to be added to the archive.
@param int $timestamp (Optional) Timestamp for the added directory, if omitted or set to 0, the current time will be used.... | [
"Add",
"an",
"empty",
"directory",
"entry",
"to",
"the",
"zip",
"archive",
".",
"Basically",
"this",
"is",
"only",
"used",
"if",
"an",
"empty",
"directory",
"is",
"added",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L188-L200 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.addFile | public function addFile($data, $filePath, $timestamp = 0, $fileComment = NULL, $compress = TRUE, $extFileAttr = self::EXT_FILE_ATTR_FILE) {
if ($this->isFinalized) {
return FALSE;
}
if (is_resource($data) && get_resource_type($data) == "stream") {
$this->addLargeFile($da... | php | public function addFile($data, $filePath, $timestamp = 0, $fileComment = NULL, $compress = TRUE, $extFileAttr = self::EXT_FILE_ATTR_FILE) {
if ($this->isFinalized) {
return FALSE;
}
if (is_resource($data) && get_resource_type($data) == "stream") {
$this->addLargeFile($da... | [
"public",
"function",
"addFile",
"(",
"$",
"data",
",",
"$",
"filePath",
",",
"$",
"timestamp",
"=",
"0",
",",
"$",
"fileComment",
"=",
"NULL",
",",
"$",
"compress",
"=",
"TRUE",
",",
"$",
"extFileAttr",
"=",
"self",
"::",
"EXT_FILE_ATTR_FILE",
")",
"{... | Add a file to the archive at the specified location and file name.
@param string $data File data.
@param string $filePath Filepath and name to be used in the archive.
@param int $timestamp (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used.
@param string $file... | [
"Add",
"a",
"file",
"to",
"the",
"archive",
"at",
"the",
"specified",
"location",
"and",
"file",
"name",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L213-L254 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.addDirectoryContent | public function addDirectoryContent($realPath, $zipPath, $recursive = TRUE, $followSymlinks = TRUE, &$addedFiles = array(),
$overrideFilePermissions = FALSE, $extDirAttr = self::EXT_FILE_ATTR_DIR, $extFileAttr = self::EXT_FILE_ATTR_FILE) {
if (file_exists($realPath) && !i... | php | public function addDirectoryContent($realPath, $zipPath, $recursive = TRUE, $followSymlinks = TRUE, &$addedFiles = array(),
$overrideFilePermissions = FALSE, $extDirAttr = self::EXT_FILE_ATTR_DIR, $extFileAttr = self::EXT_FILE_ATTR_FILE) {
if (file_exists($realPath) && !i... | [
"public",
"function",
"addDirectoryContent",
"(",
"$",
"realPath",
",",
"$",
"zipPath",
",",
"$",
"recursive",
"=",
"TRUE",
",",
"$",
"followSymlinks",
"=",
"TRUE",
",",
"&",
"$",
"addedFiles",
"=",
"array",
"(",
")",
",",
"$",
"overrideFilePermissions",
"... | Add the content to a directory.
@author Adam Schmalhofer <Adam.Schmalhofer@gmx.de>
@author A. Grandt
@param string $realPath Path on the file system.
@param string $zipPath Filepath and name to be used in the archive.
@param bool $recursive Add content recursively, default is TRUE.
@param bool $... | [
"Add",
"the",
"content",
"to",
"a",
"directory",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L274-L315 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.addLargeFile | public function addLargeFile($dataFile, $filePath, $timestamp = 0, $fileComment = NULL, $extFileAttr = self::EXT_FILE_ATTR_FILE) {
if ($this->isFinalized) {
return FALSE;
}
if (is_string($dataFile) && is_file($dataFile)) {
$this->processFile($dataFile, $filePath, $time... | php | public function addLargeFile($dataFile, $filePath, $timestamp = 0, $fileComment = NULL, $extFileAttr = self::EXT_FILE_ATTR_FILE) {
if ($this->isFinalized) {
return FALSE;
}
if (is_string($dataFile) && is_file($dataFile)) {
$this->processFile($dataFile, $filePath, $time... | [
"public",
"function",
"addLargeFile",
"(",
"$",
"dataFile",
",",
"$",
"filePath",
",",
"$",
"timestamp",
"=",
"0",
",",
"$",
"fileComment",
"=",
"NULL",
",",
"$",
"extFileAttr",
"=",
"self",
"::",
"EXT_FILE_ATTR_FILE",
")",
"{",
"if",
"(",
"$",
"this",
... | Add a file to the archive at the specified location and file name.
@param string $dataFile File name/path.
@param string $filePath Filepath and name to be used in the archive.
@param int $timestamp (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used.
@param string ... | [
"Add",
"a",
"file",
"to",
"the",
"archive",
"at",
"the",
"specified",
"location",
"and",
"file",
"name",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L327-L344 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.openStream | public function openStream($filePath, $timestamp = 0, $fileComment = null, $extFileAttr = self::EXT_FILE_ATTR_FILE) {
if (!function_exists('sys_get_temp_dir')) {
throw new Exception("Zip " . self::VERSION . " requires PHP version 5.2.1 or above if large files are used.");
}
if ($t... | php | public function openStream($filePath, $timestamp = 0, $fileComment = null, $extFileAttr = self::EXT_FILE_ATTR_FILE) {
if (!function_exists('sys_get_temp_dir')) {
throw new Exception("Zip " . self::VERSION . " requires PHP version 5.2.1 or above if large files are used.");
}
if ($t... | [
"public",
"function",
"openStream",
"(",
"$",
"filePath",
",",
"$",
"timestamp",
"=",
"0",
",",
"$",
"fileComment",
"=",
"null",
",",
"$",
"extFileAttr",
"=",
"self",
"::",
"EXT_FILE_ATTR_FILE",
")",
"{",
"if",
"(",
"!",
"function_exists",
"(",
"'sys_get_t... | Create a stream to be used for large entries.
@param string $filePath Filepath and name to be used in the archive.
@param int $timestamp (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used.
@param string $fileComment (Optional) Comment to be added to the archive for t... | [
"Create",
"a",
"stream",
"to",
"be",
"used",
"for",
"large",
"entries",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L356-L380 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.addStreamData | public function addStreamData($data) {
if ($this->isFinalized || strlen($this->streamFilePath) == 0) {
return FALSE;
}
$length = fwrite($this->streamData, $data, strlen($data));
if ($length != strlen($data)) {
throw new Exception("File IO: Error writing; Length m... | php | public function addStreamData($data) {
if ($this->isFinalized || strlen($this->streamFilePath) == 0) {
return FALSE;
}
$length = fwrite($this->streamData, $data, strlen($data));
if ($length != strlen($data)) {
throw new Exception("File IO: Error writing; Length m... | [
"public",
"function",
"addStreamData",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isFinalized",
"||",
"strlen",
"(",
"$",
"this",
"->",
"streamFilePath",
")",
"==",
"0",
")",
"{",
"return",
"FALSE",
";",
"}",
"$",
"length",
"=",
"fwri... | Add data to the open stream.
@param string $data
@throws Exception Throws an exception in case of errors
@return mixed length in bytes added or FALSE if the archive is finalized or there are no open stream. | [
"Add",
"data",
"to",
"the",
"open",
"stream",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L389-L401 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.closeStream | public function closeStream() {
if ($this->isFinalized || strlen($this->streamFilePath) == 0) {
return FALSE;
}
fflush($this->streamData);
fclose($this->streamData);
$this->processFile($this->streamFile, $this->streamFilePath, $this->streamTimestamp, $this->streamFi... | php | public function closeStream() {
if ($this->isFinalized || strlen($this->streamFilePath) == 0) {
return FALSE;
}
fflush($this->streamData);
fclose($this->streamData);
$this->processFile($this->streamFile, $this->streamFilePath, $this->streamTimestamp, $this->streamFi... | [
"public",
"function",
"closeStream",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isFinalized",
"||",
"strlen",
"(",
"$",
"this",
"->",
"streamFilePath",
")",
"==",
"0",
")",
"{",
"return",
"FALSE",
";",
"}",
"fflush",
"(",
"$",
"this",
"->",
"strea... | Close the current stream.
@return bool $success | [
"Close",
"the",
"current",
"stream",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L408-L431 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.finalize | public function finalize() {
if (!$this->isFinalized) {
if (strlen($this->streamFilePath) > 0) {
$this->closeStream();
}
$cd = implode("", $this->cdRec);
$cdRecSize = pack("v", sizeof($this->cdRec));
$cdRec = $cd . self::ZIP_END_OF_CEN... | php | public function finalize() {
if (!$this->isFinalized) {
if (strlen($this->streamFilePath) > 0) {
$this->closeStream();
}
$cd = implode("", $this->cdRec);
$cdRecSize = pack("v", sizeof($this->cdRec));
$cdRec = $cd . self::ZIP_END_OF_CEN... | [
"public",
"function",
"finalize",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isFinalized",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"this",
"->",
"streamFilePath",
")",
">",
"0",
")",
"{",
"$",
"this",
"->",
"closeStream",
"(",
")",
";",
... | Close the archive.
A closed archive can no longer have new files added to it.
@return bool $success | [
"Close",
"the",
"archive",
".",
"A",
"closed",
"archive",
"can",
"no",
"longer",
"have",
"new",
"files",
"added",
"to",
"it",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L488-L513 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.getZipFile | public function getZipFile() {
if (!$this->isFinalized) {
$this->finalize();
}
$this->zipflush();
rewind($this->zipFile);
return $this->zipFile;
} | php | public function getZipFile() {
if (!$this->isFinalized) {
$this->finalize();
}
$this->zipflush();
rewind($this->zipFile);
return $this->zipFile;
} | [
"public",
"function",
"getZipFile",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isFinalized",
")",
"{",
"$",
"this",
"->",
"finalize",
"(",
")",
";",
"}",
"$",
"this",
"->",
"zipflush",
"(",
")",
";",
"rewind",
"(",
"$",
"this",
"->",
"zip... | Get the handle ressource for the archive zip file.
If the zip haven't been finalized yet, this will cause it to become finalized
@return zip file handle | [
"Get",
"the",
"handle",
"ressource",
"for",
"the",
"archive",
"zip",
"file",
".",
"If",
"the",
"zip",
"haven",
"t",
"been",
"finalized",
"yet",
"this",
"will",
"cause",
"it",
"to",
"become",
"finalized"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L521-L531 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.getZipData | public function getZipData() {
if (!$this->isFinalized) {
$this->finalize();
}
if (!is_resource($this->zipFile)) {
return $this->zipData;
} else {
rewind($this->zipFile);
$filestat = fstat($this->zipFile);
return fread($this->zi... | php | public function getZipData() {
if (!$this->isFinalized) {
$this->finalize();
}
if (!is_resource($this->zipFile)) {
return $this->zipData;
} else {
rewind($this->zipFile);
$filestat = fstat($this->zipFile);
return fread($this->zi... | [
"public",
"function",
"getZipData",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isFinalized",
")",
"{",
"$",
"this",
"->",
"finalize",
"(",
")",
";",
"}",
"if",
"(",
"!",
"is_resource",
"(",
"$",
"this",
"->",
"zipFile",
")",
")",
"{",
"re... | Get the zip file contents
If the zip haven't been finalized yet, this will cause it to become finalized
@return zip data | [
"Get",
"the",
"zip",
"file",
"contents",
"If",
"the",
"zip",
"haven",
"t",
"been",
"finalized",
"yet",
"this",
"will",
"cause",
"it",
"to",
"become",
"finalized"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L539-L550 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.sendZip | function sendZip($fileName = null, $contentType = "application/zip", $utf8FileName = null, $inline = false) {
if (!$this->isFinalized) {
$this->finalize();
}
$headerFile = null;
$headerLine = null;
if(headers_sent($headerFile, $headerLine)) {
throw new Exc... | php | function sendZip($fileName = null, $contentType = "application/zip", $utf8FileName = null, $inline = false) {
if (!$this->isFinalized) {
$this->finalize();
}
$headerFile = null;
$headerLine = null;
if(headers_sent($headerFile, $headerLine)) {
throw new Exc... | [
"function",
"sendZip",
"(",
"$",
"fileName",
"=",
"null",
",",
"$",
"contentType",
"=",
"\"application/zip\"",
",",
"$",
"utf8FileName",
"=",
"null",
",",
"$",
"inline",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isFinalized",
")",
"{"... | Send the archive as a zip download
@param String $fileName The name of the Zip archive, in ISO-8859-1 (or ASCII) encoding, ie. "archive.zip". Optional, defaults to NULL, which means that no ISO-8859-1 encoded file name will be specified.
@param String $contentType Content mime type. Optional, defaults to "application/... | [
"Send",
"the",
"archive",
"as",
"a",
"zip",
"download"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L562-L606 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.getArchiveSize | public function getArchiveSize() {
if (!is_resource($this->zipFile)) {
return strlen($this->zipData);
}
$filestat = fstat($this->zipFile);
return $filestat['size'];
} | php | public function getArchiveSize() {
if (!is_resource($this->zipFile)) {
return strlen($this->zipData);
}
$filestat = fstat($this->zipFile);
return $filestat['size'];
} | [
"public",
"function",
"getArchiveSize",
"(",
")",
"{",
"if",
"(",
"!",
"is_resource",
"(",
"$",
"this",
"->",
"zipFile",
")",
")",
"{",
"return",
"strlen",
"(",
"$",
"this",
"->",
"zipData",
")",
";",
"}",
"$",
"filestat",
"=",
"fstat",
"(",
"$",
"... | Return the current size of the archive
@return $size Size of the archive | [
"Return",
"the",
"current",
"size",
"of",
"the",
"archive"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L613-L620 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.getDosTime | private function getDosTime($timestamp = 0) {
$timestamp = (int)$timestamp;
$oldTZ = @date_default_timezone_get();
date_default_timezone_set('UTC');
$date = ($timestamp == 0 ? getdate() : getdate($timestamp));
date_default_timezone_set($oldTZ);
if ($date["year"] >= 1980) ... | php | private function getDosTime($timestamp = 0) {
$timestamp = (int)$timestamp;
$oldTZ = @date_default_timezone_get();
date_default_timezone_set('UTC');
$date = ($timestamp == 0 ? getdate() : getdate($timestamp));
date_default_timezone_set($oldTZ);
if ($date["year"] >= 1980) ... | [
"private",
"function",
"getDosTime",
"(",
"$",
"timestamp",
"=",
"0",
")",
"{",
"$",
"timestamp",
"=",
"(",
"int",
")",
"$",
"timestamp",
";",
"$",
"oldTZ",
"=",
"@",
"date_default_timezone_get",
"(",
")",
";",
"date_default_timezone_set",
"(",
"'UTC'",
")... | Calculate the 2 byte dostime used in the zip entries.
@param int $timestamp
@return 2-byte encoded DOS Date | [
"Calculate",
"the",
"2",
"byte",
"dostime",
"used",
"in",
"the",
"zip",
"entries",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L628-L639 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.buildZipEntry | private function buildZipEntry($filePath, $fileComment, $gpFlags, $gzType, $timestamp, $fileCRC32, $gzLength, $dataLength, $extFileAttr) {
$filePath = str_replace("\\", "/", $filePath);
$fileCommentLength = (empty($fileComment) ? 0 : strlen($fileComment));
$timestamp = (int)$timestamp;
$... | php | private function buildZipEntry($filePath, $fileComment, $gpFlags, $gzType, $timestamp, $fileCRC32, $gzLength, $dataLength, $extFileAttr) {
$filePath = str_replace("\\", "/", $filePath);
$fileCommentLength = (empty($fileComment) ? 0 : strlen($fileComment));
$timestamp = (int)$timestamp;
$... | [
"private",
"function",
"buildZipEntry",
"(",
"$",
"filePath",
",",
"$",
"fileComment",
",",
"$",
"gpFlags",
",",
"$",
"gzType",
",",
"$",
"timestamp",
",",
"$",
"fileCRC32",
",",
"$",
"gzLength",
",",
"$",
"dataLength",
",",
"$",
"extFileAttr",
")",
"{",... | Build the Zip file structures
@param string $filePath
@param string $fileComment
@param string $gpFlags
@param string $gzType
@param int $timestamp
@param string $fileCRC32
@param int $gzLength
@param int $dataLength
@param int $extFileAttr Use self::EXT_FILE_ATTR_FILE for files, self::EXT_FILE_ATTR_DIR fo... | [
"Build",
"the",
"Zip",
"file",
"structures"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L654-L736 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.pathJoin | public static function pathJoin($dir, $file) {
if (empty($dir) || empty($file)) {
return self::getRelativePath($dir . $file);
}
return self::getRelativePath($dir . '/' . $file);
} | php | public static function pathJoin($dir, $file) {
if (empty($dir) || empty($file)) {
return self::getRelativePath($dir . $file);
}
return self::getRelativePath($dir . '/' . $file);
} | [
"public",
"static",
"function",
"pathJoin",
"(",
"$",
"dir",
",",
"$",
"file",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"dir",
")",
"||",
"empty",
"(",
"$",
"file",
")",
")",
"{",
"return",
"self",
"::",
"getRelativePath",
"(",
"$",
"dir",
".",
"$... | Join $file to $dir path, and clean up any excess slashes.
@param string $dir
@param string $file | [
"Join",
"$file",
"to",
"$dir",
"path",
"and",
"clean",
"up",
"any",
"excess",
"slashes",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L761-L766 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.getRelativePath | public static function getRelativePath($path) {
$path = preg_replace("#/+\.?/+#", "/", str_replace("\\", "/", $path));
$dirs = explode("/", rtrim(preg_replace('#^(?:\./)+#', '', $path), '/'));
$offset = 0;
$sub = 0;
$subOffset = 0;
$root = "";
if (empty($dirs[0]... | php | public static function getRelativePath($path) {
$path = preg_replace("#/+\.?/+#", "/", str_replace("\\", "/", $path));
$dirs = explode("/", rtrim(preg_replace('#^(?:\./)+#', '', $path), '/'));
$offset = 0;
$sub = 0;
$subOffset = 0;
$root = "";
if (empty($dirs[0]... | [
"public",
"static",
"function",
"getRelativePath",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"preg_replace",
"(",
"\"#/+\\.?/+#\"",
",",
"\"/\"",
",",
"str_replace",
"(",
"\"\\\\\"",
",",
"\"/\"",
",",
"$",
"path",
")",
")",
";",
"$",
"dirs",
"=",
... | Clean up a path, removing any unnecessary elements such as /./, // or redundant ../ segments.
If the path starts with a "/", it is deemed an absolute path and any /../ in the beginning is stripped off.
The returned path will not end in a "/".
Sometimes, when a path is generated from multiple fragments,
you can get som... | [
"Clean",
"up",
"a",
"path",
"removing",
"any",
"unnecessary",
"elements",
"such",
"as",
"/",
".",
"/",
"//",
"or",
"redundant",
"..",
"/",
"segments",
".",
"If",
"the",
"path",
"starts",
"with",
"a",
"/",
"it",
"is",
"deemed",
"an",
"absolute",
"path",... | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L780-L817 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.generateExtAttr | public static function generateExtAttr($owner = 07, $group = 05, $other = 05, $isFile = true) {
$fp = $isFile ? self::S_IFREG : self::S_IFDIR;
$fp |= (($owner & 07) << 6) | (($group & 07) << 3) | ($other & 07);
return ($fp << 16) | ($isFile ? self::S_DOS_A : self::S_DOS_D);
} | php | public static function generateExtAttr($owner = 07, $group = 05, $other = 05, $isFile = true) {
$fp = $isFile ? self::S_IFREG : self::S_IFDIR;
$fp |= (($owner & 07) << 6) | (($group & 07) << 3) | ($other & 07);
return ($fp << 16) | ($isFile ? self::S_DOS_A : self::S_DOS_D);
} | [
"public",
"static",
"function",
"generateExtAttr",
"(",
"$",
"owner",
"=",
"07",
",",
"$",
"group",
"=",
"05",
",",
"$",
"other",
"=",
"05",
",",
"$",
"isFile",
"=",
"true",
")",
"{",
"$",
"fp",
"=",
"$",
"isFile",
"?",
"self",
"::",
"S_IFREG",
"... | Create the file permissions for a file or directory, for use in the extFileAttr parameters.
@param int $owner Unix permisions for owner (octal from 00 to 07)
@param int $group Unix permisions for group (octal from 00 to 07)
@param int $other Unix permisions for others (octal from 00 to 07)
@param bool $isFile
@... | [
"Create",
"the",
"file",
"permissions",
"for",
"a",
"file",
"or",
"directory",
"for",
"use",
"in",
"the",
"extFileAttr",
"parameters",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L828-L833 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.getFileExtAttr | public static function getFileExtAttr($filename) {
if (file_exists($filename)) {
$fp = fileperms($filename) << 16;
return $fp | (is_dir($filename) ? self::S_DOS_D : self::S_DOS_A);
}
return FALSE;
} | php | public static function getFileExtAttr($filename) {
if (file_exists($filename)) {
$fp = fileperms($filename) << 16;
return $fp | (is_dir($filename) ? self::S_DOS_D : self::S_DOS_A);
}
return FALSE;
} | [
"public",
"static",
"function",
"getFileExtAttr",
"(",
"$",
"filename",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"filename",
")",
")",
"{",
"$",
"fp",
"=",
"fileperms",
"(",
"$",
"filename",
")",
"<<",
"16",
";",
"return",
"$",
"fp",
"|",
"(",
... | Get the file permissions for a file or directory, for use in the extFileAttr parameters.
@param string $filename
@return external ref field, or FALSE if the file is not found. | [
"Get",
"the",
"file",
"permissions",
"for",
"a",
"file",
"or",
"directory",
"for",
"use",
"in",
"the",
"extFileAttr",
"parameters",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L841-L847 |
slashworks/control-bundle | src/Slashworks/AppBundle/Resources/private/api/zip.lib.php | Zip.getTemporaryFile | private static function getTemporaryFile() {
if(is_callable(self::$temp)) {
$temporaryFile = @call_user_func(self::$temp);
if(is_string($temporaryFile) && strlen($temporaryFile) && is_writable($temporaryFile)) {
return $temporaryFile;
}
}
$temp... | php | private static function getTemporaryFile() {
if(is_callable(self::$temp)) {
$temporaryFile = @call_user_func(self::$temp);
if(is_string($temporaryFile) && strlen($temporaryFile) && is_writable($temporaryFile)) {
return $temporaryFile;
}
}
$temp... | [
"private",
"static",
"function",
"getTemporaryFile",
"(",
")",
"{",
"if",
"(",
"is_callable",
"(",
"self",
"::",
"$",
"temp",
")",
")",
"{",
"$",
"temporaryFile",
"=",
"@",
"call_user_func",
"(",
"self",
"::",
"$",
"temp",
")",
";",
"if",
"(",
"is_stri... | Returns the path to a temporary file.
@return string | [
"Returns",
"the",
"path",
"to",
"a",
"temporary",
"file",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Resources/private/api/zip.lib.php#L852-L861 |
webforge-labs/psc-cms | lib/Psc/Form/Validator.php | Validator.validate | public function validate($field, $data = NULL, $flags = 0x000000) {
$key = $this->getKey($field);
if (isset($this->dataProvider)) {
$data = $this->dataProvider->getValidatorData($field);
}
if ($this->hasField($field)) {
try {
foreach ($this->rules[$key] as... | php | public function validate($field, $data = NULL, $flags = 0x000000) {
$key = $this->getKey($field);
if (isset($this->dataProvider)) {
$data = $this->dataProvider->getValidatorData($field);
}
if ($this->hasField($field)) {
try {
foreach ($this->rules[$key] as... | [
"public",
"function",
"validate",
"(",
"$",
"field",
",",
"$",
"data",
"=",
"NULL",
",",
"$",
"flags",
"=",
"0x000000",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getKey",
"(",
"$",
"field",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"... | Validiert die Daten zu einem Feld
gibt die Daten zurück!
Wenn das Feld nicht validiert werden, wird eine Exception geworfen!
@throws ValidatorException wenn die Daten nicht zum Feld passen
ist $flags OPTIONAL gesetzt und wird die Rule eine EmptyDataException werfen, wird der DefaultWert (normal: NULL) der Exception z... | [
"Validiert",
"die",
"Daten",
"zu",
"einem",
"Feld"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Form/Validator.php#L53-L89 |
webforge-labs/psc-cms | lib/Psc/Form/Validator.php | Validator.addRule | public function addRule(ValidatorRule $rule, $field, $flags = 0x00000) {
$key = $this->getKey($field);
$this->rules[$key][] = $rule;
if ($rule instanceof FieldValidatorRule) {
$rule->setField($field);
}
if ($flags & self::OPTIONAL) {
$this->setOptional($field);
}
} | php | public function addRule(ValidatorRule $rule, $field, $flags = 0x00000) {
$key = $this->getKey($field);
$this->rules[$key][] = $rule;
if ($rule instanceof FieldValidatorRule) {
$rule->setField($field);
}
if ($flags & self::OPTIONAL) {
$this->setOptional($field);
}
} | [
"public",
"function",
"addRule",
"(",
"ValidatorRule",
"$",
"rule",
",",
"$",
"field",
",",
"$",
"flags",
"=",
"0x00000",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getKey",
"(",
"$",
"field",
")",
";",
"$",
"this",
"->",
"rules",
"[",
"$",
"... | Fügt einem Feld eine ValidationRule hinzu
die Reihenfolge der Rules ist wichtig, denn die zweite Rule bekommt die Rückgabe der ersten Rule | [
"Fügt",
"einem",
"Feld",
"eine",
"ValidationRule",
"hinzu"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Form/Validator.php#L139-L150 |
webforge-labs/psc-cms | lib/Psc/Form/Validator.php | Validator.addRuleToAll | public function addRuleToAll(ValidatorRule $rule, $position = self::APPEND) {
if ($position == self::APPEND) {
foreach ($this->rules as $key => $NULL) {
array_push($this->rules[$key],$rule);
}
}
if ($position == self::PREPEND) {
foreach ($this->rules as $key => $NULL) {
... | php | public function addRuleToAll(ValidatorRule $rule, $position = self::APPEND) {
if ($position == self::APPEND) {
foreach ($this->rules as $key => $NULL) {
array_push($this->rules[$key],$rule);
}
}
if ($position == self::PREPEND) {
foreach ($this->rules as $key => $NULL) {
... | [
"public",
"function",
"addRuleToAll",
"(",
"ValidatorRule",
"$",
"rule",
",",
"$",
"position",
"=",
"self",
"::",
"APPEND",
")",
"{",
"if",
"(",
"$",
"position",
"==",
"self",
"::",
"APPEND",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"rules",
"as",
... | Fügt allen Feldern eine bestimmte Rule zurück
@param style bestimmt die Position der Rule (append oder prepend) | [
"Fügt",
"allen",
"Feldern",
"eine",
"bestimmte",
"Rule",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Form/Validator.php#L181-L201 |
PortaText/php-sdk | src/PortaText/Command/Api/Sounds.php | Sounds.getBody | protected function getBody($method)
{
$file = $this->getArgument("sound_file");
if (!is_null($file)) {
return "file:$file";
}
return parent::getBody($method);
} | php | protected function getBody($method)
{
$file = $this->getArgument("sound_file");
if (!is_null($file)) {
return "file:$file";
}
return parent::getBody($method);
} | [
"protected",
"function",
"getBody",
"(",
"$",
"method",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"getArgument",
"(",
"\"sound_file\"",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"file",
")",
")",
"{",
"return",
"\"file:$file\"",
";",
"}",
"... | Returns the body for this endpoint.
@param string $method Method for this command.
@return string | [
"Returns",
"the",
"body",
"for",
"this",
"endpoint",
"."
] | train | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Api/Sounds.php#L87-L94 |
PortaText/php-sdk | src/PortaText/Command/Api/Sounds.php | Sounds.getEndpoint | protected function getEndpoint($method)
{
$endpoint = "sounds";
$soundId = $this->getArgument("id");
if (!is_null($soundId)) {
$endpoint .= "/$soundId";
$this->delArgument("id");
}
$queryString = array();
$name = $this->getArgument("name");
... | php | protected function getEndpoint($method)
{
$endpoint = "sounds";
$soundId = $this->getArgument("id");
if (!is_null($soundId)) {
$endpoint .= "/$soundId";
$this->delArgument("id");
}
$queryString = array();
$name = $this->getArgument("name");
... | [
"protected",
"function",
"getEndpoint",
"(",
"$",
"method",
")",
"{",
"$",
"endpoint",
"=",
"\"sounds\"",
";",
"$",
"soundId",
"=",
"$",
"this",
"->",
"getArgument",
"(",
"\"id\"",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"soundId",
")",
")",
"... | Returns a string with the endpoint for the given command.
@param string $method Method for this command.
@return string | [
"Returns",
"a",
"string",
"with",
"the",
"endpoint",
"for",
"the",
"given",
"command",
"."
] | train | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Api/Sounds.php#L103-L127 |
steeffeen/FancyManiaLinks | FML/Stylesheet/Mood.php | Mood.setLightAmbientColor | public function setLightAmbientColor($red, $green, $blue)
{
$this->lightAmbientColor = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
} | php | public function setLightAmbientColor($red, $green, $blue)
{
$this->lightAmbientColor = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
} | [
"public",
"function",
"setLightAmbientColor",
"(",
"$",
"red",
",",
"$",
"green",
",",
"$",
"blue",
")",
"{",
"$",
"this",
"->",
"lightAmbientColor",
"=",
"floatval",
"(",
"$",
"red",
")",
".",
"' '",
".",
"floatval",
"(",
"$",
"green",
")",
".",
"' ... | Set the ambient color in which elements reflect the light
@api
@param float $red Red color value
@param float $green Green color value
@param float $blue Blue color value
@return static | [
"Set",
"the",
"ambient",
"color",
"in",
"which",
"elements",
"reflect",
"the",
"light"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Stylesheet/Mood.php#L117-L121 |
steeffeen/FancyManiaLinks | FML/Stylesheet/Mood.php | Mood.setCloudsMinimumColor | public function setCloudsMinimumColor($red, $green, $blue)
{
$this->cloudsMinimumColor = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
} | php | public function setCloudsMinimumColor($red, $green, $blue)
{
$this->cloudsMinimumColor = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
} | [
"public",
"function",
"setCloudsMinimumColor",
"(",
"$",
"red",
",",
"$",
"green",
",",
"$",
"blue",
")",
"{",
"$",
"this",
"->",
"cloudsMinimumColor",
"=",
"floatval",
"(",
"$",
"red",
")",
".",
"' '",
".",
"floatval",
"(",
"$",
"green",
")",
".",
"... | Set the minimum value for the background color range
@api
@param float $red Red color value
@param float $green Green color value
@param float $blue Blue color value
@return static | [
"Set",
"the",
"minimum",
"value",
"for",
"the",
"background",
"color",
"range"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Stylesheet/Mood.php#L143-L147 |
steeffeen/FancyManiaLinks | FML/Stylesheet/Mood.php | Mood.setCloudsMaximumColor | public function setCloudsMaximumColor($red, $green, $blue)
{
$this->cloudsMaximumColor = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
} | php | public function setCloudsMaximumColor($red, $green, $blue)
{
$this->cloudsMaximumColor = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
} | [
"public",
"function",
"setCloudsMaximumColor",
"(",
"$",
"red",
",",
"$",
"green",
",",
"$",
"blue",
")",
"{",
"$",
"this",
"->",
"cloudsMaximumColor",
"=",
"floatval",
"(",
"$",
"red",
")",
".",
"' '",
".",
"floatval",
"(",
"$",
"green",
")",
".",
"... | Set the maximum value for the background color range
@api
@param float $red Red color value
@param float $green Green color value
@param float $blue Blue color value
@return static | [
"Set",
"the",
"maximum",
"value",
"for",
"the",
"background",
"color",
"range"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Stylesheet/Mood.php#L169-L173 |
steeffeen/FancyManiaLinks | FML/Stylesheet/Mood.php | Mood.setLight0Color | public function setLight0Color($red, $green, $blue)
{
$this->light0Color = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
} | php | public function setLight0Color($red, $green, $blue)
{
$this->light0Color = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
} | [
"public",
"function",
"setLight0Color",
"(",
"$",
"red",
",",
"$",
"green",
",",
"$",
"blue",
")",
"{",
"$",
"this",
"->",
"light0Color",
"=",
"floatval",
"(",
"$",
"red",
")",
".",
"' '",
".",
"floatval",
"(",
"$",
"green",
")",
".",
"' '",
".",
... | Set the RGB color of light source 0
@api
@param float $red Red color value
@param float $green Green color value
@param float $blue Blue color value
@return static | [
"Set",
"the",
"RGB",
"color",
"of",
"light",
"source",
"0"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Stylesheet/Mood.php#L195-L199 |
steeffeen/FancyManiaLinks | FML/Stylesheet/Mood.php | Mood.setLightBallColor | public function setLightBallColor($red, $green, $blue)
{
$this->lightBallColor = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
} | php | public function setLightBallColor($red, $green, $blue)
{
$this->lightBallColor = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
} | [
"public",
"function",
"setLightBallColor",
"(",
"$",
"red",
",",
"$",
"green",
",",
"$",
"blue",
")",
"{",
"$",
"this",
"->",
"lightBallColor",
"=",
"floatval",
"(",
"$",
"red",
")",
".",
"' '",
".",
"floatval",
"(",
"$",
"green",
")",
".",
"' '",
... | Set the light ball color
@api
@param float $red Red color value
@param float $green Green color value
@param float $blue Blue color value
@return static | [
"Set",
"the",
"light",
"ball",
"color"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Stylesheet/Mood.php#L293-L297 |
steeffeen/FancyManiaLinks | FML/Stylesheet/Mood.php | Mood.setFogColor | public function setFogColor($red, $green, $blue)
{
$this->fogColor = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
} | php | public function setFogColor($red, $green, $blue)
{
$this->fogColor = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
} | [
"public",
"function",
"setFogColor",
"(",
"$",
"red",
",",
"$",
"green",
",",
"$",
"blue",
")",
"{",
"$",
"this",
"->",
"fogColor",
"=",
"floatval",
"(",
"$",
"red",
")",
".",
"' '",
".",
"floatval",
"(",
"$",
"green",
")",
".",
"' '",
".",
"floa... | Set the fog color
@api
@param float $red Red color value
@param float $green Green color value
@param float $blue Blue color value
@return static | [
"Set",
"the",
"fog",
"color"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Stylesheet/Mood.php#L367-L371 |
steeffeen/FancyManiaLinks | FML/Stylesheet/Mood.php | Mood.setSelfIlluminationColor | public function setSelfIlluminationColor($red, $green, $blue)
{
$this->selfIlluminationColor = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
} | php | public function setSelfIlluminationColor($red, $green, $blue)
{
$this->selfIlluminationColor = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
} | [
"public",
"function",
"setSelfIlluminationColor",
"(",
"$",
"red",
",",
"$",
"green",
",",
"$",
"blue",
")",
"{",
"$",
"this",
"->",
"selfIlluminationColor",
"=",
"floatval",
"(",
"$",
"red",
")",
".",
"' '",
".",
"floatval",
"(",
"$",
"green",
")",
".... | Set the self illumination color
@api
@param float $red Red color value
@param float $green Green color value
@param float $blue Blue color value
@return static | [
"Set",
"the",
"self",
"illumination",
"color"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Stylesheet/Mood.php#L393-L397 |
steeffeen/FancyManiaLinks | FML/Stylesheet/Mood.php | Mood.addSkyGradient | public function addSkyGradient($x, $color)
{
$skyGradientKey = new SkyGradientKey($x, $color);
return $this->addSkyGradientKey($skyGradientKey);
} | php | public function addSkyGradient($x, $color)
{
$skyGradientKey = new SkyGradientKey($x, $color);
return $this->addSkyGradientKey($skyGradientKey);
} | [
"public",
"function",
"addSkyGradient",
"(",
"$",
"x",
",",
"$",
"color",
")",
"{",
"$",
"skyGradientKey",
"=",
"new",
"SkyGradientKey",
"(",
"$",
"x",
",",
"$",
"color",
")",
";",
"return",
"$",
"this",
"->",
"addSkyGradientKey",
"(",
"$",
"skyGradientK... | Add a sky gradient
@api
@param float $x X value
@param string $color Color value
@return static | [
"Add",
"a",
"sky",
"gradient"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Stylesheet/Mood.php#L455-L459 |
steeffeen/FancyManiaLinks | FML/Stylesheet/Mood.php | Mood.render | public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("mood");
if ($this->lightAmbientColor) {
$domElement->setAttribute("LAmbient_LinearRgb", $this->lightAmbientColor);
}
if ($this->cloudsMinimumColor) {
$domElement->se... | php | public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("mood");
if ($this->lightAmbientColor) {
$domElement->setAttribute("LAmbient_LinearRgb", $this->lightAmbientColor);
}
if ($this->cloudsMinimumColor) {
$domElement->se... | [
"public",
"function",
"render",
"(",
"\\",
"DOMDocument",
"$",
"domDocument",
")",
"{",
"$",
"domElement",
"=",
"$",
"domDocument",
"->",
"createElement",
"(",
"\"mood\"",
")",
";",
"if",
"(",
"$",
"this",
"->",
"lightAmbientColor",
")",
"{",
"$",
"domElem... | Render the Mood
@param \DOMDocument $domDocument DOMDocument for which the Mood should be rendered
@return \DOMElement | [
"Render",
"the",
"Mood"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Stylesheet/Mood.php#L479-L530 |
left-right/center | src/controllers/RowController.php | RowController.index | public function index($table_name, $linked_field=false, $linked_row=false) {
# Get info about the object
$table = config('center.tables.' . $table_name);
//dd($table);
# Trail
if (!$linked_field) Trail::clear();
# Security -- todo hidden?
if (!isset($table->name)) {
return redirect()->action('\L... | php | public function index($table_name, $linked_field=false, $linked_row=false) {
# Get info about the object
$table = config('center.tables.' . $table_name);
//dd($table);
# Trail
if (!$linked_field) Trail::clear();
# Security -- todo hidden?
if (!isset($table->name)) {
return redirect()->action('\L... | [
"public",
"function",
"index",
"(",
"$",
"table_name",
",",
"$",
"linked_field",
"=",
"false",
",",
"$",
"linked_row",
"=",
"false",
")",
"{",
"# Get info about the object",
"$",
"table",
"=",
"config",
"(",
"'center.tables.'",
".",
"$",
"table_name",
")",
"... | # $linked_field and $linked_row are for when coming from a linked object | [
"#",
"$linked_field",
"and",
"$linked_row",
"are",
"for",
"when",
"coming",
"from",
"a",
"linked",
"object"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/RowController.php#L32-L196 |
left-right/center | src/controllers/RowController.php | RowController.create | public function create($table, $linked_field=false, $linked_row=false) {
$tables = config('center.tables');
$table = config('center.tables.' . $table);
# Security
if (!isset($table->name)) {
return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.t... | php | public function create($table, $linked_field=false, $linked_row=false) {
$tables = config('center.tables');
$table = config('center.tables.' . $table);
# Security
if (!isset($table->name)) {
return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.t... | [
"public",
"function",
"create",
"(",
"$",
"table",
",",
"$",
"linked_field",
"=",
"false",
",",
"$",
"linked_row",
"=",
"false",
")",
"{",
"$",
"tables",
"=",
"config",
"(",
"'center.tables'",
")",
";",
"$",
"table",
"=",
"config",
"(",
"'center.tables.'... | show create form for an object instance | [
"show",
"create",
"form",
"for",
"an",
"object",
"instance"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/RowController.php#L199-L265 |
left-right/center | src/controllers/RowController.php | RowController.store | public function store($table) {
$table = config('center.tables.' . $table);
# Security
if (!isset($table->name)) {
return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.table_does_not_exist'));
}
$inserts = self::processColumnsInput($table);
... | php | public function store($table) {
$table = config('center.tables.' . $table);
# Security
if (!isset($table->name)) {
return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.table_does_not_exist'));
}
$inserts = self::processColumnsInput($table);
... | [
"public",
"function",
"store",
"(",
"$",
"table",
")",
"{",
"$",
"table",
"=",
"config",
"(",
"'center.tables.'",
".",
"$",
"table",
")",
";",
"# Security",
"if",
"(",
"!",
"isset",
"(",
"$",
"table",
"->",
"name",
")",
")",
"{",
"return",
"redirect"... | save a new object instance to the database | [
"save",
"a",
"new",
"object",
"instance",
"to",
"the",
"database"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/RowController.php#L268-L313 |
left-right/center | src/controllers/RowController.php | RowController.edit | public function edit($table, $row_id, $linked_field=false, $linked_row=false) {
# Get object / field / whatever infoz
$table = config('center.tables.' . $table);
$tables = config('center.tables');
# Security
if (!isset($table->name)) {
return redirect()->action('\LeftRight\Center\Controllers\TableContro... | php | public function edit($table, $row_id, $linked_field=false, $linked_row=false) {
# Get object / field / whatever infoz
$table = config('center.tables.' . $table);
$tables = config('center.tables');
# Security
if (!isset($table->name)) {
return redirect()->action('\LeftRight\Center\Controllers\TableContro... | [
"public",
"function",
"edit",
"(",
"$",
"table",
",",
"$",
"row_id",
",",
"$",
"linked_field",
"=",
"false",
",",
"$",
"linked_row",
"=",
"false",
")",
"{",
"# Get object / field / whatever infoz",
"$",
"table",
"=",
"config",
"(",
"'center.tables.'",
".",
"... | show edit form | [
"show",
"edit",
"form"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/RowController.php#L316-L424 |
left-right/center | src/controllers/RowController.php | RowController.update | public function update($table, $row_id) {
$table = config('center.tables.' . $table);
# Security
if (!isset($table->name)) {
return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.table_does_not_exist'));
}
//sanitize and convert input to arr... | php | public function update($table, $row_id) {
$table = config('center.tables.' . $table);
# Security
if (!isset($table->name)) {
return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.table_does_not_exist'));
}
//sanitize and convert input to arr... | [
"public",
"function",
"update",
"(",
"$",
"table",
",",
"$",
"row_id",
")",
"{",
"$",
"table",
"=",
"config",
"(",
"'center.tables.'",
".",
"$",
"table",
")",
";",
"# Security",
"if",
"(",
"!",
"isset",
"(",
"$",
"table",
"->",
"name",
")",
")",
"{... | # Save edits to database | [
"#",
"Save",
"edits",
"to",
"database"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/RowController.php#L427-L453 |
left-right/center | src/controllers/RowController.php | RowController.destroy | public function destroy($table, $row_id) {
$table = config('center.tables.' . $table);
# Security
if (!isset($table->name)) {
return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.table_does_not_exist'));
}
DB::table($table->name)->where('id',... | php | public function destroy($table, $row_id) {
$table = config('center.tables.' . $table);
# Security
if (!isset($table->name)) {
return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.table_does_not_exist'));
}
DB::table($table->name)->where('id',... | [
"public",
"function",
"destroy",
"(",
"$",
"table",
",",
"$",
"row_id",
")",
"{",
"$",
"table",
"=",
"config",
"(",
"'center.tables.'",
".",
"$",
"table",
")",
";",
"# Security",
"if",
"(",
"!",
"isset",
"(",
"$",
"table",
"->",
"name",
")",
")",
"... | # Remove object from db - todo check for foreign key constraints | [
"#",
"Remove",
"object",
"from",
"db",
"-",
"todo",
"check",
"for",
"foreign",
"key",
"constraints"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/RowController.php#L456-L467 |
left-right/center | src/controllers/RowController.php | RowController.reorder | public function reorder($table) {
$table = config('center.tables.' . $table);
# Security
if (!isset($table->name)) {
return;
}
//determine whether nested
$table->nested = false;
if (!empty($table->group_by_field)) {
$grouped_field = DB::table(config('center.db.fields'))->where('id', $table->group_... | php | public function reorder($table) {
$table = config('center.tables.' . $table);
# Security
if (!isset($table->name)) {
return;
}
//determine whether nested
$table->nested = false;
if (!empty($table->group_by_field)) {
$grouped_field = DB::table(config('center.db.fields'))->where('id', $table->group_... | [
"public",
"function",
"reorder",
"(",
"$",
"table",
")",
"{",
"$",
"table",
"=",
"config",
"(",
"'center.tables.'",
".",
"$",
"table",
")",
";",
"# Security",
"if",
"(",
"!",
"isset",
"(",
"$",
"table",
"->",
"name",
")",
")",
"{",
"return",
";",
"... | # Reorder fields by drag-and-drop | [
"#",
"Reorder",
"fields",
"by",
"drag",
"-",
"and",
"-",
"drop"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/RowController.php#L470-L513 |
left-right/center | src/controllers/RowController.php | RowController.delete | public function delete($table, $row_id) {
$table = config('center.tables.' . $table);
# Security
if (!isset($table->name)) {
return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.table_does_not_exist'));
}
//toggle instance with active or in... | php | public function delete($table, $row_id) {
$table = config('center.tables.' . $table);
# Security
if (!isset($table->name)) {
return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.table_does_not_exist'));
}
//toggle instance with active or in... | [
"public",
"function",
"delete",
"(",
"$",
"table",
",",
"$",
"row_id",
")",
"{",
"$",
"table",
"=",
"config",
"(",
"'center.tables.'",
".",
"$",
"table",
")",
";",
"# Security",
"if",
"(",
"!",
"isset",
"(",
"$",
"table",
"->",
"name",
")",
")",
"{... | # Soft delete | [
"#",
"Soft",
"delete"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/RowController.php#L516-L545 |
left-right/center | src/controllers/RowController.php | RowController.processColumnsInput | private static function processColumnsInput($table, $row_id=false) {
//metadata
$return = [];
if (property_exists($table->fields, 'updated_at')) $return['updated_at'] = new DateTime;
if (property_exists($table->fields, 'updated_by')) $return['updated_by'] = Auth::user()->id;
if (!$row_id) {
if (property... | php | private static function processColumnsInput($table, $row_id=false) {
//metadata
$return = [];
if (property_exists($table->fields, 'updated_at')) $return['updated_at'] = new DateTime;
if (property_exists($table->fields, 'updated_by')) $return['updated_by'] = Auth::user()->id;
if (!$row_id) {
if (property... | [
"private",
"static",
"function",
"processColumnsInput",
"(",
"$",
"table",
",",
"$",
"row_id",
"=",
"false",
")",
"{",
"//metadata",
"$",
"return",
"=",
"[",
"]",
";",
"if",
"(",
"property_exists",
"(",
"$",
"table",
"->",
"fields",
",",
"'updated_at'",
... | # Process Column Input | [
"#",
"Process",
"Column",
"Input"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/RowController.php#L548-L634 |
left-right/center | src/controllers/RowController.php | RowController.processRelationsInput | private static function processRelationsInput($table, $row_id) {
foreach ($table->fields as $field) {
if ($field->type == 'checkboxes') {
# Figure out schema
$object_column = self::formatKeyColumn($table->name);
$remote_column = self::formatKeyColumn($field->source);
# Clear old values
D... | php | private static function processRelationsInput($table, $row_id) {
foreach ($table->fields as $field) {
if ($field->type == 'checkboxes') {
# Figure out schema
$object_column = self::formatKeyColumn($table->name);
$remote_column = self::formatKeyColumn($field->source);
# Clear old values
D... | [
"private",
"static",
"function",
"processRelationsInput",
"(",
"$",
"table",
",",
"$",
"row_id",
")",
"{",
"foreach",
"(",
"$",
"table",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"->",
"type",
"==",
"'checkboxes'",
")",
"{"... | run relationship updates on input (used by store and update) | [
"run",
"relationship",
"updates",
"on",
"input",
"(",
"used",
"by",
"store",
"and",
"update",
")"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/RowController.php#L637-L689 |
left-right/center | src/controllers/RowController.php | RowController.nestedNodeExists | private function nestedNodeExists(&$array, $parent_id, $child) {
foreach ($array as &$a) {
if ($a->id == $parent_id) {
$a->children[] = $child;
return true;
} elseif (count($a->children) && self::nestedNodeExists($a->children, $parent_id, $child)) {
return true;
}
}
return false;
} | php | private function nestedNodeExists(&$array, $parent_id, $child) {
foreach ($array as &$a) {
if ($a->id == $parent_id) {
$a->children[] = $child;
return true;
} elseif (count($a->children) && self::nestedNodeExists($a->children, $parent_id, $child)) {
return true;
}
}
return false;
} | [
"private",
"function",
"nestedNodeExists",
"(",
"&",
"$",
"array",
",",
"$",
"parent_id",
",",
"$",
"child",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"&",
"$",
"a",
")",
"{",
"if",
"(",
"$",
"a",
"->",
"id",
"==",
"$",
"parent_id",
")",
"{",... | # Recursively assemble nested tree | [
"#",
"Recursively",
"assemble",
"nested",
"tree"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/RowController.php#L692-L702 |
left-right/center | src/controllers/RowController.php | RowController.listColumn | public static function listColumn($table) {
if (is_string($table)) $table = config('center.tables.' . $table);
$fields = !empty($table->list) ? $table->list : array_keys((array) $table->fields);
foreach ($fields as $field) {
if ($table->fields->{$field}->type == 'string') return $field;
}
} | php | public static function listColumn($table) {
if (is_string($table)) $table = config('center.tables.' . $table);
$fields = !empty($table->list) ? $table->list : array_keys((array) $table->fields);
foreach ($fields as $field) {
if ($table->fields->{$field}->type == 'string') return $field;
}
} | [
"public",
"static",
"function",
"listColumn",
"(",
"$",
"table",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"table",
")",
")",
"$",
"table",
"=",
"config",
"(",
"'center.tables.'",
".",
"$",
"table",
")",
";",
"$",
"fields",
"=",
"!",
"empty",
"(",
... | get the first text field column name | [
"get",
"the",
"first",
"text",
"field",
"column",
"name"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/RowController.php#L705-L711 |
left-right/center | src/controllers/RowController.php | RowController.table | public static function table($table, $columns, $rows) {
if (count($rows)) {
$return = new Table;
$return->rows($rows);
foreach ($columns as $column) {
$return->column($column->name, $column->type, $column->title);
}
if (isset($table->fields->deleted_at)) $return->deletable();
if (array_keys($tab... | php | public static function table($table, $columns, $rows) {
if (count($rows)) {
$return = new Table;
$return->rows($rows);
foreach ($columns as $column) {
$return->column($column->name, $column->type, $column->title);
}
if (isset($table->fields->deleted_at)) $return->deletable();
if (array_keys($tab... | [
"public",
"static",
"function",
"table",
"(",
"$",
"table",
",",
"$",
"columns",
",",
"$",
"rows",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"rows",
")",
")",
"{",
"$",
"return",
"=",
"new",
"Table",
";",
"$",
"return",
"->",
"rows",
"(",
"$",
"r... | # Draw an instance table, used both by index and by edit > linked | [
"#",
"Draw",
"an",
"instance",
"table",
"used",
"both",
"by",
"index",
"and",
"by",
"edit",
">",
"linked"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/RowController.php#L725-L737 |
left-right/center | src/controllers/RowController.php | RowController.pdf | public static function pdf($table, $row_id) {
# Get object / field / whatever infoz
$table = config('center.tables.' . $table);
# Security
if (!isset($table->name)) {
return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.table_does_not_exist'));... | php | public static function pdf($table, $row_id) {
# Get object / field / whatever infoz
$table = config('center.tables.' . $table);
# Security
if (!isset($table->name)) {
return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.table_does_not_exist'));... | [
"public",
"static",
"function",
"pdf",
"(",
"$",
"table",
",",
"$",
"row_id",
")",
"{",
"# Get object / field / whatever infoz",
"$",
"table",
"=",
"config",
"(",
"'center.tables.'",
".",
"$",
"table",
")",
";",
"# Security",
"if",
"(",
"!",
"isset",
"(",
... | # Display a PDF for an instance | [
"#",
"Display",
"a",
"PDF",
"for",
"an",
"instance"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/RowController.php#L740-L757 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.