id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
39,300
cmsgears/module-core
common/components/TemplateManager.php
TemplateManager.renderViewGeneric
public function renderViewGeneric( $template, $models, $viewFile, $config = [] ) { $config[ 'viewFile' ] = isset( $config[ 'viewFile' ] ) ? $config[ 'viewFile' ] : $viewFile; $config[ 'page' ] = isset( $config[ 'page' ] ) ? $config[ 'page' ] : true; return $this->renderView( $template, $models, $config ); }
php
public function renderViewGeneric( $template, $models, $viewFile, $config = [] ) { $config[ 'viewFile' ] = isset( $config[ 'viewFile' ] ) ? $config[ 'viewFile' ] : $viewFile; $config[ 'page' ] = isset( $config[ 'page' ] ) ? $config[ 'page' ] : true; return $this->renderView( $template, $models, $config ); }
[ "public", "function", "renderViewGeneric", "(", "$", "template", ",", "$", "models", ",", "$", "viewFile", ",", "$", "config", "=", "[", "]", ")", "{", "$", "config", "[", "'viewFile'", "]", "=", "isset", "(", "$", "config", "[", "'viewFile'", "]", "...
Default Page Views
[ "Default", "Page", "Views" ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/components/TemplateManager.php#L185-L191
39,301
cmsgears/module-core
common/components/TemplateManager.php
TemplateManager.renderViewAdmin
public function renderViewAdmin( $template, $models, $config = [] ) { return $this->renderViewGeneric( $template, $models, CoreGlobal::TPL_VIEW_ADMIN, $config ); }
php
public function renderViewAdmin( $template, $models, $config = [] ) { return $this->renderViewGeneric( $template, $models, CoreGlobal::TPL_VIEW_ADMIN, $config ); }
[ "public", "function", "renderViewAdmin", "(", "$", "template", ",", "$", "models", ",", "$", "config", "=", "[", "]", ")", "{", "return", "$", "this", "->", "renderViewGeneric", "(", "$", "template", ",", "$", "models", ",", "CoreGlobal", "::", "TPL_VIEW...
Admin view to be used for review purpose for data created by site users. The data collected by user will be submitted for admin review as part of approval process.
[ "Admin", "view", "to", "be", "used", "for", "review", "purpose", "for", "data", "created", "by", "site", "users", ".", "The", "data", "collected", "by", "user", "will", "be", "submitted", "for", "admin", "review", "as", "part", "of", "approval", "process",...
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/components/TemplateManager.php#L196-L199
39,302
cmsgears/module-core
common/components/TemplateManager.php
TemplateManager.renderViewPrivate
public function renderViewPrivate( $template, $models, $config = [] ) { return $this->renderViewGeneric( $template, $models, CoreGlobal::TPL_VIEW_PRIVATE, $config ); }
php
public function renderViewPrivate( $template, $models, $config = [] ) { return $this->renderViewGeneric( $template, $models, CoreGlobal::TPL_VIEW_PRIVATE, $config ); }
[ "public", "function", "renderViewPrivate", "(", "$", "template", ",", "$", "models", ",", "$", "config", "=", "[", "]", ")", "{", "return", "$", "this", "->", "renderViewGeneric", "(", "$", "template", ",", "$", "models", ",", "CoreGlobal", "::", "TPL_VI...
Private view to be viewed by logged in users. It's required for specific cases where views are different for logged in vs non logged in users.
[ "Private", "view", "to", "be", "viewed", "by", "logged", "in", "users", ".", "It", "s", "required", "for", "specific", "cases", "where", "views", "are", "different", "for", "logged", "in", "vs", "non", "logged", "in", "users", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/components/TemplateManager.php#L204-L207
39,303
cmsgears/module-core
common/components/TemplateManager.php
TemplateManager.renderViewPublic
public function renderViewPublic( $template, $models, $config = [] ) { return $this->renderViewGeneric( $template, $models, CoreGlobal::TPL_VIEW_PUBLIC, $config ); }
php
public function renderViewPublic( $template, $models, $config = [] ) { return $this->renderViewGeneric( $template, $models, CoreGlobal::TPL_VIEW_PUBLIC, $config ); }
[ "public", "function", "renderViewPublic", "(", "$", "template", ",", "$", "models", ",", "$", "config", "=", "[", "]", ")", "{", "return", "$", "this", "->", "renderViewGeneric", "(", "$", "template", ",", "$", "models", ",", "CoreGlobal", "::", "TPL_VIE...
Public view to be viewed by all users. Private view might override in specific scenarios.
[ "Public", "view", "to", "be", "viewed", "by", "all", "users", ".", "Private", "view", "might", "override", "in", "specific", "scenarios", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/components/TemplateManager.php#L212-L215
39,304
cmsgears/module-core
common/models/forms/FormModel.php
FormModel.load
public function load( $data, $formName = null ) { if( isset( $formName ) && isset( $data[ $formName ] ) ) { $this->data = $data[ $formName ]; } return parent::load( $data, $formName ); }
php
public function load( $data, $formName = null ) { if( isset( $formName ) && isset( $data[ $formName ] ) ) { $this->data = $data[ $formName ]; } return parent::load( $data, $formName ); }
[ "public", "function", "load", "(", "$", "data", ",", "$", "formName", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "formName", ")", "&&", "isset", "(", "$", "data", "[", "$", "formName", "]", ")", ")", "{", "$", "this", "->", "data", "=...
It process the submitted form data and store the form data using given form name. The model attributes will be set by the parent class. @param array $data @param string $formName @return boolean
[ "It", "process", "the", "submitted", "form", "data", "and", "store", "the", "form", "data", "using", "given", "form", "name", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/forms/FormModel.php#L69-L77
39,305
locomotivemtl/charcoal-property
src/Charcoal/Property/Structure/StructureMetadata.php
StructureMetadata.setIdent
public function setIdent($ident) { if ($ident === null) { $this->ident = null; return $this; } if (!is_string($ident)) { throw new InvalidArgumentException( sprintf( '[%s] Identifier must be a string; received %s', get_called_class(), (is_object($ident) ? get_class($ident) : gettype($ident)) ) ); } $this->ident = $ident; return $this; }
php
public function setIdent($ident) { if ($ident === null) { $this->ident = null; return $this; } if (!is_string($ident)) { throw new InvalidArgumentException( sprintf( '[%s] Identifier must be a string; received %s', get_called_class(), (is_object($ident) ? get_class($ident) : gettype($ident)) ) ); } $this->ident = $ident; return $this; }
[ "public", "function", "setIdent", "(", "$", "ident", ")", "{", "if", "(", "$", "ident", "===", "null", ")", "{", "$", "this", "->", "ident", "=", "null", ";", "return", "$", "this", ";", "}", "if", "(", "!", "is_string", "(", "$", "ident", ")", ...
Set the metadata identifier. @param string $ident The metadata identifier. @throws InvalidArgumentException If identifier is not a string. @return StructureMetadata Chainable
[ "Set", "the", "metadata", "identifier", "." ]
5ff339a0edb78a909537a9d2bb7f9b783255316b
https://github.com/locomotivemtl/charcoal-property/blob/5ff339a0edb78a909537a9d2bb7f9b783255316b/src/Charcoal/Property/Structure/StructureMetadata.php#L36-L56
39,306
locomotivemtl/charcoal-property
src/Charcoal/Property/Structure/StructureMetadata.php
StructureMetadata.setDefaultData
public function setDefaultData(array $data) { foreach ($data as $key => $val) { $this->defaultData[$key] = $val; } return $this; }
php
public function setDefaultData(array $data) { foreach ($data as $key => $val) { $this->defaultData[$key] = $val; } return $this; }
[ "public", "function", "setDefaultData", "(", "array", "$", "data", ")", "{", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "val", ")", "{", "$", "this", "->", "defaultData", "[", "$", "key", "]", "=", "$", "val", ";", "}", "return", "...
Set the object's default values. @param array $data An associative array. @return StructureMetadata
[ "Set", "the", "object", "s", "default", "values", "." ]
5ff339a0edb78a909537a9d2bb7f9b783255316b
https://github.com/locomotivemtl/charcoal-property/blob/5ff339a0edb78a909537a9d2bb7f9b783255316b/src/Charcoal/Property/Structure/StructureMetadata.php#L74-L81
39,307
locomotivemtl/charcoal-property
src/Charcoal/Property/Structure/StructureMetadata.php
StructureMetadata.setProperties
public function setProperties(array $properties) { foreach ($properties as $propertyIdent => $propertyMetadata) { if (isset($this->properties[$propertyIdent])) { $this->properties[$propertyIdent] = array_replace_recursive( $this->properties[$propertyIdent], $propertyMetadata ); } else { $this->properties[$propertyIdent] = $propertyMetadata; } } return $this; }
php
public function setProperties(array $properties) { foreach ($properties as $propertyIdent => $propertyMetadata) { if (isset($this->properties[$propertyIdent])) { $this->properties[$propertyIdent] = array_replace_recursive( $this->properties[$propertyIdent], $propertyMetadata ); } else { $this->properties[$propertyIdent] = $propertyMetadata; } } return $this; }
[ "public", "function", "setProperties", "(", "array", "$", "properties", ")", "{", "foreach", "(", "$", "properties", "as", "$", "propertyIdent", "=>", "$", "propertyMetadata", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "properties", "[", "$", ...
Set the properties. @param array $properties One or more properties. @return StructureMetadata
[ "Set", "the", "properties", "." ]
5ff339a0edb78a909537a9d2bb7f9b783255316b
https://github.com/locomotivemtl/charcoal-property/blob/5ff339a0edb78a909537a9d2bb7f9b783255316b/src/Charcoal/Property/Structure/StructureMetadata.php#L89-L103
39,308
cmsgears/module-core
common/services/resources/FileService.php
FileService.create
public function create( $model, $config = [] ) { // model class $modelClass = static::$modelClass; // Default visibility if( !isset( $model->visibility ) ) { $model->visibility = File::VISIBILITY_PUBLIC; } $model->siteId = isset( $config[ 'siteId' ] ) ? $config[ 'siteId' ] : Yii::$app->core->siteId; // Default sharing if( !isset( $model->shared ) ) { $model->shared = false; } // Create File $model->save(); // Return File return $model; }
php
public function create( $model, $config = [] ) { // model class $modelClass = static::$modelClass; // Default visibility if( !isset( $model->visibility ) ) { $model->visibility = File::VISIBILITY_PUBLIC; } $model->siteId = isset( $config[ 'siteId' ] ) ? $config[ 'siteId' ] : Yii::$app->core->siteId; // Default sharing if( !isset( $model->shared ) ) { $model->shared = false; } // Create File $model->save(); // Return File return $model; }
[ "public", "function", "create", "(", "$", "model", ",", "$", "config", "=", "[", "]", ")", "{", "// model class", "$", "modelClass", "=", "static", "::", "$", "modelClass", ";", "// Default visibility", "if", "(", "!", "isset", "(", "$", "model", "->", ...
It create the file with visibility set to public by default. It also disallow the file to be shared among multiple models. If file sharing is set to false, it will be deleted with model and can't be browsed using file browser.
[ "It", "create", "the", "file", "with", "visibility", "set", "to", "public", "by", "default", ".", "It", "also", "disallow", "the", "file", "to", "be", "shared", "among", "multiple", "models", ".", "If", "file", "sharing", "is", "set", "to", "false", "it"...
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/resources/FileService.php#L257-L281
39,309
cmsgears/module-core
common/services/resources/FileService.php
FileService.saveFile
public function saveFile( $file, $args = [] ) { // Save only when filename is provided if( strlen( $file->name ) > 0 ) { $fileManager = Yii::$app->fileManager; $model = null; $attribute = null; // The model and it's attribute used to refer to image if( isset( $args[ 'model' ] ) ) $model = $args[ 'model' ]; if( isset( $args[ 'attribute' ] ) ) $attribute = $args[ 'attribute' ]; // Update File $fileId = $file->id; if( $file->changed ) { $fileManager->processFile( $file ); } // New File if( !isset( $fileId ) || strlen( $fileId ) <= 0 ) { // Unset Id $file->id = null; // Update File Size $file->resetSize(); // Create $this->create( $file ); // Update model attribute if( isset( $model ) && isset( $attribute ) ) { $model->setAttribute( $attribute, $file->id ); } } // Existing File - File Changed else if( $file->changed ) { // Update File Size $file->resetSize(); $this->updateData( $file ); } // Existing File - Info Changed else if( isset( $fileId ) && intval( $fileId ) > 0 ) { $this->update( $file ); } $file->changed = false; } return $file; }
php
public function saveFile( $file, $args = [] ) { // Save only when filename is provided if( strlen( $file->name ) > 0 ) { $fileManager = Yii::$app->fileManager; $model = null; $attribute = null; // The model and it's attribute used to refer to image if( isset( $args[ 'model' ] ) ) $model = $args[ 'model' ]; if( isset( $args[ 'attribute' ] ) ) $attribute = $args[ 'attribute' ]; // Update File $fileId = $file->id; if( $file->changed ) { $fileManager->processFile( $file ); } // New File if( !isset( $fileId ) || strlen( $fileId ) <= 0 ) { // Unset Id $file->id = null; // Update File Size $file->resetSize(); // Create $this->create( $file ); // Update model attribute if( isset( $model ) && isset( $attribute ) ) { $model->setAttribute( $attribute, $file->id ); } } // Existing File - File Changed else if( $file->changed ) { // Update File Size $file->resetSize(); $this->updateData( $file ); } // Existing File - Info Changed else if( isset( $fileId ) && intval( $fileId ) > 0 ) { $this->update( $file ); } $file->changed = false; } return $file; }
[ "public", "function", "saveFile", "(", "$", "file", ",", "$", "args", "=", "[", "]", ")", "{", "// Save only when filename is provided", "if", "(", "strlen", "(", "$", "file", "->", "name", ")", ">", "0", ")", "{", "$", "fileManager", "=", "Yii", "::",...
Save pre-uploaded file to respective directory. @param CmgFile $file @param array $args
[ "Save", "pre", "-", "uploaded", "file", "to", "respective", "directory", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/resources/FileService.php#L431-L488
39,310
cmsgears/module-core
common/services/resources/FileService.php
FileService.delete
public function delete( $model, $config = [] ) { $admin = isset( $config[ 'admin' ] ) ? $config[ 'admin' ] : false; if( isset( $model ) ) { // Only admin is authorised to delete a shared file using file browser. if( $admin || !$model->shared ) { // Delete mappings Yii::$app->factory->get( 'modelFileService' )->deleteByModelId( $model->id ); // Delete from disk $model->clearDisk(); // Delete model return parent::delete( $model, $config ); } } return false; }
php
public function delete( $model, $config = [] ) { $admin = isset( $config[ 'admin' ] ) ? $config[ 'admin' ] : false; if( isset( $model ) ) { // Only admin is authorised to delete a shared file using file browser. if( $admin || !$model->shared ) { // Delete mappings Yii::$app->factory->get( 'modelFileService' )->deleteByModelId( $model->id ); // Delete from disk $model->clearDisk(); // Delete model return parent::delete( $model, $config ); } } return false; }
[ "public", "function", "delete", "(", "$", "model", ",", "$", "config", "=", "[", "]", ")", "{", "$", "admin", "=", "isset", "(", "$", "config", "[", "'admin'", "]", ")", "?", "$", "config", "[", "'admin'", "]", ":", "false", ";", "if", "(", "is...
Delete the file and corresponding mappings. @param \cmsgears\core\common\models\resources\File $model @param array $config @return boolean
[ "Delete", "the", "file", "and", "corresponding", "mappings", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/resources/FileService.php#L517-L538
39,311
cmsgears/module-core
common/services/traits/base/ApprovalTrait.php
ApprovalTrait.getPageByOwnerId
public function getPageByOwnerId( $ownerId, $config = [] ) { $owner = $config[ 'owner' ] ?? false; $modelTable = $this->getModelTable(); if( $owner ) { $config[ 'conditions' ][ "$modelTable.holderId" ] = $ownerId; } else { $config[ 'conditions' ][ "$modelTable.createdBy" ] = $ownerId; } return $this->getPage( $config ); }
php
public function getPageByOwnerId( $ownerId, $config = [] ) { $owner = $config[ 'owner' ] ?? false; $modelTable = $this->getModelTable(); if( $owner ) { $config[ 'conditions' ][ "$modelTable.holderId" ] = $ownerId; } else { $config[ 'conditions' ][ "$modelTable.createdBy" ] = $ownerId; } return $this->getPage( $config ); }
[ "public", "function", "getPageByOwnerId", "(", "$", "ownerId", ",", "$", "config", "=", "[", "]", ")", "{", "$", "owner", "=", "$", "config", "[", "'owner'", "]", "??", "false", ";", "$", "modelTable", "=", "$", "this", "->", "getModelTable", "(", ")...
It expects the model to support either of createdBy or ownerId column. If both exist, ownerId will dominate.
[ "It", "expects", "the", "model", "to", "support", "either", "of", "createdBy", "or", "ownerId", "column", ".", "If", "both", "exist", "ownerId", "will", "dominate", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/base/ApprovalTrait.php#L53-L68
39,312
cmsgears/module-core
common/services/traits/base/ApprovalTrait.php
ApprovalTrait.getPageByAuthorityId
public function getPageByAuthorityId( $id, $config = [] ) { $modelClass = static::$modelClass; $modelTable = $this->getModelTable(); $query = null; $owner = $config[ 'owner' ] ?? false; if( $owner ) { $query = $modelClass::queryWithOwnerAuthor(); $query->andWhere( "$modelTable.holderId =:oid OR ($modelTable.holderId IS NULL AND $modelTable.createdBy =:cid )", [ ':oid' => $id, ':cid' => $id ] ); } else { $query = $modelClass::queryWithAuthor(); $query->andWhere( "$modelTable.createdBy =:cid", [ ':cid' => $id ] ); } $config[ 'query' ] = $query; return $this->getPage( $config ); }
php
public function getPageByAuthorityId( $id, $config = [] ) { $modelClass = static::$modelClass; $modelTable = $this->getModelTable(); $query = null; $owner = $config[ 'owner' ] ?? false; if( $owner ) { $query = $modelClass::queryWithOwnerAuthor(); $query->andWhere( "$modelTable.holderId =:oid OR ($modelTable.holderId IS NULL AND $modelTable.createdBy =:cid )", [ ':oid' => $id, ':cid' => $id ] ); } else { $query = $modelClass::queryWithAuthor(); $query->andWhere( "$modelTable.createdBy =:cid", [ ':cid' => $id ] ); } $config[ 'query' ] = $query; return $this->getPage( $config ); }
[ "public", "function", "getPageByAuthorityId", "(", "$", "id", ",", "$", "config", "=", "[", "]", ")", "{", "$", "modelClass", "=", "static", "::", "$", "modelClass", ";", "$", "modelTable", "=", "$", "this", "->", "getModelTable", "(", ")", ";", "$", ...
It expects the model to support either createdBy or createdBy and ownerId columns
[ "It", "expects", "the", "model", "to", "support", "either", "createdBy", "or", "createdBy", "and", "ownerId", "columns" ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/base/ApprovalTrait.php#L82-L106
39,313
cmsgears/module-core
common/services/traits/base/ApprovalTrait.php
ApprovalTrait.toggleFrojen
public function toggleFrojen( $model, $notify = true, $config = [] ) { $oldStatus = $model->getStatusStr(); $model->toggleFrojen(); $model->save(); $newStatus = $model->getStatusStr(); if( $notify ) { $title = $model->isActive( true ) ? $model->getClassName() . ' Activated' : $model->getClassName() . ' Frozen'; $config[ 'template' ] = $model->isActive( true ) ? CoreGlobal::TPL_NOTIFY_STATUS_ACTIVE : CoreGlobal::TPL_NOTIFY_STATUS_FREEZE; $config[ 'data' ][ 'oldStatus' ] = $oldStatus; $config[ 'data' ][ 'newStatus' ] = $newStatus; $this->notifyUser( $model, $config, $title ); } return $model; }
php
public function toggleFrojen( $model, $notify = true, $config = [] ) { $oldStatus = $model->getStatusStr(); $model->toggleFrojen(); $model->save(); $newStatus = $model->getStatusStr(); if( $notify ) { $title = $model->isActive( true ) ? $model->getClassName() . ' Activated' : $model->getClassName() . ' Frozen'; $config[ 'template' ] = $model->isActive( true ) ? CoreGlobal::TPL_NOTIFY_STATUS_ACTIVE : CoreGlobal::TPL_NOTIFY_STATUS_FREEZE; $config[ 'data' ][ 'oldStatus' ] = $oldStatus; $config[ 'data' ][ 'newStatus' ] = $newStatus; $this->notifyUser( $model, $config, $title ); } return $model; }
[ "public", "function", "toggleFrojen", "(", "$", "model", ",", "$", "notify", "=", "true", ",", "$", "config", "=", "[", "]", ")", "{", "$", "oldStatus", "=", "$", "model", "->", "getStatusStr", "(", ")", ";", "$", "model", "->", "toggleFrojen", "(", ...
Toggle the model between Frozen and Active states. @param \cmsgears\core\common\models\interfaces\base\IApproval $model @param boolean $notify @param array $config @return \cmsgears\core\common\models\interfaces\base\IApproval
[ "Toggle", "the", "model", "between", "Frozen", "and", "Active", "states", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/base/ApprovalTrait.php#L549-L571
39,314
cmsgears/module-core
common/services/traits/base/ApprovalTrait.php
ApprovalTrait.toggleBlock
public function toggleBlock( $model, $notify = true, $config = [] ) { $oldStatus = $model->getStatusStr(); $model->toggleBlock(); $model->save(); $newStatus = $model->getStatusStr(); if( $notify ) { $title = $model->isActive( true ) ? $model->getClassName() . ' Activated' : $model->getClassName() . ' Blocked'; $config[ 'template' ] = $model->isActive( true ) ? CoreGlobal::TPL_NOTIFY_STATUS_ACTIVE : CoreGlobal::TPL_NOTIFY_STATUS_BLOCK; $config[ 'data' ][ 'oldStatus' ] = $oldStatus; $config[ 'data' ][ 'newStatus' ] = $newStatus; $this->notifyUser( $model, $config, $title ); } return $model; }
php
public function toggleBlock( $model, $notify = true, $config = [] ) { $oldStatus = $model->getStatusStr(); $model->toggleBlock(); $model->save(); $newStatus = $model->getStatusStr(); if( $notify ) { $title = $model->isActive( true ) ? $model->getClassName() . ' Activated' : $model->getClassName() . ' Blocked'; $config[ 'template' ] = $model->isActive( true ) ? CoreGlobal::TPL_NOTIFY_STATUS_ACTIVE : CoreGlobal::TPL_NOTIFY_STATUS_BLOCK; $config[ 'data' ][ 'oldStatus' ] = $oldStatus; $config[ 'data' ][ 'newStatus' ] = $newStatus; $this->notifyUser( $model, $config, $title ); } return $model; }
[ "public", "function", "toggleBlock", "(", "$", "model", ",", "$", "notify", "=", "true", ",", "$", "config", "=", "[", "]", ")", "{", "$", "oldStatus", "=", "$", "model", "->", "getStatusStr", "(", ")", ";", "$", "model", "->", "toggleBlock", "(", ...
Toggle the model between Blocked and Active states. @param \cmsgears\core\common\models\interfaces\base\IApproval $model @param boolean $notify @param array $config @return \cmsgears\core\common\models\interfaces\base\IApproval
[ "Toggle", "the", "model", "between", "Blocked", "and", "Active", "states", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/base/ApprovalTrait.php#L581-L603
39,315
apioo/psx-http
src/Parser/RequestParser.php
RequestParser.parse
public function parse($content) { $content = $this->normalize($content); list($method, $path, $scheme) = $this->getStatus($content); // resolve uri path if ($this->baseUrl !== null) { $path = UriResolver::resolve($this->baseUrl, new Uri($path)); } else { $path = new Uri($path); } $request = new Request($path, $method); $request->setProtocolVersion($scheme); list($header, $body) = $this->splitMessage($content); $this->headerToArray($request, $header); $request->setBody(new StringStream($body)); return $request; }
php
public function parse($content) { $content = $this->normalize($content); list($method, $path, $scheme) = $this->getStatus($content); // resolve uri path if ($this->baseUrl !== null) { $path = UriResolver::resolve($this->baseUrl, new Uri($path)); } else { $path = new Uri($path); } $request = new Request($path, $method); $request->setProtocolVersion($scheme); list($header, $body) = $this->splitMessage($content); $this->headerToArray($request, $header); $request->setBody(new StringStream($body)); return $request; }
[ "public", "function", "parse", "(", "$", "content", ")", "{", "$", "content", "=", "$", "this", "->", "normalize", "(", "$", "content", ")", ";", "list", "(", "$", "method", ",", "$", "path", ",", "$", "scheme", ")", "=", "$", "this", "->", "getS...
Converts an raw http request into an PSX\Http\Request object @param string $content @return \PSX\Http\Request @throws \PSX\Http\Parser\ParseException
[ "Converts", "an", "raw", "http", "request", "into", "an", "PSX", "\\", "Http", "\\", "Request", "object" ]
c54d7212cfb513df84f810429aa34c6ac9942c01
https://github.com/apioo/psx-http/blob/c54d7212cfb513df84f810429aa34c6ac9942c01/src/Parser/RequestParser.php#L55-L78
39,316
apioo/psx-http
src/Parser/RequestParser.php
RequestParser.convert
public static function convert($content, Url $baseUrl = null, $mode = ParserAbstract::MODE_STRICT) { $parser = new self($baseUrl, $mode); return $parser->parse($content); }
php
public static function convert($content, Url $baseUrl = null, $mode = ParserAbstract::MODE_STRICT) { $parser = new self($baseUrl, $mode); return $parser->parse($content); }
[ "public", "static", "function", "convert", "(", "$", "content", ",", "Url", "$", "baseUrl", "=", "null", ",", "$", "mode", "=", "ParserAbstract", "::", "MODE_STRICT", ")", "{", "$", "parser", "=", "new", "self", "(", "$", "baseUrl", ",", "$", "mode", ...
Parses an raw http request into an PSX\Http\Request object. Throws an exception if the request has not an valid format @param string $content @param \PSX\Uri\Url $baseUrl @param integer $mode @return \PSX\Http\RequestInterface @throws \PSX\Http\Parser\ParseException
[ "Parses", "an", "raw", "http", "request", "into", "an", "PSX", "\\", "Http", "\\", "Request", "object", ".", "Throws", "an", "exception", "if", "the", "request", "has", "not", "an", "valid", "format" ]
c54d7212cfb513df84f810429aa34c6ac9942c01
https://github.com/apioo/psx-http/blob/c54d7212cfb513df84f810429aa34c6ac9942c01/src/Parser/RequestParser.php#L136-L141
39,317
phPoirot/Std
src/Struct/fixes/aDataOptions.php
aDataOptions.doWhichMethodIgnored
protected function doWhichMethodIgnored() { if (!$this->_c_is_process_ignored_notation) { ## Detect/Default Ignored ### Detect: by docblock $this->__ignoreFromDocBlock(); ### Default: isFulfilled and isEmpty is public internal method and not option $x = &$this->_t_options__ignored; $x[] = 'isFulfilled'; $x[] = 'isEmpty'; $x[] = 'getIterator'; $this->_c_is_process_ignored_notation = true; } return $this->_t_options__ignored; }
php
protected function doWhichMethodIgnored() { if (!$this->_c_is_process_ignored_notation) { ## Detect/Default Ignored ### Detect: by docblock $this->__ignoreFromDocBlock(); ### Default: isFulfilled and isEmpty is public internal method and not option $x = &$this->_t_options__ignored; $x[] = 'isFulfilled'; $x[] = 'isEmpty'; $x[] = 'getIterator'; $this->_c_is_process_ignored_notation = true; } return $this->_t_options__ignored; }
[ "protected", "function", "doWhichMethodIgnored", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_c_is_process_ignored_notation", ")", "{", "## Detect/Default Ignored", "### Detect: by docblock", "$", "this", "->", "__ignoreFromDocBlock", "(", ")", ";", "### Defaul...
Get List Of Ignored Methods @return array
[ "Get", "List", "Of", "Ignored", "Methods" ]
67883b1b1dd2cea80fec3d98a199c403b8a23b4d
https://github.com/phPoirot/Std/blob/67883b1b1dd2cea80fec3d98a199c403b8a23b4d/src/Struct/fixes/aDataOptions.php#L71-L88
39,318
phPoirot/Std
src/Struct/fixes/aDataOptions.php
aDataOptions._fix__getIterator
protected function _fix__getIterator() { $arr = array(); foreach($this->_getProperties() as $p) { if (!$p->isReadable()) continue; $val = $this->__get($p->getKey()); $arr[(string) $p] = $val; } return new \ArrayIterator($arr); }
php
protected function _fix__getIterator() { $arr = array(); foreach($this->_getProperties() as $p) { if (!$p->isReadable()) continue; $val = $this->__get($p->getKey()); $arr[(string) $p] = $val; } return new \ArrayIterator($arr); }
[ "protected", "function", "_fix__getIterator", "(", ")", "{", "$", "arr", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "_getProperties", "(", ")", "as", "$", "p", ")", "{", "if", "(", "!", "$", "p", "->", "isReadable", "(", ")", ...
DO_LEAST_PHPVER_SUPPORT v5.5 yeild
[ "DO_LEAST_PHPVER_SUPPORT", "v5", ".", "5", "yeild" ]
67883b1b1dd2cea80fec3d98a199c403b8a23b4d
https://github.com/phPoirot/Std/blob/67883b1b1dd2cea80fec3d98a199c403b8a23b4d/src/Struct/fixes/aDataOptions.php#L118-L129
39,319
phPoirot/Std
src/Struct/fixes/aDataOptions.php
aDataOptions._normalize
protected function _normalize($key, $type) { $type = strtolower($type); if ($type !== 'external' && $type !== 'internal') throw new \InvalidArgumentException; if ($type === 'external') $return = $this->_normalizeExternal($key); else $return = $this->_normalizeInternal($key); return $return; }
php
protected function _normalize($key, $type) { $type = strtolower($type); if ($type !== 'external' && $type !== 'internal') throw new \InvalidArgumentException; if ($type === 'external') $return = $this->_normalizeExternal($key); else $return = $this->_normalizeInternal($key); return $return; }
[ "protected", "function", "_normalize", "(", "$", "key", ",", "$", "type", ")", "{", "$", "type", "=", "strtolower", "(", "$", "type", ")", ";", "if", "(", "$", "type", "!==", "'external'", "&&", "$", "type", "!==", "'internal'", ")", "throw", "new", ...
Property Key Normalizer @param string $key @param string $type internal|external @return string
[ "Property", "Key", "Normalizer" ]
67883b1b1dd2cea80fec3d98a199c403b8a23b4d
https://github.com/phPoirot/Std/blob/67883b1b1dd2cea80fec3d98a199c403b8a23b4d/src/Struct/fixes/aDataOptions.php#L452-L465
39,320
phPoirot/Std
src/Struct/fixes/aDataOptions.php
aDataOptions.__isValueMatchAsExpected
protected function __isValueMatchAsExpected($value, $expectedString) { $match = false; if ($expectedString === null) ## undefined expected values must not be NULL ## except when it write down on docblock "@return void" return $value === null; $valueType = strtolower(gettype($value)); /** * @return string|null|object|\Stdclass|void */ $expectedString = explode('|', $expectedString); foreach($expectedString as $ext) { $ext = strtolower(trim($ext)); if ($ext == '') continue; if ($value === VOID && $ext == 'void') $match = true; elseif ($valueType === $ext && $value != null) $match = true; elseif ($valueType === 'object') { if (is_a($value, $ext)) $match = true; } if ($match) break; } return $match; }
php
protected function __isValueMatchAsExpected($value, $expectedString) { $match = false; if ($expectedString === null) ## undefined expected values must not be NULL ## except when it write down on docblock "@return void" return $value === null; $valueType = strtolower(gettype($value)); /** * @return string|null|object|\Stdclass|void */ $expectedString = explode('|', $expectedString); foreach($expectedString as $ext) { $ext = strtolower(trim($ext)); if ($ext == '') continue; if ($value === VOID && $ext == 'void') $match = true; elseif ($valueType === $ext && $value != null) $match = true; elseif ($valueType === 'object') { if (is_a($value, $ext)) $match = true; } if ($match) break; } return $match; }
[ "protected", "function", "__isValueMatchAsExpected", "(", "$", "value", ",", "$", "expectedString", ")", "{", "$", "match", "=", "false", ";", "if", "(", "$", "expectedString", "===", "null", ")", "## undefined expected values must not be NULL", "## except when it wri...
Match a value against expected docblock comment @param mixed $value @param string $expectedString @return bool
[ "Match", "a", "value", "against", "expected", "docblock", "comment" ]
67883b1b1dd2cea80fec3d98a199c403b8a23b4d
https://github.com/phPoirot/Std/blob/67883b1b1dd2cea80fec3d98a199c403b8a23b4d/src/Struct/fixes/aDataOptions.php#L545-L577
39,321
phPoirot/Std
src/Struct/fixes/aDataOptions.php
aDataOptions.__ignoreFromDocBlock
protected function __ignoreFromDocBlock() { $ref = $this->_newReflection(); // ignored methods from Class DocComment: $classDocComment = $ref->getDocComment(); if ($classDocComment !== false && preg_match_all('/.*[\n]?/', $classDocComment, $lines)) { $lines = $lines[0]; $regex = '/.+(@method).+((?P<method_name>\b\w+)\(.*\))\s@ignore\s/'; foreach($lines as $line) { if (preg_match($regex, $line, $matches)) $this->ignore($matches['method_name']); } } // ignored methods from Method DocBlock $methods = $ref->getMethods(ReflectionMethod::IS_PUBLIC); foreach($methods as $m) { $mc = $m->getDocComment(); if ($mc !== false && preg_match('/@ignore\s/', $mc, $matches)) $this->ignore($m->getName()); } }
php
protected function __ignoreFromDocBlock() { $ref = $this->_newReflection(); // ignored methods from Class DocComment: $classDocComment = $ref->getDocComment(); if ($classDocComment !== false && preg_match_all('/.*[\n]?/', $classDocComment, $lines)) { $lines = $lines[0]; $regex = '/.+(@method).+((?P<method_name>\b\w+)\(.*\))\s@ignore\s/'; foreach($lines as $line) { if (preg_match($regex, $line, $matches)) $this->ignore($matches['method_name']); } } // ignored methods from Method DocBlock $methods = $ref->getMethods(ReflectionMethod::IS_PUBLIC); foreach($methods as $m) { $mc = $m->getDocComment(); if ($mc !== false && preg_match('/@ignore\s/', $mc, $matches)) $this->ignore($m->getName()); } }
[ "protected", "function", "__ignoreFromDocBlock", "(", ")", "{", "$", "ref", "=", "$", "this", "->", "_newReflection", "(", ")", ";", "// ignored methods from Class DocComment:", "$", "classDocComment", "=", "$", "ref", "->", "getDocComment", "(", ")", ";", "if",...
Ignore Methods that Commented as DocBlocks
[ "Ignore", "Methods", "that", "Commented", "as", "DocBlocks" ]
67883b1b1dd2cea80fec3d98a199c403b8a23b4d
https://github.com/phPoirot/Std/blob/67883b1b1dd2cea80fec3d98a199c403b8a23b4d/src/Struct/fixes/aDataOptions.php#L583-L605
39,322
rodrigoiii/skeleton-core
src/classes/AppCli.php
AppCli.boot
public function boot() { $this->loadDatabaseConnection(); $this->loadLibraries(); if (file_exists(system_path("registered-libraries-cli.php"))) { require system_path("registered-libraries-cli.php"); } if (file_exists(system_path("registered-global-middlewares-cli.php"))) { require system_path("registered-global-middlewares-cli.php"); } $application_commands = $this->getApplicationCommands(glob(app_path('Commands/*.php'))); $skeleton_commands = $this->getSkeletonCoreCommands(glob(__DIR__ . "/Console/Commands/*.php")); $modules_commands = $this->getModulesCommands(); $this->cli_app = new Application(config('app.name')); $this->cli_app->addCommands(array_merge($application_commands, $skeleton_commands, $modules_commands)); }
php
public function boot() { $this->loadDatabaseConnection(); $this->loadLibraries(); if (file_exists(system_path("registered-libraries-cli.php"))) { require system_path("registered-libraries-cli.php"); } if (file_exists(system_path("registered-global-middlewares-cli.php"))) { require system_path("registered-global-middlewares-cli.php"); } $application_commands = $this->getApplicationCommands(glob(app_path('Commands/*.php'))); $skeleton_commands = $this->getSkeletonCoreCommands(glob(__DIR__ . "/Console/Commands/*.php")); $modules_commands = $this->getModulesCommands(); $this->cli_app = new Application(config('app.name')); $this->cli_app->addCommands(array_merge($application_commands, $skeleton_commands, $modules_commands)); }
[ "public", "function", "boot", "(", ")", "{", "$", "this", "->", "loadDatabaseConnection", "(", ")", ";", "$", "this", "->", "loadLibraries", "(", ")", ";", "if", "(", "file_exists", "(", "system_path", "(", "\"registered-libraries-cli.php\"", ")", ")", ")", ...
Boot the cli application. @return void
[ "Boot", "the", "cli", "application", "." ]
5dab0637b9cd0f55a64b1f5926d7ba6bb3f93df0
https://github.com/rodrigoiii/skeleton-core/blob/5dab0637b9cd0f55a64b1f5926d7ba6bb3f93df0/src/classes/AppCli.php#L139-L160
39,323
yawik/Orders
src/Entity/Order.php
Order.setPrice
public function setPrice($amount) { $tax = $this->getTaxRate() / 100; $taxAmount = $amount * $tax; $this->prices = [ 'pretax' => round($amount, 2), 'tax' => round($taxAmount, 2), 'net' => round($amount + $taxAmount, 2), ]; return $this; }
php
public function setPrice($amount) { $tax = $this->getTaxRate() / 100; $taxAmount = $amount * $tax; $this->prices = [ 'pretax' => round($amount, 2), 'tax' => round($taxAmount, 2), 'net' => round($amount + $taxAmount, 2), ]; return $this; }
[ "public", "function", "setPrice", "(", "$", "amount", ")", "{", "$", "tax", "=", "$", "this", "->", "getTaxRate", "(", ")", "/", "100", ";", "$", "taxAmount", "=", "$", "amount", "*", "$", "tax", ";", "$", "this", "->", "prices", "=", "[", "'pret...
Sets the total amount without tax. Discount and sconti should be calculated before hand. @param int $amount @return self
[ "Sets", "the", "total", "amount", "without", "tax", "." ]
2c21bfc3b927002531aba1caa2967d56561ac501
https://github.com/yawik/Orders/blob/2c21bfc3b927002531aba1caa2967d56561ac501/src/Entity/Order.php#L251-L263
39,324
yawik/Orders
src/Entity/Order.php
Order.calculatePrices
public function calculatePrices() { if ($this->getId()) { return; } $taxFactor = $this->getTaxRate() / 100; $total = $pretax = $tax = 0; $sums = []; /* @var ProductInterface $product */ foreach ($this->getProducts() as $product) { $pPreTax = $product->getPrice(); $pTax = $pPreTax * $taxFactor; $pTotal = $pPreTax + $pTax; $pQuantity = $product->getQuantity(); $ptPreTax = $pQuantity * $pPreTax; $ptTax = $pQuantity * $pTax; $ptTotal = $pQuantity * $pTotal; $sums[$product->getName()] = [ 'single_pretax' => $pPreTax, 'single_tax' => $pTax, 'single_total' => $pTotal, 'pretax' => $ptPreTax, 'tax' => $ptTax, 'total' => $ptTotal, ]; $total += $ptTotal; $pretax += $ptPreTax; $tax += $ptTax; } $this->prices = [ 'products' => $sums, 'total' => $total, 'tax' => $tax, 'pretax' => $pretax, ]; }
php
public function calculatePrices() { if ($this->getId()) { return; } $taxFactor = $this->getTaxRate() / 100; $total = $pretax = $tax = 0; $sums = []; /* @var ProductInterface $product */ foreach ($this->getProducts() as $product) { $pPreTax = $product->getPrice(); $pTax = $pPreTax * $taxFactor; $pTotal = $pPreTax + $pTax; $pQuantity = $product->getQuantity(); $ptPreTax = $pQuantity * $pPreTax; $ptTax = $pQuantity * $pTax; $ptTotal = $pQuantity * $pTotal; $sums[$product->getName()] = [ 'single_pretax' => $pPreTax, 'single_tax' => $pTax, 'single_total' => $pTotal, 'pretax' => $ptPreTax, 'tax' => $ptTax, 'total' => $ptTotal, ]; $total += $ptTotal; $pretax += $ptPreTax; $tax += $ptTax; } $this->prices = [ 'products' => $sums, 'total' => $total, 'tax' => $tax, 'pretax' => $pretax, ]; }
[ "public", "function", "calculatePrices", "(", ")", "{", "if", "(", "$", "this", "->", "getId", "(", ")", ")", "{", "return", ";", "}", "$", "taxFactor", "=", "$", "this", "->", "getTaxRate", "(", ")", "/", "100", ";", "$", "total", "=", "$", "pre...
Calculates the prices. Not used at the moment.
[ "Calculates", "the", "prices", "." ]
2c21bfc3b927002531aba1caa2967d56561ac501
https://github.com/yawik/Orders/blob/2c21bfc3b927002531aba1caa2967d56561ac501/src/Entity/Order.php#L295-L335
39,325
cmsgears/module-core
common/models/resources/Form.php
Form.getFieldsMap
public function getFieldsMap() { $formFields = $this->fields; $fieldsMap = []; foreach( $formFields as $formField ) { $fieldsMap[ $formField->name ] = $formField; } return $fieldsMap; }
php
public function getFieldsMap() { $formFields = $this->fields; $fieldsMap = []; foreach( $formFields as $formField ) { $fieldsMap[ $formField->name ] = $formField; } return $fieldsMap; }
[ "public", "function", "getFieldsMap", "(", ")", "{", "$", "formFields", "=", "$", "this", "->", "fields", ";", "$", "fieldsMap", "=", "[", "]", ";", "foreach", "(", "$", "formFields", "as", "$", "formField", ")", "{", "$", "fieldsMap", "[", "$", "for...
Return map of form fields having field name as key and field itself as value. @return array FormField map
[ "Return", "map", "of", "form", "fields", "having", "field", "name", "as", "key", "and", "field", "itself", "as", "value", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/resources/Form.php#L275-L286
39,326
cmsgears/module-core
common/models/base/ModelMapper.php
ModelMapper.isActiveMapping
public function isActiveMapping( $parentId, $parentType ) { return $this->active && $this->parentId == $parentId && $this->parentType == $parentType; }
php
public function isActiveMapping( $parentId, $parentType ) { return $this->active && $this->parentId == $parentId && $this->parentType == $parentType; }
[ "public", "function", "isActiveMapping", "(", "$", "parentId", ",", "$", "parentType", ")", "{", "return", "$", "this", "->", "active", "&&", "$", "this", "->", "parentId", "==", "$", "parentId", "&&", "$", "this", "->", "parentType", "==", "$", "parentT...
Check whether mapping is active using given parent id and type. @param integer $parentId @param string $parentType @return boolean
[ "Check", "whether", "mapping", "is", "active", "using", "given", "parent", "id", "and", "type", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/base/ModelMapper.php#L156-L159
39,327
cmsgears/module-core
common/models/base/ModelMapper.php
ModelMapper.queryByParent
public static function queryByParent( $parentId, $parentType ) { $tableName = static::tableName(); return self::queryWithModel()->where( "$tableName.parentId=:pid AND $tableName.parentType=:ptype", [ ':pid' => $parentId, ':ptype' => $parentType ] ); }
php
public static function queryByParent( $parentId, $parentType ) { $tableName = static::tableName(); return self::queryWithModel()->where( "$tableName.parentId=:pid AND $tableName.parentType=:ptype", [ ':pid' => $parentId, ':ptype' => $parentType ] ); }
[ "public", "static", "function", "queryByParent", "(", "$", "parentId", ",", "$", "parentType", ")", "{", "$", "tableName", "=", "static", "::", "tableName", "(", ")", ";", "return", "self", "::", "queryWithModel", "(", ")", "->", "where", "(", "\"$tableNam...
Return query to find the mapping for given parent id and parent type. @param integer $parentId @param string $parentType @return \yii\db\ActiveQuery to find using parent id and parent type.
[ "Return", "query", "to", "find", "the", "mapping", "for", "given", "parent", "id", "and", "parent", "type", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/base/ModelMapper.php#L215-L220
39,328
cmsgears/module-core
common/models/base/ModelMapper.php
ModelMapper.queryByParentModelId
public static function queryByParentModelId( $parentId, $parentType, $modelId ) { $tableName = static::tableName(); return self::queryWithModel()->where( "$tableName.parentId=:pid AND $tableName.parentType=:ptype AND $tableName.modelId=:mid", [ ':pid' => $parentId, ':ptype' => $parentType, ':mid' => $modelId ] ); }
php
public static function queryByParentModelId( $parentId, $parentType, $modelId ) { $tableName = static::tableName(); return self::queryWithModel()->where( "$tableName.parentId=:pid AND $tableName.parentType=:ptype AND $tableName.modelId=:mid", [ ':pid' => $parentId, ':ptype' => $parentType, ':mid' => $modelId ] ); }
[ "public", "static", "function", "queryByParentModelId", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "modelId", ")", "{", "$", "tableName", "=", "static", "::", "tableName", "(", ")", ";", "return", "self", "::", "queryWithModel", "(", ")", "->"...
Return query to find the mapping for given parent id, parent type and model id. @param integer $parentId @param string $parentType @param integer $modelId @return \yii\db\ActiveQuery to find using parent id and parent type.
[ "Return", "query", "to", "find", "the", "mapping", "for", "given", "parent", "id", "parent", "type", "and", "model", "id", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/base/ModelMapper.php#L243-L248
39,329
cmsgears/module-core
common/models/base/ModelMapper.php
ModelMapper.queryByTypeParent
public static function queryByTypeParent( $parentId, $parentType, $type ) { $tableName = static::tableName(); return self::queryWithModel()->where( "$tableName.parentId=:pid AND $tableName.parentType=:ptype AND $tableName.type=:type", [ ':pid' => $parentId, ':ptype' => $parentType, ':type' => $type ] ); }
php
public static function queryByTypeParent( $parentId, $parentType, $type ) { $tableName = static::tableName(); return self::queryWithModel()->where( "$tableName.parentId=:pid AND $tableName.parentType=:ptype AND $tableName.type=:type", [ ':pid' => $parentId, ':ptype' => $parentType, ':type' => $type ] ); }
[ "public", "static", "function", "queryByTypeParent", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "type", ")", "{", "$", "tableName", "=", "static", "::", "tableName", "(", ")", ";", "return", "self", "::", "queryWithModel", "(", ")", "->", "w...
Return query to find the mapping for given parent id, parent type and mapping type. @param integer $parentId @param string $parentType @param string $type @return \yii\db\ActiveQuery to find using parent id, parent type and mapping type.
[ "Return", "query", "to", "find", "the", "mapping", "for", "given", "parent", "id", "parent", "type", "and", "mapping", "type", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/base/ModelMapper.php#L258-L263
39,330
cmsgears/module-core
common/models/base/ModelMapper.php
ModelMapper.findByParentModelId
public static function findByParentModelId( $parentId, $parentType, $modelId ) { return self::queryByParentModelId( $parentId, $parentType, $modelId )->all(); }
php
public static function findByParentModelId( $parentId, $parentType, $modelId ) { return self::queryByParentModelId( $parentId, $parentType, $modelId )->all(); }
[ "public", "static", "function", "findByParentModelId", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "modelId", ")", "{", "return", "self", "::", "queryByParentModelId", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "modelId", ")", "->", ...
Find and return the mappings for given parent id, parent type and model id. @param integer $parentId @param string $parentType @param integer $modelId @return \cmsgears\core\common\models\base\ActiveRecord[]
[ "Find", "and", "return", "the", "mappings", "for", "given", "parent", "id", "parent", "type", "and", "model", "id", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/base/ModelMapper.php#L321-L324
39,331
cmsgears/module-core
common/models/base/ModelMapper.php
ModelMapper.findFirstByParentModelId
public static function findFirstByParentModelId( $parentId, $parentType, $modelId ) { return self::queryByParentModelId( $parentId, $parentType, $modelId )->one(); }
php
public static function findFirstByParentModelId( $parentId, $parentType, $modelId ) { return self::queryByParentModelId( $parentId, $parentType, $modelId )->one(); }
[ "public", "static", "function", "findFirstByParentModelId", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "modelId", ")", "{", "return", "self", "::", "queryByParentModelId", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "modelId", ")", "...
Find and return the first mapping for given parent id, parent type and model id. It's useful for the cases where only one mapping is allowed for a parent and model. @param integer $parentId @param string $parentType @param integer $modelId @return \cmsgears\core\common\models\base\ActiveRecord
[ "Find", "and", "return", "the", "first", "mapping", "for", "given", "parent", "id", "parent", "type", "and", "model", "id", ".", "It", "s", "useful", "for", "the", "cases", "where", "only", "one", "mapping", "is", "allowed", "for", "a", "parent", "and", ...
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/base/ModelMapper.php#L335-L338
39,332
cmsgears/module-core
common/models/base/ModelMapper.php
ModelMapper.findByParentModelIdType
public static function findByParentModelIdType( $parentId, $parentType, $modelId, $type ) { return self::queryByParentModelId( $parentId, $parentType, $modelId )->andWhere( 'type=:type', [ ':type' => $type ] )->all(); }
php
public static function findByParentModelIdType( $parentId, $parentType, $modelId, $type ) { return self::queryByParentModelId( $parentId, $parentType, $modelId )->andWhere( 'type=:type', [ ':type' => $type ] )->all(); }
[ "public", "static", "function", "findByParentModelIdType", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "modelId", ",", "$", "type", ")", "{", "return", "self", "::", "queryByParentModelId", "(", "$", "parentId", ",", "$", "parentType", ",", "$", ...
Find and return the mappings for given parent id, parent type, model id and type. @param integer $parentId @param string $parentType @param integer $modelId @param integer $type @return \cmsgears\core\common\models\base\ActiveRecord[]
[ "Find", "and", "return", "the", "mappings", "for", "given", "parent", "id", "parent", "type", "model", "id", "and", "type", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/base/ModelMapper.php#L361-L364
39,333
cmsgears/module-core
common/models/base/ModelMapper.php
ModelMapper.findFirstByParentModelIdType
public static function findFirstByParentModelIdType( $parentId, $parentType, $modelId, $type ) { return self::queryByParentModelId( $parentId, $parentType, $modelId )->andWhere( 'type=:type', [ ':type' => $type ] )->one(); }
php
public static function findFirstByParentModelIdType( $parentId, $parentType, $modelId, $type ) { return self::queryByParentModelId( $parentId, $parentType, $modelId )->andWhere( 'type=:type', [ ':type' => $type ] )->one(); }
[ "public", "static", "function", "findFirstByParentModelIdType", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "modelId", ",", "$", "type", ")", "{", "return", "self", "::", "queryByParentModelId", "(", "$", "parentId", ",", "$", "parentType", ",", ...
Find and return the mapping for given parent id, parent type, model id and type. It's useful for the cases where only one mapping is allowed for a parent, model and type. @param integer $parentId @param string $parentType @param integer $modelId @param integer $type @return \cmsgears\core\common\models\base\ActiveRecord
[ "Find", "and", "return", "the", "mapping", "for", "given", "parent", "id", "parent", "type", "model", "id", "and", "type", ".", "It", "s", "useful", "for", "the", "cases", "where", "only", "one", "mapping", "is", "allowed", "for", "a", "parent", "model",...
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/base/ModelMapper.php#L376-L379
39,334
cmsgears/module-core
common/models/base/ModelMapper.php
ModelMapper.findActiveByParentModelId
public static function findActiveByParentModelId( $parentId, $parentType, $modelId ) { return self::queryByParentModelId( $parentId, $parentType, $modelId )->andWhere( 'active=1' )->all(); }
php
public static function findActiveByParentModelId( $parentId, $parentType, $modelId ) { return self::queryByParentModelId( $parentId, $parentType, $modelId )->andWhere( 'active=1' )->all(); }
[ "public", "static", "function", "findActiveByParentModelId", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "modelId", ")", "{", "return", "self", "::", "queryByParentModelId", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "modelId", ")", ...
Find and return the active mappings for parent id, parent type and model id. @param integer $parentId @param string $parentType @param integer $modelId @return \cmsgears\core\common\models\base\ActiveRecord[]
[ "Find", "and", "return", "the", "active", "mappings", "for", "parent", "id", "parent", "type", "and", "model", "id", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/base/ModelMapper.php#L435-L438
39,335
cmsgears/module-core
common/models/base/ModelMapper.php
ModelMapper.findFirstActiveByParentModelId
public static function findFirstActiveByParentModelId( $parentId, $parentType, $modelId ) { return self::queryByParentModelId( $parentId, $parentType, $modelId )->andWhere( 'active=1' )->one(); }
php
public static function findFirstActiveByParentModelId( $parentId, $parentType, $modelId ) { return self::queryByParentModelId( $parentId, $parentType, $modelId )->andWhere( 'active=1' )->one(); }
[ "public", "static", "function", "findFirstActiveByParentModelId", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "modelId", ")", "{", "return", "self", "::", "queryByParentModelId", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "modelId", ")...
Find and return the active mappings for parent id, parent type and model id. It's useful for the cases where only one active mapping is allowed for a parent and model. @param integer $parentId @param string $parentType @param integer $modelId @return \cmsgears\core\common\models\base\ActiveRecord
[ "Find", "and", "return", "the", "active", "mappings", "for", "parent", "id", "parent", "type", "and", "model", "id", ".", "It", "s", "useful", "for", "the", "cases", "where", "only", "one", "active", "mapping", "is", "allowed", "for", "a", "parent", "and...
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/base/ModelMapper.php#L449-L452
39,336
cmsgears/module-core
common/models/base/ModelMapper.php
ModelMapper.disableByParent
public static function disableByParent( $parentId, $parentType ) { $tableName = static::tableName(); // Disable all mappings $query = "UPDATE $tableName SET `active`=0 WHERE `parentType`='$parentType' AND `parentId`=$parentId"; $command = Yii::$app->db->createCommand( $query ); $command->execute(); }
php
public static function disableByParent( $parentId, $parentType ) { $tableName = static::tableName(); // Disable all mappings $query = "UPDATE $tableName SET `active`=0 WHERE `parentType`='$parentType' AND `parentId`=$parentId"; $command = Yii::$app->db->createCommand( $query ); $command->execute(); }
[ "public", "static", "function", "disableByParent", "(", "$", "parentId", ",", "$", "parentType", ")", "{", "$", "tableName", "=", "static", "::", "tableName", "(", ")", ";", "// Disable all mappings", "$", "query", "=", "\"UPDATE $tableName SET `active`=0 WHERE `par...
Disable all the mappings for given parent id and parent type. @param integer $parentId @param string $parentType @return integer number of rows. @throws Exception in case query failed.
[ "Disable", "all", "the", "mappings", "for", "given", "parent", "id", "and", "parent", "type", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/base/ModelMapper.php#L507-L516
39,337
spiffyjr/spiffy-framework
src/Application.php
Application.bootstrap
public function bootstrap() { $event = $this->getEvent(); $event->setType(self::EVENT_BOOTSTRAP); $this->events()->fire($event); return $this; }
php
public function bootstrap() { $event = $this->getEvent(); $event->setType(self::EVENT_BOOTSTRAP); $this->events()->fire($event); return $this; }
[ "public", "function", "bootstrap", "(", ")", "{", "$", "event", "=", "$", "this", "->", "getEvent", "(", ")", ";", "$", "event", "->", "setType", "(", "self", "::", "EVENT_BOOTSTRAP", ")", ";", "$", "this", "->", "events", "(", ")", "->", "fire", "...
Bootstrap the application by firing EVENT_BOOTSTRAP. Certain services are expected to exist After bootstrapping. If you override the default plugins you are required to ensure they exist. There are no safety checks! The following is a list of expected services: - Dispatcher - PackageManager - Router - ViewManager @return $this
[ "Bootstrap", "the", "application", "by", "firing", "EVENT_BOOTSTRAP", ".", "Certain", "services", "are", "expected", "to", "exist", "After", "bootstrapping", ".", "If", "you", "override", "the", "default", "plugins", "you", "are", "required", "to", "ensure", "th...
fffcec2f23e410140d6c85210f429398a868e5ec
https://github.com/spiffyjr/spiffy-framework/blob/fffcec2f23e410140d6c85210f429398a868e5ec/src/Application.php#L75-L82
39,338
ethical-jobs/ethical-jobs-foundation-php
src/Utils/Timestamp.php
Timestamp.toMilliseconds
public static function toMilliseconds($value = null) { if (! $value) { return null; } if (! $value instanceof Carbon) { $value = Carbon::parse($value); // attempt to parse it } return (int) $value->timestamp * 1000; }
php
public static function toMilliseconds($value = null) { if (! $value) { return null; } if (! $value instanceof Carbon) { $value = Carbon::parse($value); // attempt to parse it } return (int) $value->timestamp * 1000; }
[ "public", "static", "function", "toMilliseconds", "(", "$", "value", "=", "null", ")", "{", "if", "(", "!", "$", "value", ")", "{", "return", "null", ";", "}", "if", "(", "!", "$", "value", "instanceof", "Carbon", ")", "{", "$", "value", "=", "Carb...
Converts carbon instance to milliseconds @param PHP unix timestamp (seconds) $timestamp
[ "Converts", "carbon", "instance", "to", "milliseconds" ]
35dafc2172dc8ba44c0ace4a58a7c0a9b63455a8
https://github.com/ethical-jobs/ethical-jobs-foundation-php/blob/35dafc2172dc8ba44c0ace4a58a7c0a9b63455a8/src/Utils/Timestamp.php#L20-L31
39,339
ethical-jobs/ethical-jobs-foundation-php
src/Utils/Timestamp.php
Timestamp.fromMilliseconds
public static function fromMilliseconds($timestamp = null) { if (! $timestamp) { return null; } return Carbon::createFromTimestamp(self::toSeconds($timestamp)); }
php
public static function fromMilliseconds($timestamp = null) { if (! $timestamp) { return null; } return Carbon::createFromTimestamp(self::toSeconds($timestamp)); }
[ "public", "static", "function", "fromMilliseconds", "(", "$", "timestamp", "=", "null", ")", "{", "if", "(", "!", "$", "timestamp", ")", "{", "return", "null", ";", "}", "return", "Carbon", "::", "createFromTimestamp", "(", "self", "::", "toSeconds", "(", ...
Converts timestamp to carbon instance @param Carbon\Carbon $timestamp
[ "Converts", "timestamp", "to", "carbon", "instance" ]
35dafc2172dc8ba44c0ace4a58a7c0a9b63455a8
https://github.com/ethical-jobs/ethical-jobs-foundation-php/blob/35dafc2172dc8ba44c0ace4a58a7c0a9b63455a8/src/Utils/Timestamp.php#L38-L45
39,340
ethical-jobs/ethical-jobs-foundation-php
src/Utils/Timestamp.php
Timestamp.isMilliseconds
public static function isMilliseconds($timestamp = null) { if (! $timestamp || $timestamp instanceof Carbon) { return false; } if (is_numeric($timestamp) && strlen((string) $timestamp) >= 12) { return true; } return false; }
php
public static function isMilliseconds($timestamp = null) { if (! $timestamp || $timestamp instanceof Carbon) { return false; } if (is_numeric($timestamp) && strlen((string) $timestamp) >= 12) { return true; } return false; }
[ "public", "static", "function", "isMilliseconds", "(", "$", "timestamp", "=", "null", ")", "{", "if", "(", "!", "$", "timestamp", "||", "$", "timestamp", "instanceof", "Carbon", ")", "{", "return", "false", ";", "}", "if", "(", "is_numeric", "(", "$", ...
Truthy for checking if a timestamp is in milliseconds @param Javascript unix timestamp (miniseconds) $timestamp @return Bool
[ "Truthy", "for", "checking", "if", "a", "timestamp", "is", "in", "milliseconds" ]
35dafc2172dc8ba44c0ace4a58a7c0a9b63455a8
https://github.com/ethical-jobs/ethical-jobs-foundation-php/blob/35dafc2172dc8ba44c0ace4a58a7c0a9b63455a8/src/Utils/Timestamp.php#L67-L78
39,341
ethical-jobs/ethical-jobs-foundation-php
src/Utils/Timestamp.php
Timestamp.parse
public static function parse($timestamp = null) { if (static::isMilliseconds($timestamp)) { return static::fromMilliseconds($timestamp); } if ($timestamp instanceof Carbon) { return $timestamp; } return Carbon::parse($timestamp); }
php
public static function parse($timestamp = null) { if (static::isMilliseconds($timestamp)) { return static::fromMilliseconds($timestamp); } if ($timestamp instanceof Carbon) { return $timestamp; } return Carbon::parse($timestamp); }
[ "public", "static", "function", "parse", "(", "$", "timestamp", "=", "null", ")", "{", "if", "(", "static", "::", "isMilliseconds", "(", "$", "timestamp", ")", ")", "{", "return", "static", "::", "fromMilliseconds", "(", "$", "timestamp", ")", ";", "}", ...
Attempts to parse a date into Carbon @param Carobon|String|Integer $timestamp @return \Carbon\Carbon
[ "Attempts", "to", "parse", "a", "date", "into", "Carbon" ]
35dafc2172dc8ba44c0ace4a58a7c0a9b63455a8
https://github.com/ethical-jobs/ethical-jobs-foundation-php/blob/35dafc2172dc8ba44c0ace4a58a7c0a9b63455a8/src/Utils/Timestamp.php#L86-L97
39,342
ethical-jobs/ethical-jobs-foundation-php
src/Utils/Timestamp.php
Timestamp.isExpired
public static function isExpired($date = null) { return (bool) self::parse($date)->lte(Carbon::now()); }
php
public static function isExpired($date = null) { return (bool) self::parse($date)->lte(Carbon::now()); }
[ "public", "static", "function", "isExpired", "(", "$", "date", "=", "null", ")", "{", "return", "(", "bool", ")", "self", "::", "parse", "(", "$", "date", ")", "->", "lte", "(", "Carbon", "::", "now", "(", ")", ")", ";", "}" ]
Determines if a date is past @param Carobon|String|Integer $date @return boolean
[ "Determines", "if", "a", "date", "is", "past" ]
35dafc2172dc8ba44c0ace4a58a7c0a9b63455a8
https://github.com/ethical-jobs/ethical-jobs-foundation-php/blob/35dafc2172dc8ba44c0ace4a58a7c0a9b63455a8/src/Utils/Timestamp.php#L105-L108
39,343
gregorybesson/PlaygroundReward
src/Service/RewardListener.php
RewardListener.sendRequest
public function sendRequest($url, $args) { $ch = curl_init(); $curlConfig = array( CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => json_encode($args) ); // print the array that was sent //echo "<pre>"; //var_dump($args); curl_setopt_array($ch, $curlConfig); $result = curl_exec($ch); curl_close($ch); }
php
public function sendRequest($url, $args) { $ch = curl_init(); $curlConfig = array( CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => json_encode($args) ); // print the array that was sent //echo "<pre>"; //var_dump($args); curl_setopt_array($ch, $curlConfig); $result = curl_exec($ch); curl_close($ch); }
[ "public", "function", "sendRequest", "(", "$", "url", ",", "$", "args", ")", "{", "$", "ch", "=", "curl_init", "(", ")", ";", "$", "curlConfig", "=", "array", "(", "CURLOPT_URL", "=>", "$", "url", ",", "CURLOPT_POST", "=>", "true", ",", "CURLOPT_RETURN...
Actually send the to Mouth ! @return void
[ "Actually", "send", "the", "to", "Mouth", "!" ]
313ba96f530f27066ebaec6613f78c9bfe257862
https://github.com/gregorybesson/PlaygroundReward/blob/313ba96f530f27066ebaec6613f78c9bfe257862/src/Service/RewardListener.php#L316-L331
39,344
cmsgears/module-core
common/controllers/SiteController.php
SiteController.actionActivateAccount
public function actionActivateAccount( $token, $email ) { // Send user to home if already logged in $this->checkHome(); // Unset Flash Message Yii::$app->session->setFlash( CoreGlobal::FLASH_GENERIC, null ); $model = new ResetPassword(); $model->email = $email; // Load and Validate Form Model if( $model->load( Yii::$app->request->post(), 'ResetPassword' ) && $model->validate() ) { $coreProperties = $this->getCoreProperties(); $user = $this->userService->getByEmail( $model->email ); // If valid user found if( isset( $user ) ) { // Activate User if( $this->userService->reset( $user, $token, $model, true ) ) { // Send Activation Mail Yii::$app->coreMailer->sendActivateUserMail( $user ); // Set Success Message Yii::$app->session->setFlash( CoreGlobal::FLASH_GENERIC, Yii::$app->coreMessage->getMessage( CoreGlobal::MESSAGE_ACCOUNT_ACTIVATE ) ); // Auto Login if( $coreProperties->isAutoLogin() ) { Yii::$app->user->login( $user, 3600 * 24 * 30 ); } return $this->render( CoreGlobal::PAGE_ACCOUNT_ACTIVATE, [ CoreGlobal::MODEL_GENERIC => $model, 'activated' => true ] ); } // Set Failure Message Yii::$app->session->setFlash( CoreGlobal::FLASH_GENERIC, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_ACCOUNT_CONFIRM ) ); return $this->render( CoreGlobal::PAGE_ACCOUNT_ACTIVATE, [ CoreGlobal::MODEL_GENERIC => $model, 'activated' => false ] ); } else { // Set Failure Message Yii::$app->session->setFlash( CoreGlobal::FLASH_GENERIC, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_USER_NOT_EXIST ) ); } } return $this->render( CoreGlobal::PAGE_ACCOUNT_ACTIVATE, [ CoreGlobal::MODEL_GENERIC => $model ] ); }
php
public function actionActivateAccount( $token, $email ) { // Send user to home if already logged in $this->checkHome(); // Unset Flash Message Yii::$app->session->setFlash( CoreGlobal::FLASH_GENERIC, null ); $model = new ResetPassword(); $model->email = $email; // Load and Validate Form Model if( $model->load( Yii::$app->request->post(), 'ResetPassword' ) && $model->validate() ) { $coreProperties = $this->getCoreProperties(); $user = $this->userService->getByEmail( $model->email ); // If valid user found if( isset( $user ) ) { // Activate User if( $this->userService->reset( $user, $token, $model, true ) ) { // Send Activation Mail Yii::$app->coreMailer->sendActivateUserMail( $user ); // Set Success Message Yii::$app->session->setFlash( CoreGlobal::FLASH_GENERIC, Yii::$app->coreMessage->getMessage( CoreGlobal::MESSAGE_ACCOUNT_ACTIVATE ) ); // Auto Login if( $coreProperties->isAutoLogin() ) { Yii::$app->user->login( $user, 3600 * 24 * 30 ); } return $this->render( CoreGlobal::PAGE_ACCOUNT_ACTIVATE, [ CoreGlobal::MODEL_GENERIC => $model, 'activated' => true ] ); } // Set Failure Message Yii::$app->session->setFlash( CoreGlobal::FLASH_GENERIC, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_ACCOUNT_CONFIRM ) ); return $this->render( CoreGlobal::PAGE_ACCOUNT_ACTIVATE, [ CoreGlobal::MODEL_GENERIC => $model, 'activated' => false ] ); } else { // Set Failure Message Yii::$app->session->setFlash( CoreGlobal::FLASH_GENERIC, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_USER_NOT_EXIST ) ); } } return $this->render( CoreGlobal::PAGE_ACCOUNT_ACTIVATE, [ CoreGlobal::MODEL_GENERIC => $model ] ); }
[ "public", "function", "actionActivateAccount", "(", "$", "token", ",", "$", "email", ")", "{", "// Send user to home if already logged in", "$", "this", "->", "checkHome", "(", ")", ";", "// Unset Flash Message", "Yii", "::", "$", "app", "->", "session", "->", "...
The users added by site admin can be activated by providing valid token and email. If activation link is still valid, user will be activated.
[ "The", "users", "added", "by", "site", "admin", "can", "be", "activated", "by", "providing", "valid", "token", "and", "email", ".", "If", "activation", "link", "is", "still", "valid", "user", "will", "be", "activated", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/controllers/SiteController.php#L96-L149
39,345
cmsgears/module-core
common/controllers/SiteController.php
SiteController.actionLogin
public function actionLogin( $admin = false ) { // Send user to home if already logged in $this->checkHome(); // Create Form Model $model = new Login(); $model->admin = $admin; // Load and Validate Form Model if( $model->load( Yii::$app->request->post(), 'Login' ) && $model->login() ) { // Redirect user to home $this->checkHome(); } return $this->render( CoreGlobal::PAGE_LOGIN, [ CoreGlobal::MODEL_GENERIC => $model ] ); }
php
public function actionLogin( $admin = false ) { // Send user to home if already logged in $this->checkHome(); // Create Form Model $model = new Login(); $model->admin = $admin; // Load and Validate Form Model if( $model->load( Yii::$app->request->post(), 'Login' ) && $model->login() ) { // Redirect user to home $this->checkHome(); } return $this->render( CoreGlobal::PAGE_LOGIN, [ CoreGlobal::MODEL_GENERIC => $model ] ); }
[ "public", "function", "actionLogin", "(", "$", "admin", "=", "false", ")", "{", "// Send user to home if already logged in", "$", "this", "->", "checkHome", "(", ")", ";", "// Create Form Model", "$", "model", "=", "new", "Login", "(", ")", ";", "$", "model", ...
The method checks whether user is logged in and send to home.
[ "The", "method", "checks", "whether", "user", "is", "logged", "in", "and", "send", "to", "home", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/controllers/SiteController.php#L323-L341
39,346
cmsgears/module-core
common/controllers/SiteController.php
SiteController.actionLogout
public function actionLogout() { // Logout User Yii::$app->user->logout(); // Destroy Session Yii::$app->session->destroy(); // Redirect User to appropriate page return $this->redirect( [ Yii::$app->core->getLogoutRedirectPage() ] ); }
php
public function actionLogout() { // Logout User Yii::$app->user->logout(); // Destroy Session Yii::$app->session->destroy(); // Redirect User to appropriate page return $this->redirect( [ Yii::$app->core->getLogoutRedirectPage() ] ); }
[ "public", "function", "actionLogout", "(", ")", "{", "// Logout User", "Yii", "::", "$", "app", "->", "user", "->", "logout", "(", ")", ";", "// Destroy Session", "Yii", "::", "$", "app", "->", "session", "->", "destroy", "(", ")", ";", "// Redirect User t...
The method clears user session and cookies and redirect user to login.
[ "The", "method", "clears", "user", "session", "and", "cookies", "and", "redirect", "user", "to", "login", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/controllers/SiteController.php#L346-L356
39,347
apioo/psx-http
src/Parser/ResponseParser.php
ResponseParser.parse
public function parse($content) { $content = $this->normalize($content); list($scheme, $code, $message) = $this->getStatus($content); $response = new Response(); $response->setProtocolVersion($scheme); $response->setStatus($code, $message); list($header, $body) = $this->splitMessage($content); $this->headerToArray($response, $header); $response->setBody(new StringStream($body)); return $response; }
php
public function parse($content) { $content = $this->normalize($content); list($scheme, $code, $message) = $this->getStatus($content); $response = new Response(); $response->setProtocolVersion($scheme); $response->setStatus($code, $message); list($header, $body) = $this->splitMessage($content); $this->headerToArray($response, $header); $response->setBody(new StringStream($body)); return $response; }
[ "public", "function", "parse", "(", "$", "content", ")", "{", "$", "content", "=", "$", "this", "->", "normalize", "(", "$", "content", ")", ";", "list", "(", "$", "scheme", ",", "$", "code", ",", "$", "message", ")", "=", "$", "this", "->", "get...
Converts an raw http response into an PSX\Http\Response object @param string $content @return \PSX\Http\ResponseInterface @throws \PSX\Http\Parser\ParseException
[ "Converts", "an", "raw", "http", "response", "into", "an", "PSX", "\\", "Http", "\\", "Response", "object" ]
c54d7212cfb513df84f810429aa34c6ac9942c01
https://github.com/apioo/psx-http/blob/c54d7212cfb513df84f810429aa34c6ac9942c01/src/Parser/ResponseParser.php#L44-L61
39,348
apioo/psx-http
src/Parser/ResponseParser.php
ResponseParser.convert
public static function convert($content, $mode = ParserAbstract::MODE_STRICT) { $parser = new self($mode); return $parser->parse($content); }
php
public static function convert($content, $mode = ParserAbstract::MODE_STRICT) { $parser = new self($mode); return $parser->parse($content); }
[ "public", "static", "function", "convert", "(", "$", "content", ",", "$", "mode", "=", "ParserAbstract", "::", "MODE_STRICT", ")", "{", "$", "parser", "=", "new", "self", "(", "$", "mode", ")", ";", "return", "$", "parser", "->", "parse", "(", "$", "...
Parses an raw http response into an PSX\Http\Response object. Throws an exception if the response has not an valid format @param string $content @param integer $mode @return \PSX\Http\ResponseInterface @throws \PSX\Http\Parser\ParseException
[ "Parses", "an", "raw", "http", "response", "into", "an", "PSX", "\\", "Http", "\\", "Response", "object", ".", "Throws", "an", "exception", "if", "the", "response", "has", "not", "an", "valid", "format" ]
c54d7212cfb513df84f810429aa34c6ac9942c01
https://github.com/apioo/psx-http/blob/c54d7212cfb513df84f810429aa34c6ac9942c01/src/Parser/ResponseParser.php#L167-L172
39,349
cmsgears/module-core
common/utilities/AjaxUtil.php
AjaxUtil.generateErrorMessage
public static function generateErrorMessage( $source, $config = [] ) { $multiple = isset( $config[ 'multiple' ] ) ? $config[ 'multiple' ] : false; $variable = isset( $config[ 'variable' ] ) ? $config[ 'variable' ] : false; $modelClass = isset( $config[ 'modelClass' ] ) ? $config[ 'modelClass' ] : null; $modelErrors = []; // Multiple instances of same Class if( $multiple ) { foreach( $source as $idx => $model ) { $errors = $model->getErrors(); $modelClass = isset( $modelClass ) ? $modelClass : $model->getClassName(); $modelErrors = []; foreach( $errors as $key => $value ) { $modelErrors[ "$modelClass[$idx][$key]" ] = $value[ 0 ]; } } } // Models of different class else if( $variable ) { foreach( $source as $idx => $model ) { $errors = $model->getErrors(); $modelClass = $model->getClassName(); $modelErrors = []; foreach( $errors as $key => $value ) { $modelErrors[ "{$modelClass}[$key]" ] = $value[ 0 ]; } } } else { $errors = $source->getErrors(); $modelClass = isset( $modelClass ) ? $modelClass : $source->getClassName(); $modelErrors = []; foreach( $errors as $key => $value ) { $modelErrors[ "{$modelClass}[$key]" ] = $value[ 0 ]; } } return $modelErrors; }
php
public static function generateErrorMessage( $source, $config = [] ) { $multiple = isset( $config[ 'multiple' ] ) ? $config[ 'multiple' ] : false; $variable = isset( $config[ 'variable' ] ) ? $config[ 'variable' ] : false; $modelClass = isset( $config[ 'modelClass' ] ) ? $config[ 'modelClass' ] : null; $modelErrors = []; // Multiple instances of same Class if( $multiple ) { foreach( $source as $idx => $model ) { $errors = $model->getErrors(); $modelClass = isset( $modelClass ) ? $modelClass : $model->getClassName(); $modelErrors = []; foreach( $errors as $key => $value ) { $modelErrors[ "$modelClass[$idx][$key]" ] = $value[ 0 ]; } } } // Models of different class else if( $variable ) { foreach( $source as $idx => $model ) { $errors = $model->getErrors(); $modelClass = $model->getClassName(); $modelErrors = []; foreach( $errors as $key => $value ) { $modelErrors[ "{$modelClass}[$key]" ] = $value[ 0 ]; } } } else { $errors = $source->getErrors(); $modelClass = isset( $modelClass ) ? $modelClass : $source->getClassName(); $modelErrors = []; foreach( $errors as $key => $value ) { $modelErrors[ "{$modelClass}[$key]" ] = $value[ 0 ]; } } return $modelErrors; }
[ "public", "static", "function", "generateErrorMessage", "(", "$", "source", ",", "$", "config", "=", "[", "]", ")", "{", "$", "multiple", "=", "isset", "(", "$", "config", "[", "'multiple'", "]", ")", "?", "$", "config", "[", "'multiple'", "]", ":", ...
The method generate an array of error messages from model validated by Yii. @param model @return array - error messages
[ "The", "method", "generate", "an", "array", "of", "error", "messages", "from", "model", "validated", "by", "Yii", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/utilities/AjaxUtil.php#L99-L149
39,350
mcaskill/charcoal-support
src/View/HtmlableTrait.php
HtmlableTrait.htmlAttributes
public function htmlAttributes(array $attr, callable $callback = null, $prefix = true) { if (!count($attr)) { return ''; } $html = array_map( function ($val, $key) use ($callback) { if (is_bool($val)) { return ($val ? $key : ''); } elseif (isset($val)) { if ($val instanceof Closure) { $val = $val(); } elseif ($val instanceof JsonSerializable) { $val = json_encode( $val->jsonSerialize(), (JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE) ); } elseif (is_callable([ $val, 'toArray' ])) { $val = $val->toArray(); } elseif (is_callable([ $val, '__toString' ])) { $val = strval($val); } if (is_array($val)) { if (function_exists('is_blank')) { $filter = function ($var) { return !is_blank($var); }; } else { $filter = function ($var) { return !empty($var) || is_numeric($var); }; } $val = implode(' ', array_filter($val, $filter)); } if (is_callable($callback)) { $val = call_user_func($callback, $val); } elseif (function_exists('esc_attr')) { $val = esc_attr($val); } else { $val = htmlspecialchars($val, ENT_QUOTES); } if (is_string($val)) { return sprintf('%1$s="%2$s"', $key, $val); } } }, $attr, array_keys($attr) ); $html = implode(' ', $html); if (is_bool($prefix)) { $prefix = ($prefix) ? ' ' : ''; } elseif (!is_string($prefix)) { $prefix = ''; } return $prefix . $html; }
php
public function htmlAttributes(array $attr, callable $callback = null, $prefix = true) { if (!count($attr)) { return ''; } $html = array_map( function ($val, $key) use ($callback) { if (is_bool($val)) { return ($val ? $key : ''); } elseif (isset($val)) { if ($val instanceof Closure) { $val = $val(); } elseif ($val instanceof JsonSerializable) { $val = json_encode( $val->jsonSerialize(), (JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE) ); } elseif (is_callable([ $val, 'toArray' ])) { $val = $val->toArray(); } elseif (is_callable([ $val, '__toString' ])) { $val = strval($val); } if (is_array($val)) { if (function_exists('is_blank')) { $filter = function ($var) { return !is_blank($var); }; } else { $filter = function ($var) { return !empty($var) || is_numeric($var); }; } $val = implode(' ', array_filter($val, $filter)); } if (is_callable($callback)) { $val = call_user_func($callback, $val); } elseif (function_exists('esc_attr')) { $val = esc_attr($val); } else { $val = htmlspecialchars($val, ENT_QUOTES); } if (is_string($val)) { return sprintf('%1$s="%2$s"', $key, $val); } } }, $attr, array_keys($attr) ); $html = implode(' ', $html); if (is_bool($prefix)) { $prefix = ($prefix) ? ' ' : ''; } elseif (!is_string($prefix)) { $prefix = ''; } return $prefix . $html; }
[ "public", "function", "htmlAttributes", "(", "array", "$", "attr", ",", "callable", "$", "callback", "=", "null", ",", "$", "prefix", "=", "true", ")", "{", "if", "(", "!", "count", "(", "$", "attr", ")", ")", "{", "return", "''", ";", "}", "$", ...
Generate a string of HTML attributes Note: Adapted from `html_build_attributes()`. Added $prefix parameter. @see https://gist.github.com/mcaskill/0177f151e39b94ee2629f06d72c4b65b @param array $attr Associative array of attribute names and values. @param callable|null $callback Callback function to escape values for HTML attributes. Defaults to `htmlspecialchars()`. @param string|boolean $prefix Prepend the returned string with a space. @return string Returns a string of HTML attributes.
[ "Generate", "a", "string", "of", "HTML", "attributes" ]
2138a34463ca6865bf3a60635aa11381a9ae73c5
https://github.com/mcaskill/charcoal-support/blob/2138a34463ca6865bf3a60635aa11381a9ae73c5/src/View/HtmlableTrait.php#L23-L86
39,351
cmsgears/module-core
common/services/traits/base/NameTypeTrait.php
NameTypeTrait.getFirstByNameType
public function getFirstByNameType( $name, $type, $config = [] ) { $modelClass = static::$modelClass; return $modelClass::findFirstByNameType( $name, $type, $config ); }
php
public function getFirstByNameType( $name, $type, $config = [] ) { $modelClass = static::$modelClass; return $modelClass::findFirstByNameType( $name, $type, $config ); }
[ "public", "function", "getFirstByNameType", "(", "$", "name", ",", "$", "type", ",", "$", "config", "=", "[", "]", ")", "{", "$", "modelClass", "=", "static", "::", "$", "modelClass", ";", "return", "$", "modelClass", "::", "findFirstByNameType", "(", "$...
Useful for models having unique name for type.
[ "Useful", "for", "models", "having", "unique", "name", "for", "type", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/base/NameTypeTrait.php#L95-L100
39,352
phPoirot/Std
src/Environment/FactoryEnvironment.php
FactoryEnvironment.of
static function of($alias, $defaults = null) { $EnvClass = static::createEnvInstance($alias); if (null !== $defaults) $EnvClass->import($defaults); return $EnvClass; }
php
static function of($alias, $defaults = null) { $EnvClass = static::createEnvInstance($alias); if (null !== $defaults) $EnvClass->import($defaults); return $EnvClass; }
[ "static", "function", "of", "(", "$", "alias", ",", "$", "defaults", "=", "null", ")", "{", "$", "EnvClass", "=", "static", "::", "createEnvInstance", "(", "$", "alias", ")", ";", "if", "(", "null", "!==", "$", "defaults", ")", "$", "EnvClass", "->",...
Factory To Settings Environment callable: string|BaseEnv function() return alias or env instance @param string|callable $alias @param \Traversable $defaults @throws \Exception @return EnvBase
[ "Factory", "To", "Settings", "Environment" ]
67883b1b1dd2cea80fec3d98a199c403b8a23b4d
https://github.com/phPoirot/Std/blob/67883b1b1dd2cea80fec3d98a199c403b8a23b4d/src/Environment/FactoryEnvironment.php#L43-L51
39,353
phPoirot/Std
src/Environment/FactoryEnvironment.php
FactoryEnvironment.register
static function register($environment, $name, array $aliases = array()) { if ( (is_string($environment) && !class_exists($environment)) || (is_object($environment) && !$environment instanceof EnvBase) ) throw new \InvalidArgumentException(sprintf( 'Invalid Environment Provided; It must be class name or object instance of EnvBase. given: (%s).' , \Poirot\Std\flatten($environment) )); static::$_aliases[$name] = $environment; static::setAlias($name, $aliases); }
php
static function register($environment, $name, array $aliases = array()) { if ( (is_string($environment) && !class_exists($environment)) || (is_object($environment) && !$environment instanceof EnvBase) ) throw new \InvalidArgumentException(sprintf( 'Invalid Environment Provided; It must be class name or object instance of EnvBase. given: (%s).' , \Poirot\Std\flatten($environment) )); static::$_aliases[$name] = $environment; static::setAlias($name, $aliases); }
[ "static", "function", "register", "(", "$", "environment", ",", "$", "name", ",", "array", "$", "aliases", "=", "array", "(", ")", ")", "{", "if", "(", "(", "is_string", "(", "$", "environment", ")", "&&", "!", "class_exists", "(", "$", "environment", ...
Register New Environment With Given Name - it can override current environment with existence name @param EnvBase|string $environment Environment instance or class name @param string $name Registered Name @param array $aliases Name Aliases
[ "Register", "New", "Environment", "With", "Given", "Name" ]
67883b1b1dd2cea80fec3d98a199c403b8a23b4d
https://github.com/phPoirot/Std/blob/67883b1b1dd2cea80fec3d98a199c403b8a23b4d/src/Environment/FactoryEnvironment.php#L62-L75
39,354
phPoirot/Std
src/Environment/FactoryEnvironment.php
FactoryEnvironment.setAlias
static function setAlias($name, $alias) { if (!is_array($alias)) $alias = array($alias); foreach($alias as $a) self::$_aliases[(string) $a] = (string) $name; }
php
static function setAlias($name, $alias) { if (!is_array($alias)) $alias = array($alias); foreach($alias as $a) self::$_aliases[(string) $a] = (string) $name; }
[ "static", "function", "setAlias", "(", "$", "name", ",", "$", "alias", ")", "{", "if", "(", "!", "is_array", "(", "$", "alias", ")", ")", "$", "alias", "=", "array", "(", "$", "alias", ")", ";", "foreach", "(", "$", "alias", "as", "$", "a", ")"...
Set Alias Or Name Aliases @param string $name Alias Or Name @param array|string $alias Alias(es)
[ "Set", "Alias", "Or", "Name", "Aliases" ]
67883b1b1dd2cea80fec3d98a199c403b8a23b4d
https://github.com/phPoirot/Std/blob/67883b1b1dd2cea80fec3d98a199c403b8a23b4d/src/Environment/FactoryEnvironment.php#L83-L90
39,355
phPoirot/Std
src/Environment/FactoryEnvironment.php
FactoryEnvironment.setCurrentEnvironment
static function setCurrentEnvironment($environment) { if ( is_string($environment) && !class_exists($environment) ) return static::setAlias($environment, static::CURRENT_NAME); static::register($environment, static::CURRENT_NAME); }
php
static function setCurrentEnvironment($environment) { if ( is_string($environment) && !class_exists($environment) ) return static::setAlias($environment, static::CURRENT_NAME); static::register($environment, static::CURRENT_NAME); }
[ "static", "function", "setCurrentEnvironment", "(", "$", "environment", ")", "{", "if", "(", "is_string", "(", "$", "environment", ")", "&&", "!", "class_exists", "(", "$", "environment", ")", ")", "return", "static", "::", "setAlias", "(", "$", "environment...
Give Current Environment To Registery @param string|EnvBase $environment @return null
[ "Give", "Current", "Environment", "To", "Registery" ]
67883b1b1dd2cea80fec3d98a199c403b8a23b4d
https://github.com/phPoirot/Std/blob/67883b1b1dd2cea80fec3d98a199c403b8a23b4d/src/Environment/FactoryEnvironment.php#L99-L106
39,356
phPoirot/Std
src/Environment/FactoryEnvironment.php
FactoryEnvironment.createEnvInstance
protected static function createEnvInstance(string $alias) { ## find alias names: dev->development ==> class_name $EnvClass = null; while(is_string($alias) && isset(static::$_aliases[$alias])) $EnvClass = $alias = static::$_aliases[$alias]; if (is_string($EnvClass) && class_exists($EnvClass)) $EnvClass = new $EnvClass(); if (! $EnvClass instanceof EnvBase) throw new \Exception(sprintf( 'Invalid Alias name provided. "%s".' , (is_callable($aliasOrCallable)) ? \Poirot\Std\flatten($alias).' provided from Callable' : \Poirot\Std\flatten($alias) )); return $EnvClass; }
php
protected static function createEnvInstance(string $alias) { ## find alias names: dev->development ==> class_name $EnvClass = null; while(is_string($alias) && isset(static::$_aliases[$alias])) $EnvClass = $alias = static::$_aliases[$alias]; if (is_string($EnvClass) && class_exists($EnvClass)) $EnvClass = new $EnvClass(); if (! $EnvClass instanceof EnvBase) throw new \Exception(sprintf( 'Invalid Alias name provided. "%s".' , (is_callable($aliasOrCallable)) ? \Poirot\Std\flatten($alias).' provided from Callable' : \Poirot\Std\flatten($alias) )); return $EnvClass; }
[ "protected", "static", "function", "createEnvInstance", "(", "string", "$", "alias", ")", "{", "## find alias names: dev->development ==> class_name", "$", "EnvClass", "=", "null", ";", "while", "(", "is_string", "(", "$", "alias", ")", "&&", "isset", "(", "static...
Create Instance To Environment @param string $alias @return EnvBase @throws \Exception
[ "Create", "Instance", "To", "Environment" ]
67883b1b1dd2cea80fec3d98a199c403b8a23b4d
https://github.com/phPoirot/Std/blob/67883b1b1dd2cea80fec3d98a199c403b8a23b4d/src/Environment/FactoryEnvironment.php#L133-L153
39,357
phPoirot/Std
src/Traits/tMixin.php
tMixin.getMethod
function getMethod($methodName) { if (!$this->hasMethod($methodName)) throw new \Exception(sprintf( 'Method (%s) not found.' , $methodName )); if (isset($this->_t__methods[$methodName])) { ## from bind closure $methodCallable = $this->_t__methods[$methodName]; } else { $bindTo = $this->getBindTo(); $methodCallable = function() use($methodName, $bindTo) { return call_user_func_array([$bindTo, $methodName], func_get_args()); }; } ## bind it into latest bind object $methodCallable = \Closure::bind( $methodCallable , $this->getBindTo() , get_class($this->getBindTo()) ); return $methodCallable; }
php
function getMethod($methodName) { if (!$this->hasMethod($methodName)) throw new \Exception(sprintf( 'Method (%s) not found.' , $methodName )); if (isset($this->_t__methods[$methodName])) { ## from bind closure $methodCallable = $this->_t__methods[$methodName]; } else { $bindTo = $this->getBindTo(); $methodCallable = function() use($methodName, $bindTo) { return call_user_func_array([$bindTo, $methodName], func_get_args()); }; } ## bind it into latest bind object $methodCallable = \Closure::bind( $methodCallable , $this->getBindTo() , get_class($this->getBindTo()) ); return $methodCallable; }
[ "function", "getMethod", "(", "$", "methodName", ")", "{", "if", "(", "!", "$", "this", "->", "hasMethod", "(", "$", "methodName", ")", ")", "throw", "new", "\\", "Exception", "(", "sprintf", "(", "'Method (%s) not found.'", ",", "$", "methodName", ")", ...
Get Method Closure !! if you need args called by reference use get method @param string $methodName @throws \Exception method not found @return \Closure
[ "Get", "Method", "Closure" ]
67883b1b1dd2cea80fec3d98a199c403b8a23b4d
https://github.com/phPoirot/Std/blob/67883b1b1dd2cea80fec3d98a199c403b8a23b4d/src/Traits/tMixin.php#L107-L133
39,358
locomotivemtl/charcoal-property
src/Charcoal/Property/DateTimeProperty.php
DateTimeProperty.inputVal
public function inputVal($val, array $options = []) { $val = $this->dateTimeVal($val); if ($val instanceof DateTimeInterface) { return $val->format('Y-m-d H:i:s'); } else { return ''; } }
php
public function inputVal($val, array $options = []) { $val = $this->dateTimeVal($val); if ($val instanceof DateTimeInterface) { return $val->format('Y-m-d H:i:s'); } else { return ''; } }
[ "public", "function", "inputVal", "(", "$", "val", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "val", "=", "$", "this", "->", "dateTimeVal", "(", "$", "val", ")", ";", "if", "(", "$", "val", "instanceof", "DateTimeInterface", ")", "...
Convert `DateTime` to input-friendly string. @param mixed $val The value to to convert for input. @param array $options Unused, optional options. @throws Exception If the date/time is invalid. @see AbstractProperty::inputVal() @return string|null
[ "Convert", "DateTime", "to", "input", "-", "friendly", "string", "." ]
5ff339a0edb78a909537a9d2bb7f9b783255316b
https://github.com/locomotivemtl/charcoal-property/blob/5ff339a0edb78a909537a9d2bb7f9b783255316b/src/Charcoal/Property/DateTimeProperty.php#L98-L107
39,359
locomotivemtl/charcoal-property
src/Charcoal/Property/DateTimeProperty.php
DateTimeProperty.storageVal
public function storageVal($val) { $val = $this->dateTimeVal($val); if ($val instanceof DateTimeInterface) { return $val->format('Y-m-d H:i:s'); } else { if ($this->allowNull()) { return null; } else { throw new Exception( 'Invalid date/time value. Must be a DateTimeInterface instance.' ); } } }
php
public function storageVal($val) { $val = $this->dateTimeVal($val); if ($val instanceof DateTimeInterface) { return $val->format('Y-m-d H:i:s'); } else { if ($this->allowNull()) { return null; } else { throw new Exception( 'Invalid date/time value. Must be a DateTimeInterface instance.' ); } } }
[ "public", "function", "storageVal", "(", "$", "val", ")", "{", "$", "val", "=", "$", "this", "->", "dateTimeVal", "(", "$", "val", ")", ";", "if", "(", "$", "val", "instanceof", "DateTimeInterface", ")", "{", "return", "$", "val", "->", "format", "("...
Convert `DateTime` to SQL-friendly string. @param string|DateTime $val Optional. Value to convert to storage format. @throws Exception If the date/time is invalid. @see StorablePropertyTrait::storageVal() @return string|null
[ "Convert", "DateTime", "to", "SQL", "-", "friendly", "string", "." ]
5ff339a0edb78a909537a9d2bb7f9b783255316b
https://github.com/locomotivemtl/charcoal-property/blob/5ff339a0edb78a909537a9d2bb7f9b783255316b/src/Charcoal/Property/DateTimeProperty.php#L117-L132
39,360
locomotivemtl/charcoal-property
src/Charcoal/Property/DateTimeProperty.php
DateTimeProperty.displayVal
public function displayVal($val, array $options = []) { $val = $this->dateTimeVal($val); if ($val === null) { return ''; } if (isset($options['format'])) { $format = $options['format']; } else { $format = $this->format(); } return $val->format($format); }
php
public function displayVal($val, array $options = []) { $val = $this->dateTimeVal($val); if ($val === null) { return ''; } if (isset($options['format'])) { $format = $options['format']; } else { $format = $this->format(); } return $val->format($format); }
[ "public", "function", "displayVal", "(", "$", "val", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "val", "=", "$", "this", "->", "dateTimeVal", "(", "$", "val", ")", ";", "if", "(", "$", "val", "===", "null", ")", "{", "return", ...
Format `DateTime` to string. > Warning: Passing a value as a parameter sets this value in the objects (calls setVal()) @param mixed $val The value to to convert for display. @param array $options Optional display options. @see AbstractProperty::displayVal() @return string
[ "Format", "DateTime", "to", "string", "." ]
5ff339a0edb78a909537a9d2bb7f9b783255316b
https://github.com/locomotivemtl/charcoal-property/blob/5ff339a0edb78a909537a9d2bb7f9b783255316b/src/Charcoal/Property/DateTimeProperty.php#L144-L158
39,361
cmsgears/module-core
common/models/entities/Template.php
Template.beforeSave
public function beforeSave( $insert ) { if( parent::beforeSave( $insert ) ) { if( $this->themeId <= 0 ) { $this->themeId = null; } return true; } return false; }
php
public function beforeSave( $insert ) { if( parent::beforeSave( $insert ) ) { if( $this->themeId <= 0 ) { $this->themeId = null; } return true; } return false; }
[ "public", "function", "beforeSave", "(", "$", "insert", ")", "{", "if", "(", "parent", "::", "beforeSave", "(", "$", "insert", ")", ")", "{", "if", "(", "$", "this", "->", "themeId", "<=", "0", ")", "{", "$", "this", "->", "themeId", "=", "null", ...
yii\db\BaseActiveRecord
[ "yii", "\\", "db", "\\", "BaseActiveRecord" ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/entities/Template.php#L225-L238
39,362
cmsgears/module-core
common/models/entities/Template.php
Template.findActiveByType
public static function findActiveByType( $type, $config = [] ) { $ignoreSite = isset( $config[ 'ignoreSite' ] ) ? $config[ 'ignoreSite' ] : false; if( static::isMultiSite() && !$ignoreSite ) { $siteId = isset( $config[ 'siteId' ] ) ? $config[ 'siteId' ] : Yii::$app->core->siteId; return self::queryByType( $type )->andWhere( 'active=:active AND siteId=:siteId', [ ':active' => true, ':siteId' => $siteId ] )->all(); } else { return self::queryByType( $type )->andWhere( 'active=:active', [ ':active' => true ] )->all(); } }
php
public static function findActiveByType( $type, $config = [] ) { $ignoreSite = isset( $config[ 'ignoreSite' ] ) ? $config[ 'ignoreSite' ] : false; if( static::isMultiSite() && !$ignoreSite ) { $siteId = isset( $config[ 'siteId' ] ) ? $config[ 'siteId' ] : Yii::$app->core->siteId; return self::queryByType( $type )->andWhere( 'active=:active AND siteId=:siteId', [ ':active' => true, ':siteId' => $siteId ] )->all(); } else { return self::queryByType( $type )->andWhere( 'active=:active', [ ':active' => true ] )->all(); } }
[ "public", "static", "function", "findActiveByType", "(", "$", "type", ",", "$", "config", "=", "[", "]", ")", "{", "$", "ignoreSite", "=", "isset", "(", "$", "config", "[", "'ignoreSite'", "]", ")", "?", "$", "config", "[", "'ignoreSite'", "]", ":", ...
Find and return the active templates for given type. @param string $type @param array $config @return Template[]
[ "Find", "and", "return", "the", "active", "templates", "for", "given", "type", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/entities/Template.php#L350-L364
39,363
cmsgears/module-core
common/services/traits/resources/DataTrait.php
DataTrait.getDataMeta
public function getDataMeta( $model, $key, $assoc = false ) { $object = $model->generateDataObjectFromJson( $assoc ); $meta = new Meta(); if( isset( $object->$key ) ) { $meta->key = $key; $meta->value = $object->$key; return $meta; } return false; }
php
public function getDataMeta( $model, $key, $assoc = false ) { $object = $model->generateDataObjectFromJson( $assoc ); $meta = new Meta(); if( isset( $object->$key ) ) { $meta->key = $key; $meta->value = $object->$key; return $meta; } return false; }
[ "public", "function", "getDataMeta", "(", "$", "model", ",", "$", "key", ",", "$", "assoc", "=", "false", ")", "{", "$", "object", "=", "$", "model", "->", "generateDataObjectFromJson", "(", "$", "assoc", ")", ";", "$", "meta", "=", "new", "Meta", "(...
Returns the Meta object using given key from data object. @param \cmsgears\core\common\models\base\ActiveRecord $model @param string $key @param boolean $assoc @return boolean|\cmsgears\core\common\models\forms\Meta
[ "Returns", "the", "Meta", "object", "using", "given", "key", "from", "data", "object", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/resources/DataTrait.php#L46-L60
39,364
cmsgears/module-core
common/services/traits/resources/DataTrait.php
DataTrait.getDataKeyMeta
public function getDataKeyMeta( $model, $key, $assoc = false ) { $object = $model->generateDataObjectFromJson( $assoc ); $config = 'data'; $meta = new Meta(); if( isset( $object->$config ) && isset( $object->$config->$key ) ) { $meta->key = $key; $meta->value = $object->$config->$key; return $meta; } return false; }
php
public function getDataKeyMeta( $model, $key, $assoc = false ) { $object = $model->generateDataObjectFromJson( $assoc ); $config = 'data'; $meta = new Meta(); if( isset( $object->$config ) && isset( $object->$config->$key ) ) { $meta->key = $key; $meta->value = $object->$config->$key; return $meta; } return false; }
[ "public", "function", "getDataKeyMeta", "(", "$", "model", ",", "$", "key", ",", "$", "assoc", "=", "false", ")", "{", "$", "object", "=", "$", "model", "->", "generateDataObjectFromJson", "(", "$", "assoc", ")", ";", "$", "config", "=", "'data'", ";",...
Returns the Meta object using given key from data object using data key. @param \cmsgears\core\common\models\base\ActiveRecord $model @param string $key @param boolean $assoc @return boolean|\cmsgears\core\common\models\forms\Meta
[ "Returns", "the", "Meta", "object", "using", "given", "key", "from", "data", "object", "using", "data", "key", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/resources/DataTrait.php#L70-L85
39,365
cmsgears/module-core
common/services/traits/resources/DataTrait.php
DataTrait.getDataCustomMeta
public function getDataCustomMeta( $model, $type, $key, $assoc = false ) { $object = $model->generateDataObjectFromJson( $assoc ); $meta = new Meta(); if( isset( $object->$type ) && isset( $object->$type->$key ) ) { $meta->key = $key; $meta->value = $object->$type->$key; return $meta; } return false; }
php
public function getDataCustomMeta( $model, $type, $key, $assoc = false ) { $object = $model->generateDataObjectFromJson( $assoc ); $meta = new Meta(); if( isset( $object->$type ) && isset( $object->$type->$key ) ) { $meta->key = $key; $meta->value = $object->$type->$key; return $meta; } return false; }
[ "public", "function", "getDataCustomMeta", "(", "$", "model", ",", "$", "type", ",", "$", "key", ",", "$", "assoc", "=", "false", ")", "{", "$", "object", "=", "$", "model", "->", "generateDataObjectFromJson", "(", "$", "assoc", ")", ";", "$", "meta", ...
Returns the Meta object using given type and key from data object. @param \cmsgears\core\common\models\base\ActiveRecord $model @param string $type @param string $key @param boolean $assoc @return boolean|\cmsgears\core\common\models\forms\Meta
[ "Returns", "the", "Meta", "object", "using", "given", "type", "and", "key", "from", "data", "object", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/resources/DataTrait.php#L171-L185
39,366
cmsgears/module-core
common/services/traits/resources/DataTrait.php
DataTrait.updateDataMeta
public function updateDataMeta( $model, $key, $value ) { $model->updateDataMeta( $key, $value ); $model->refresh(); return $model; }
php
public function updateDataMeta( $model, $key, $value ) { $model->updateDataMeta( $key, $value ); $model->refresh(); return $model; }
[ "public", "function", "updateDataMeta", "(", "$", "model", ",", "$", "key", ",", "$", "value", ")", "{", "$", "model", "->", "updateDataMeta", "(", "$", "key", ",", "$", "value", ")", ";", "$", "model", "->", "refresh", "(", ")", ";", "return", "$"...
Update the data object using given key and value. @param \cmsgears\core\common\models\base\ActiveRecord $model @param string $key @param mixed $value @return \cmsgears\core\common\models\base\ActiveRecord
[ "Update", "the", "data", "object", "using", "given", "key", "and", "value", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/resources/DataTrait.php#L205-L212
39,367
cmsgears/module-core
common/services/traits/resources/DataTrait.php
DataTrait.updateDataByParams
public function updateDataByParams( $model, $params = [], $config = [] ) { foreach( $params as $key => $value ) { $model->setDataMeta( $key, $value ); } $model->update(); return $model; }
php
public function updateDataByParams( $model, $params = [], $config = [] ) { foreach( $params as $key => $value ) { $model->setDataMeta( $key, $value ); } $model->update(); return $model; }
[ "public", "function", "updateDataByParams", "(", "$", "model", ",", "$", "params", "=", "[", "]", ",", "$", "config", "=", "[", "]", ")", "{", "foreach", "(", "$", "params", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "model", "->", "set...
Update the data object using multiple key, value pairs from the params. @param \cmsgears\core\common\models\base\ActiveRecord $model @param array $params @param array $config @return \cmsgears\core\common\models\base\ActiveRecord
[ "Update", "the", "data", "object", "using", "multiple", "key", "value", "pairs", "from", "the", "params", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/resources/DataTrait.php#L222-L232
39,368
cmsgears/module-core
common/services/traits/resources/DataTrait.php
DataTrait.updateDataMetaObj
public function updateDataMetaObj( $model, $meta ) { $model->updateDataMeta( $meta->key, $meta->value ); $model->refresh(); return $model; }
php
public function updateDataMetaObj( $model, $meta ) { $model->updateDataMeta( $meta->key, $meta->value ); $model->refresh(); return $model; }
[ "public", "function", "updateDataMetaObj", "(", "$", "model", ",", "$", "meta", ")", "{", "$", "model", "->", "updateDataMeta", "(", "$", "meta", "->", "key", ",", "$", "meta", "->", "value", ")", ";", "$", "model", "->", "refresh", "(", ")", ";", ...
Update the data object using meta model. @param \cmsgears\core\common\models\base\ActiveRecord $model @param \cmsgears\core\common\models\forms\Meta $meta @return \cmsgears\core\common\models\base\ActiveRecord
[ "Update", "the", "data", "object", "using", "meta", "model", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/resources/DataTrait.php#L241-L248
39,369
cmsgears/module-core
common/services/traits/resources/DataTrait.php
DataTrait.updateDataKeyObj
public function updateDataKeyObj( $model, $meta ) { $data = $model->getDataMeta( 'data' ); $key = $meta->key; $data = !empty( $data ) ? $data : new \StdClass(); $data->$key = $meta->value; $model->updateDataMeta( 'data', $data ); $model->refresh(); return $model; }
php
public function updateDataKeyObj( $model, $meta ) { $data = $model->getDataMeta( 'data' ); $key = $meta->key; $data = !empty( $data ) ? $data : new \StdClass(); $data->$key = $meta->value; $model->updateDataMeta( 'data', $data ); $model->refresh(); return $model; }
[ "public", "function", "updateDataKeyObj", "(", "$", "model", ",", "$", "meta", ")", "{", "$", "data", "=", "$", "model", "->", "getDataMeta", "(", "'data'", ")", ";", "$", "key", "=", "$", "meta", "->", "key", ";", "$", "data", "=", "!", "empty", ...
Update the data object using data key and given meta object. @param \cmsgears\core\common\models\base\ActiveRecord $model @param \cmsgears\core\common\models\forms\Meta $meta @return \cmsgears\core\common\models\base\ActiveRecord
[ "Update", "the", "data", "object", "using", "data", "key", "and", "given", "meta", "object", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/resources/DataTrait.php#L257-L270
39,370
cmsgears/module-core
common/services/traits/resources/DataTrait.php
DataTrait.updateDataAttributeObj
public function updateDataAttributeObj( $model, $meta ) { $attributes = $model->getDataMeta( 'attributes' ); $key = $meta->key; $attributes = !empty( $attributes ) ? $attributes : new \StdClass(); $attributes->$key = $meta->value; $model->updateDataMeta( 'attributes', $attributes ); $model->refresh(); return $model; }
php
public function updateDataAttributeObj( $model, $meta ) { $attributes = $model->getDataMeta( 'attributes' ); $key = $meta->key; $attributes = !empty( $attributes ) ? $attributes : new \StdClass(); $attributes->$key = $meta->value; $model->updateDataMeta( 'attributes', $attributes ); $model->refresh(); return $model; }
[ "public", "function", "updateDataAttributeObj", "(", "$", "model", ",", "$", "meta", ")", "{", "$", "attributes", "=", "$", "model", "->", "getDataMeta", "(", "'attributes'", ")", ";", "$", "key", "=", "$", "meta", "->", "key", ";", "$", "attributes", ...
Update the data object using attributes key and given meta object. @param \cmsgears\core\common\models\base\ActiveRecord $model @param \cmsgears\core\common\models\forms\Meta $meta @return \cmsgears\core\common\models\base\ActiveRecord
[ "Update", "the", "data", "object", "using", "attributes", "key", "and", "given", "meta", "object", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/resources/DataTrait.php#L279-L292
39,371
cmsgears/module-core
common/services/traits/resources/DataTrait.php
DataTrait.updateDataConfigObj
public function updateDataConfigObj( $model, $meta ) { $config = $model->getDataMeta( 'config' ); $key = $meta->key; $config = !empty( $config ) ? $config : new \StdClass(); $config->$key = $meta->value; $model->updateDataMeta( 'config', $config ); $model->refresh(); return $model; }
php
public function updateDataConfigObj( $model, $meta ) { $config = $model->getDataMeta( 'config' ); $key = $meta->key; $config = !empty( $config ) ? $config : new \StdClass(); $config->$key = $meta->value; $model->updateDataMeta( 'config', $config ); $model->refresh(); return $model; }
[ "public", "function", "updateDataConfigObj", "(", "$", "model", ",", "$", "meta", ")", "{", "$", "config", "=", "$", "model", "->", "getDataMeta", "(", "'config'", ")", ";", "$", "key", "=", "$", "meta", "->", "key", ";", "$", "config", "=", "!", "...
Update the data object using config key and given meta object. @param \cmsgears\core\common\models\base\ActiveRecord $model @param \cmsgears\core\common\models\forms\Meta $meta @return \cmsgears\core\common\models\base\ActiveRecord
[ "Update", "the", "data", "object", "using", "config", "key", "and", "given", "meta", "object", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/resources/DataTrait.php#L301-L314
39,372
cmsgears/module-core
common/services/traits/resources/DataTrait.php
DataTrait.updateDataSettingObj
public function updateDataSettingObj( $model, $meta ) { $settings = $model->getDataMeta( 'settings' ); $key = $meta->key; $settings = !empty( $settings ) ? $settings : new \StdClass(); $settings->$key = $meta->value; $model->updateDataMeta( 'settings', $settings ); $model->refresh(); return $model; }
php
public function updateDataSettingObj( $model, $meta ) { $settings = $model->getDataMeta( 'settings' ); $key = $meta->key; $settings = !empty( $settings ) ? $settings : new \StdClass(); $settings->$key = $meta->value; $model->updateDataMeta( 'settings', $settings ); $model->refresh(); return $model; }
[ "public", "function", "updateDataSettingObj", "(", "$", "model", ",", "$", "meta", ")", "{", "$", "settings", "=", "$", "model", "->", "getDataMeta", "(", "'settings'", ")", ";", "$", "key", "=", "$", "meta", "->", "key", ";", "$", "settings", "=", "...
Update the data object using settings key and given meta object. @param \cmsgears\core\common\models\base\ActiveRecord $model @param \cmsgears\core\common\models\forms\Meta $meta @return \cmsgears\core\common\models\base\ActiveRecord
[ "Update", "the", "data", "object", "using", "settings", "key", "and", "given", "meta", "object", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/resources/DataTrait.php#L323-L336
39,373
cmsgears/module-core
common/services/traits/resources/DataTrait.php
DataTrait.updateDataCustomObj
public function updateDataCustomObj( $model, $type, $meta ) { $custom = $model->getDataMeta( $type ); $key = $meta->key; $custom = !empty( $custom ) ? $custom : new \StdClass(); $custom->$key = $meta->value; $model->updateDataMeta( $type, $custom ); $model->refresh(); return $model; }
php
public function updateDataCustomObj( $model, $type, $meta ) { $custom = $model->getDataMeta( $type ); $key = $meta->key; $custom = !empty( $custom ) ? $custom : new \StdClass(); $custom->$key = $meta->value; $model->updateDataMeta( $type, $custom ); $model->refresh(); return $model; }
[ "public", "function", "updateDataCustomObj", "(", "$", "model", ",", "$", "type", ",", "$", "meta", ")", "{", "$", "custom", "=", "$", "model", "->", "getDataMeta", "(", "$", "type", ")", ";", "$", "key", "=", "$", "meta", "->", "key", ";", "$", ...
Update the data object using custom key and given meta object. @param \cmsgears\core\common\models\base\ActiveRecord $model @param string $type @param \cmsgears\core\common\models\forms\Meta $meta @return \cmsgears\core\common\models\base\ActiveRecord
[ "Update", "the", "data", "object", "using", "custom", "key", "and", "given", "meta", "object", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/resources/DataTrait.php#L346-L359
39,374
cmsgears/module-core
common/services/traits/resources/DataTrait.php
DataTrait.removeDataMetaObj
public function removeDataMetaObj( $model, $meta ) { $model->removeDataMeta( $meta->key ); $model->refresh(); return $model; }
php
public function removeDataMetaObj( $model, $meta ) { $model->removeDataMeta( $meta->key ); $model->refresh(); return $model; }
[ "public", "function", "removeDataMetaObj", "(", "$", "model", ",", "$", "meta", ")", "{", "$", "model", "->", "removeDataMeta", "(", "$", "meta", "->", "key", ")", ";", "$", "model", "->", "refresh", "(", ")", ";", "return", "$", "model", ";", "}" ]
Update the data object by removing the given key using meta object. @param \cmsgears\core\common\models\base\ActiveRecord $model @param \cmsgears\core\common\models\forms\Meta $meta @return \cmsgears\core\common\models\base\ActiveRecord
[ "Update", "the", "data", "object", "by", "removing", "the", "given", "key", "using", "meta", "object", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/resources/DataTrait.php#L386-L393
39,375
cmsgears/module-core
common/services/traits/resources/DataTrait.php
DataTrait.removeDataKeyObj
public function removeDataKeyObj( $model, $meta ) { $config = $model->getDataMeta( 'data' ); $rkey = $meta->key; unset( $config->$rkey ); $model->updateDataMeta( 'data', $config ); $model->refresh(); return $model; }
php
public function removeDataKeyObj( $model, $meta ) { $config = $model->getDataMeta( 'data' ); $rkey = $meta->key; unset( $config->$rkey ); $model->updateDataMeta( 'data', $config ); $model->refresh(); return $model; }
[ "public", "function", "removeDataKeyObj", "(", "$", "model", ",", "$", "meta", ")", "{", "$", "config", "=", "$", "model", "->", "getDataMeta", "(", "'data'", ")", ";", "$", "rkey", "=", "$", "meta", "->", "key", ";", "unset", "(", "$", "config", "...
Update the data object by removing the given key from data. @param \cmsgears\core\common\models\base\ActiveRecord $model @param \cmsgears\core\common\models\forms\Meta $meta @return \cmsgears\core\common\models\base\ActiveRecord
[ "Update", "the", "data", "object", "by", "removing", "the", "given", "key", "from", "data", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/services/traits/resources/DataTrait.php#L402-L414
39,376
cmsgears/module-core
common/components/Mailer.php
Mailer.sendCreateUserMail
public function sendCreateUserMail( $user ) { $siteName = $this->coreProperties->getSiteName(); $fromEmail = $this->mailProperties->getSenderEmail(); $fromName = $this->mailProperties->getSenderName(); // Send Mail $this->getMailer()->compose( self::MAIL_ACCOUNT_CREATE, [ 'coreProperties' => $this->coreProperties, 'user' => $user ] ) ->setTo( $user->email ) ->setFrom( [ $fromEmail => "$fromName | $siteName" ] ) ->setSubject( "Registration | " . $this->coreProperties->getSiteName() ) //->setTextBody( "heroor" ) ->send(); }
php
public function sendCreateUserMail( $user ) { $siteName = $this->coreProperties->getSiteName(); $fromEmail = $this->mailProperties->getSenderEmail(); $fromName = $this->mailProperties->getSenderName(); // Send Mail $this->getMailer()->compose( self::MAIL_ACCOUNT_CREATE, [ 'coreProperties' => $this->coreProperties, 'user' => $user ] ) ->setTo( $user->email ) ->setFrom( [ $fromEmail => "$fromName | $siteName" ] ) ->setSubject( "Registration | " . $this->coreProperties->getSiteName() ) //->setTextBody( "heroor" ) ->send(); }
[ "public", "function", "sendCreateUserMail", "(", "$", "user", ")", "{", "$", "siteName", "=", "$", "this", "->", "coreProperties", "->", "getSiteName", "(", ")", ";", "$", "fromEmail", "=", "$", "this", "->", "mailProperties", "->", "getSenderEmail", "(", ...
The method sends mail for accounts created by site admin.
[ "The", "method", "sends", "mail", "for", "accounts", "created", "by", "site", "admin", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/components/Mailer.php#L75-L88
39,377
cmsgears/module-core
common/components/Mailer.php
Mailer.sendCommentSpamRequestMail
public function sendCommentSpamRequestMail( $comment, $updatePath ) { $siteName = $this->coreProperties->getSiteName(); $fromEmail = $this->mailProperties->getSenderEmail(); $fromName = $this->mailProperties->getSenderName(); $contactEmail = $this->mailProperties->getContactEmail(); // Send Mail $this->getMailer()->compose( self::MAIL_COMMENT_SPAM_REQUEST, [ 'coreProperties' => $this->coreProperties, 'comment' => $comment, 'updatePath' => $updatePath ] ) ->setTo( $contactEmail ) ->setFrom( [ $fromEmail => "$fromName | $siteName" ] ) ->setSubject( "Spam Request | " . $this->coreProperties->getSiteName() ) //->setTextBody( "heroor" ) ->send(); }
php
public function sendCommentSpamRequestMail( $comment, $updatePath ) { $siteName = $this->coreProperties->getSiteName(); $fromEmail = $this->mailProperties->getSenderEmail(); $fromName = $this->mailProperties->getSenderName(); $contactEmail = $this->mailProperties->getContactEmail(); // Send Mail $this->getMailer()->compose( self::MAIL_COMMENT_SPAM_REQUEST, [ 'coreProperties' => $this->coreProperties, 'comment' => $comment, 'updatePath' => $updatePath ] ) ->setTo( $contactEmail ) ->setFrom( [ $fromEmail => "$fromName | $siteName" ] ) ->setSubject( "Spam Request | " . $this->coreProperties->getSiteName() ) //->setTextBody( "heroor" ) ->send(); }
[ "public", "function", "sendCommentSpamRequestMail", "(", "$", "comment", ",", "$", "updatePath", ")", "{", "$", "siteName", "=", "$", "this", "->", "coreProperties", "->", "getSiteName", "(", ")", ";", "$", "fromEmail", "=", "$", "this", "->", "mailPropertie...
The method sends mail for spam comment request by users from website.
[ "The", "method", "sends", "mail", "for", "spam", "comment", "request", "by", "users", "from", "website", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/components/Mailer.php#L183-L197
39,378
gregorybesson/PlaygroundReward
src/Module.php
Module.getLeaderboardUserTotal
public function getLeaderboardUserTotal($e) { $user = $e->getParam('user'); $leaderboardService = $e->getTarget() ->getServiceManager() ->get(\PlaygroundReward\Service\LeaderBoard::class); $userPoints = $leaderboardService->getTotal($user); return $userPoints; }
php
public function getLeaderboardUserTotal($e) { $user = $e->getParam('user'); $leaderboardService = $e->getTarget() ->getServiceManager() ->get(\PlaygroundReward\Service\LeaderBoard::class); $userPoints = $leaderboardService->getTotal($user); return $userPoints; }
[ "public", "function", "getLeaderboardUserTotal", "(", "$", "e", ")", "{", "$", "user", "=", "$", "e", "->", "getParam", "(", "'user'", ")", ";", "$", "leaderboardService", "=", "$", "e", "->", "getTarget", "(", ")", "->", "getServiceManager", "(", ")", ...
This method get the points of a player in default leaderboard @param EventManager $e @return array
[ "This", "method", "get", "the", "points", "of", "a", "player", "in", "default", "leaderboard" ]
313ba96f530f27066ebaec6613f78c9bfe257862
https://github.com/gregorybesson/PlaygroundReward/blob/313ba96f530f27066ebaec6613f78c9bfe257862/src/Module.php#L68-L78
39,379
mcaskill/charcoal-support
src/App/Template/DynamicAppConfigTrait.php
DynamicAppConfigTrait.setAppConfig
protected function setAppConfig(AppConfig $appConfig) { if ($this->appConfig !== null) { throw new InvalidArgumentException( 'Application configset already assigned.' ); } $dynConfig = $this->dynamicConfig(); if ($dynConfig instanceof DelegatesAwareInterface) { $dynConfig->prependDelegate($appConfig); $this->appConfig = $dynConfig; } elseif ($dynConfig instanceof EntityInterface) { $appConfig['dynamic'] = $dynConfig; $appConfig->prependDelegate($dynConfig); $this->appConfig = $appConfig; } else { $this->appConfig = $appConfig; } return $this; }
php
protected function setAppConfig(AppConfig $appConfig) { if ($this->appConfig !== null) { throw new InvalidArgumentException( 'Application configset already assigned.' ); } $dynConfig = $this->dynamicConfig(); if ($dynConfig instanceof DelegatesAwareInterface) { $dynConfig->prependDelegate($appConfig); $this->appConfig = $dynConfig; } elseif ($dynConfig instanceof EntityInterface) { $appConfig['dynamic'] = $dynConfig; $appConfig->prependDelegate($dynConfig); $this->appConfig = $appConfig; } else { $this->appConfig = $appConfig; } return $this; }
[ "protected", "function", "setAppConfig", "(", "AppConfig", "$", "appConfig", ")", "{", "if", "(", "$", "this", "->", "appConfig", "!==", "null", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Application configset already assigned.'", ")", ";", "}", ...
Set the application's configset. Note: This method should be called after {@see self::setDynamicConfig()} or {@see self::setDynamicConfigClass()}. @param AppConfig $appConfig A Charcoal application configset. @throws InvalidArgumentException If a configset already exists. @return self
[ "Set", "the", "application", "s", "configset", "." ]
2138a34463ca6865bf3a60635aa11381a9ae73c5
https://github.com/mcaskill/charcoal-support/blob/2138a34463ca6865bf3a60635aa11381a9ae73c5/src/App/Template/DynamicAppConfigTrait.php#L59-L80
39,380
mcaskill/charcoal-support
src/App/Template/DynamicAppConfigTrait.php
DynamicAppConfigTrait.setDynamicConfig
protected function setDynamicConfig(EntityInterface $dynConfig) { if ($this->dynamicConfig !== null) { throw new InvalidArgumentException( 'Dynamic configset already assigned.' ); } if ($this->appConfig !== null) { if ($dynConfig instanceof DelegatesAwareInterface) { $dynConfig->prependDelegate($this->appConfig); } else { $appConfig['dynamic'] = $dynConfig; $appConfig->prependDelegate($dynConfig); } } $this->dynamicConfig = $dynConfig; return $this; }
php
protected function setDynamicConfig(EntityInterface $dynConfig) { if ($this->dynamicConfig !== null) { throw new InvalidArgumentException( 'Dynamic configset already assigned.' ); } if ($this->appConfig !== null) { if ($dynConfig instanceof DelegatesAwareInterface) { $dynConfig->prependDelegate($this->appConfig); } else { $appConfig['dynamic'] = $dynConfig; $appConfig->prependDelegate($dynConfig); } } $this->dynamicConfig = $dynConfig; return $this; }
[ "protected", "function", "setDynamicConfig", "(", "EntityInterface", "$", "dynConfig", ")", "{", "if", "(", "$", "this", "->", "dynamicConfig", "!==", "null", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Dynamic configset already assigned.'", ")", ";...
Set the dynamic configset instance. Note: This method should be called before {@see self::setAppConfig()}. @param EntityInterface $dynConfig A dynamic configset. @throws InvalidArgumentException If a configset already exists. @return self
[ "Set", "the", "dynamic", "configset", "instance", "." ]
2138a34463ca6865bf3a60635aa11381a9ae73c5
https://github.com/mcaskill/charcoal-support/blob/2138a34463ca6865bf3a60635aa11381a9ae73c5/src/App/Template/DynamicAppConfigTrait.php#L147-L166
39,381
mcaskill/charcoal-support
src/App/Template/DynamicAppConfigTrait.php
DynamicAppConfigTrait.dynamicConfig
protected function dynamicConfig() { if ($this->dynamicConfig === null) { $this->dynamicConfig = $this->loadDynamicConfig(); } return $this->dynamicConfig; }
php
protected function dynamicConfig() { if ($this->dynamicConfig === null) { $this->dynamicConfig = $this->loadDynamicConfig(); } return $this->dynamicConfig; }
[ "protected", "function", "dynamicConfig", "(", ")", "{", "if", "(", "$", "this", "->", "dynamicConfig", "===", "null", ")", "{", "$", "this", "->", "dynamicConfig", "=", "$", "this", "->", "loadDynamicConfig", "(", ")", ";", "}", "return", "$", "this", ...
Retrieve the dynamic configset instance. @return DelegatesAwareInterface|EntityInterface|null
[ "Retrieve", "the", "dynamic", "configset", "instance", "." ]
2138a34463ca6865bf3a60635aa11381a9ae73c5
https://github.com/mcaskill/charcoal-support/blob/2138a34463ca6865bf3a60635aa11381a9ae73c5/src/App/Template/DynamicAppConfigTrait.php#L173-L180
39,382
rodrigoiii/skeleton-core
src/classes/Console/Commands/MakeDebugbarCommand.php
MakeDebugbarCommand.makeTemplate
private function makeTemplate($debugbar) { $file = __DIR__ . "/../templates/debugbar.php.dist"; if (file_exists($file)) { $template = strtr(file_get_contents($file), [ '{{namespace}}' => get_app_namespace(), '{{debugbar}}' => $debugbar ]); if (!file_exists(app_path("Debugbars"))) { mkdir(app_path("Debugbars"), 0755, true); } $file_path = app_path("Debugbars/{$debugbar}.php"); $file = fopen($file_path, "w"); fwrite($file, $template); fclose($file); return file_exists($file_path); } return false; }
php
private function makeTemplate($debugbar) { $file = __DIR__ . "/../templates/debugbar.php.dist"; if (file_exists($file)) { $template = strtr(file_get_contents($file), [ '{{namespace}}' => get_app_namespace(), '{{debugbar}}' => $debugbar ]); if (!file_exists(app_path("Debugbars"))) { mkdir(app_path("Debugbars"), 0755, true); } $file_path = app_path("Debugbars/{$debugbar}.php"); $file = fopen($file_path, "w"); fwrite($file, $template); fclose($file); return file_exists($file_path); } return false; }
[ "private", "function", "makeTemplate", "(", "$", "debugbar", ")", "{", "$", "file", "=", "__DIR__", ".", "\"/../templates/debugbar.php.dist\"", ";", "if", "(", "file_exists", "(", "$", "file", ")", ")", "{", "$", "template", "=", "strtr", "(", "file_get_cont...
Create the debugbar template. @depends handle @param string $debugbar @return boolean
[ "Create", "the", "debugbar", "template", "." ]
5dab0637b9cd0f55a64b1f5926d7ba6bb3f93df0
https://github.com/rodrigoiii/skeleton-core/blob/5dab0637b9cd0f55a64b1f5926d7ba6bb3f93df0/src/classes/Console/Commands/MakeDebugbarCommand.php#L63-L88
39,383
cmsgears/module-core
common/models/mappers/ModelFile.php
ModelFile.findByFileTag
public static function findByFileTag( $parentId, $parentType, $fileTag, $type = null ) { $mapTable = static::tableName(); $fileTable = CoreTables::getTableName( CoreTables::TABLE_FILE ); if( empty( $type ) ) { $type = CoreGlobal::TYPE_DEFAULT; } return self::queryByParent( $parentId, $parentType )->andWhere( "$fileTable.tag=:tag AND $mapTable.type=:type", [ ':tag' => $fileTag, ':type' => $type ] )->one(); }
php
public static function findByFileTag( $parentId, $parentType, $fileTag, $type = null ) { $mapTable = static::tableName(); $fileTable = CoreTables::getTableName( CoreTables::TABLE_FILE ); if( empty( $type ) ) { $type = CoreGlobal::TYPE_DEFAULT; } return self::queryByParent( $parentId, $parentType )->andWhere( "$fileTable.tag=:tag AND $mapTable.type=:type", [ ':tag' => $fileTag, ':type' => $type ] )->one(); }
[ "public", "static", "function", "findByFileTag", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "fileTag", ",", "$", "type", "=", "null", ")", "{", "$", "mapTable", "=", "static", "::", "tableName", "(", ")", ";", "$", "fileTable", "=", "CoreT...
Find and return the mappings for given title. It's useful in cases where unique title is required for file. @param integer $parentId @param string $parentType @param string $fileTag @return ModelFile
[ "Find", "and", "return", "the", "mappings", "for", "given", "title", ".", "It", "s", "useful", "in", "cases", "where", "unique", "title", "is", "required", "for", "file", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/mappers/ModelFile.php#L152-L163
39,384
cmsgears/module-core
common/models/mappers/ModelFile.php
ModelFile.findByFileTitle
public static function findByFileTitle( $parentId, $parentType, $fileTitle ) { $fileTable = CoreTables::getTableName( CoreTables::TABLE_FILE ); return self::queryByParent( $parentId, $parentType )->andFilterWhere( [ 'like', "$fileTable.title", $fileTitle ] )->all(); }
php
public static function findByFileTitle( $parentId, $parentType, $fileTitle ) { $fileTable = CoreTables::getTableName( CoreTables::TABLE_FILE ); return self::queryByParent( $parentId, $parentType )->andFilterWhere( [ 'like', "$fileTable.title", $fileTitle ] )->all(); }
[ "public", "static", "function", "findByFileTitle", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "fileTitle", ")", "{", "$", "fileTable", "=", "CoreTables", "::", "getTableName", "(", "CoreTables", "::", "TABLE_FILE", ")", ";", "return", "self", ":...
Find and return the mappings for given title. @param integer $parentId @param string $parentType @param string $fileTitle @return ModelFile[]
[ "Find", "and", "return", "the", "mappings", "for", "given", "title", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/mappers/ModelFile.php#L173-L178
39,385
cmsgears/module-core
common/models/mappers/ModelFile.php
ModelFile.findByFileType
public static function findByFileType( $parentId, $parentType, $fileType ) { $fileTable = CoreTables::getTableName( CoreTables::TABLE_FILE ); return self::queryByParent( $parentId, $parentType )->andFilterWhere( [ 'like', "$fileTable.type", $fileType ] )->all(); }
php
public static function findByFileType( $parentId, $parentType, $fileType ) { $fileTable = CoreTables::getTableName( CoreTables::TABLE_FILE ); return self::queryByParent( $parentId, $parentType )->andFilterWhere( [ 'like', "$fileTable.type", $fileType ] )->all(); }
[ "public", "static", "function", "findByFileType", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "fileType", ")", "{", "$", "fileTable", "=", "CoreTables", "::", "getTableName", "(", "CoreTables", "::", "TABLE_FILE", ")", ";", "return", "self", "::"...
Find and return the mappings for file type. @param integer $parentId @param string $parentType @param string $fileType @return ModelFile[]
[ "Find", "and", "return", "the", "mappings", "for", "file", "type", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/mappers/ModelFile.php#L188-L193
39,386
gregorybesson/PlaygroundReward
src/Controller/Admin/LeaderBoardTypeController.php
LeaderBoardTypeController.getLeaderboardTypeService
public function getLeaderboardTypeService() { if (null === $this->leaderboardTypeService) { $this->leaderboardTypeService = $this->getServiceLocator()->get( \PlaygroundReward\Service\LeaderboardType::class ); } return $this->leaderboardTypeService; }
php
public function getLeaderboardTypeService() { if (null === $this->leaderboardTypeService) { $this->leaderboardTypeService = $this->getServiceLocator()->get( \PlaygroundReward\Service\LeaderboardType::class ); } return $this->leaderboardTypeService; }
[ "public", "function", "getLeaderboardTypeService", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "leaderboardTypeService", ")", "{", "$", "this", "->", "leaderboardTypeService", "=", "$", "this", "->", "getServiceLocator", "(", ")", "->", "get", ...
Retrieve service leaderboardType instance @return Service/leaderboardType leaderboardTypeService
[ "Retrieve", "service", "leaderboardType", "instance" ]
313ba96f530f27066ebaec6613f78c9bfe257862
https://github.com/gregorybesson/PlaygroundReward/blob/313ba96f530f27066ebaec6613f78c9bfe257862/src/Controller/Admin/LeaderBoardTypeController.php#L150-L159
39,387
fxpio/fxp-cache
Adapter/AdapterUtil.php
AdapterUtil.setPropertyValue
public static function setPropertyValue($object, $property, $value): void { $ref = new \ReflectionClass($object); $prop = static::getPrivateProperty($ref, $property); $prop->setAccessible(true); $prop->setValue($object, $value); $prop->setAccessible(false); }
php
public static function setPropertyValue($object, $property, $value): void { $ref = new \ReflectionClass($object); $prop = static::getPrivateProperty($ref, $property); $prop->setAccessible(true); $prop->setValue($object, $value); $prop->setAccessible(false); }
[ "public", "static", "function", "setPropertyValue", "(", "$", "object", ",", "$", "property", ",", "$", "value", ")", ":", "void", "{", "$", "ref", "=", "new", "\\", "ReflectionClass", "(", "$", "object", ")", ";", "$", "prop", "=", "static", "::", "...
Set the value of private property. @param object $object The object @param string $property The property name @param mixed $value The value
[ "Set", "the", "value", "of", "private", "property", "." ]
55abf44a954890080fa2bfb080914ce7228ea769
https://github.com/fxpio/fxp-cache/blob/55abf44a954890080fa2bfb080914ce7228ea769/Adapter/AdapterUtil.php#L28-L35
39,388
fxpio/fxp-cache
Adapter/AdapterUtil.php
AdapterUtil.getPropertyValue
public static function getPropertyValue($object, $property) { $ref = new \ReflectionClass($object); $prop = static::getPrivateProperty($ref, $property); $prop->setAccessible(true); $value = $prop->getValue($object); $prop->setAccessible(false); return $value; }
php
public static function getPropertyValue($object, $property) { $ref = new \ReflectionClass($object); $prop = static::getPrivateProperty($ref, $property); $prop->setAccessible(true); $value = $prop->getValue($object); $prop->setAccessible(false); return $value; }
[ "public", "static", "function", "getPropertyValue", "(", "$", "object", ",", "$", "property", ")", "{", "$", "ref", "=", "new", "\\", "ReflectionClass", "(", "$", "object", ")", ";", "$", "prop", "=", "static", "::", "getPrivateProperty", "(", "$", "ref"...
Get the value of private property. @param object $object The object @param string $property The property name @return mixed
[ "Get", "the", "value", "of", "private", "property", "." ]
55abf44a954890080fa2bfb080914ce7228ea769
https://github.com/fxpio/fxp-cache/blob/55abf44a954890080fa2bfb080914ce7228ea769/Adapter/AdapterUtil.php#L45-L54
39,389
fxpio/fxp-cache
Adapter/AdapterUtil.php
AdapterUtil.getPrivateProperty
public static function getPrivateProperty(\ReflectionClass $reflectionClass, $property) { if (!$reflectionClass->hasProperty($property) && $reflectionClass->getParentClass()) { return static::getPrivateProperty($reflectionClass->getParentClass(), $property); } return $reflectionClass->getProperty($property); }
php
public static function getPrivateProperty(\ReflectionClass $reflectionClass, $property) { if (!$reflectionClass->hasProperty($property) && $reflectionClass->getParentClass()) { return static::getPrivateProperty($reflectionClass->getParentClass(), $property); } return $reflectionClass->getProperty($property); }
[ "public", "static", "function", "getPrivateProperty", "(", "\\", "ReflectionClass", "$", "reflectionClass", ",", "$", "property", ")", "{", "if", "(", "!", "$", "reflectionClass", "->", "hasProperty", "(", "$", "property", ")", "&&", "$", "reflectionClass", "-...
Get the private property. @param \ReflectionClass $reflectionClass The reflection class @param string $property The property name @return \ReflectionProperty
[ "Get", "the", "private", "property", "." ]
55abf44a954890080fa2bfb080914ce7228ea769
https://github.com/fxpio/fxp-cache/blob/55abf44a954890080fa2bfb080914ce7228ea769/Adapter/AdapterUtil.php#L64-L71
39,390
rodrigoiii/skeleton-core
src/classes/Utilities/Log.php
Log.logger
private static function logger() { $settings = [ 'name' => config('app.name'), 'level' => Logger::DEBUG, 'path' => storage_path("logs/" . (PHP_SAPI === "cli" ? "cli.log" : "app.log")) ]; $logger = new Logger($settings['name']); $handler = new StreamHandler($settings['path']); $lineFormatter = new LineFormatter; $lineFormatter->includeStacktraces(); $handler->setFormatter($lineFormatter); return $logger->pushHandler($handler, $settings['level']); }
php
private static function logger() { $settings = [ 'name' => config('app.name'), 'level' => Logger::DEBUG, 'path' => storage_path("logs/" . (PHP_SAPI === "cli" ? "cli.log" : "app.log")) ]; $logger = new Logger($settings['name']); $handler = new StreamHandler($settings['path']); $lineFormatter = new LineFormatter; $lineFormatter->includeStacktraces(); $handler->setFormatter($lineFormatter); return $logger->pushHandler($handler, $settings['level']); }
[ "private", "static", "function", "logger", "(", ")", "{", "$", "settings", "=", "[", "'name'", "=>", "config", "(", "'app.name'", ")", ",", "'level'", "=>", "Logger", "::", "DEBUG", ",", "'path'", "=>", "storage_path", "(", "\"logs/\"", ".", "(", "PHP_SA...
Ready the logger object. @return mixed
[ "Ready", "the", "logger", "object", "." ]
5dab0637b9cd0f55a64b1f5926d7ba6bb3f93df0
https://github.com/rodrigoiii/skeleton-core/blob/5dab0637b9cd0f55a64b1f5926d7ba6bb3f93df0/src/classes/Utilities/Log.php#L21-L38
39,391
cmsgears/module-core
common/models/forms/GenericForm.php
GenericForm.getFormAttributes
public function getFormAttributes( $classPath = null ) { if( !isset( $classPath ) ) { $classPath = 'cmsgears\core\common\models\forms\GenericForm'; } $refclass = new \ReflectionClass( $classPath ); $attribArr = array(); foreach ( $refclass->getProperties() as $property ) { $name = $property->name; if ( $property->class == $refclass->name ) { $attribArr[ $name ] = $this->$name; } } return $attribArr; }
php
public function getFormAttributes( $classPath = null ) { if( !isset( $classPath ) ) { $classPath = 'cmsgears\core\common\models\forms\GenericForm'; } $refclass = new \ReflectionClass( $classPath ); $attribArr = array(); foreach ( $refclass->getProperties() as $property ) { $name = $property->name; if ( $property->class == $refclass->name ) { $attribArr[ $name ] = $this->$name; } } return $attribArr; }
[ "public", "function", "getFormAttributes", "(", "$", "classPath", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "classPath", ")", ")", "{", "$", "classPath", "=", "'cmsgears\\core\\common\\models\\forms\\GenericForm'", ";", "}", "$", "refclass", "=...
Collect and return the list of class members and their values using reflection. @return array List of class members and their value.
[ "Collect", "and", "return", "the", "list", "of", "class", "members", "and", "their", "values", "using", "reflection", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/forms/GenericForm.php#L248-L269
39,392
cmsgears/module-core
common/models/resources/ModelMeta.php
ModelMeta.belongsTo
public function belongsTo( $parent, $parentType ) { return $this->parentId == $parent->id && $this->parentType == $parentType; }
php
public function belongsTo( $parent, $parentType ) { return $this->parentId == $parent->id && $this->parentType == $parentType; }
[ "public", "function", "belongsTo", "(", "$", "parent", ",", "$", "parentType", ")", "{", "return", "$", "this", "->", "parentId", "==", "$", "parent", "->", "id", "&&", "$", "this", "->", "parentType", "==", "$", "parentType", ";", "}" ]
Check whether the meta belongs to given parent model. @param \cmsgears\core\common\models\base\ActiveRecord $parent @param string $parentType @return boolean
[ "Check", "whether", "the", "meta", "belongs", "to", "given", "parent", "model", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/resources/ModelMeta.php#L143-L146
39,393
cmsgears/module-core
common/models/resources/ModelMeta.php
ModelMeta.queryByName
public static function queryByName( $parentId, $parentType, $name, $config = [] ) { $query = static::queryByParent( $parentId, $parentType, $config ); $query->andWhere( 'name=:name', [ ':name' => $name ] ); return $query; }
php
public static function queryByName( $parentId, $parentType, $name, $config = [] ) { $query = static::queryByParent( $parentId, $parentType, $config ); $query->andWhere( 'name=:name', [ ':name' => $name ] ); return $query; }
[ "public", "static", "function", "queryByName", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "name", ",", "$", "config", "=", "[", "]", ")", "{", "$", "query", "=", "static", "::", "queryByParent", "(", "$", "parentId", ",", "$", "parentType"...
Return query to find the model meta by given parent id, parent type and name. @param integer $parentId @param string $parentType @param string $name @param array $config @return \yii\db\ActiveQuery to query by parent id, parent type and name.
[ "Return", "query", "to", "find", "the", "model", "meta", "by", "given", "parent", "id", "parent", "type", "and", "name", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/resources/ModelMeta.php#L177-L184
39,394
cmsgears/module-core
common/models/resources/ModelMeta.php
ModelMeta.queryByType
public static function queryByType( $parentId, $parentType, $type, $config = [] ) { $query = static::queryByParent( $parentId, $parentType, $config ); $query->andWhere( 'type=:type', [ ':type' => $type ] ); return $query; }
php
public static function queryByType( $parentId, $parentType, $type, $config = [] ) { $query = static::queryByParent( $parentId, $parentType, $config ); $query->andWhere( 'type=:type', [ ':type' => $type ] ); return $query; }
[ "public", "static", "function", "queryByType", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "type", ",", "$", "config", "=", "[", "]", ")", "{", "$", "query", "=", "static", "::", "queryByParent", "(", "$", "parentId", ",", "$", "parentType"...
Return query to find the model meta by given parent id, parent type and type. @param integer $parentId @param string $parentType @param string $type @param array $config @return \yii\db\ActiveQuery to query by parent id, parent type and name.
[ "Return", "query", "to", "find", "the", "model", "meta", "by", "given", "parent", "id", "parent", "type", "and", "type", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/resources/ModelMeta.php#L195-L202
39,395
cmsgears/module-core
common/models/resources/ModelMeta.php
ModelMeta.queryByNameType
public static function queryByNameType( $parentId, $parentType, $name, $type, $config = [] ) { $query = static::queryByParent( $parentId, $parentType, $config ); $query->andWhere( 'name=:name AND type=:type', [ ':name' => $name, ':type' => $type ] ); return $query; }
php
public static function queryByNameType( $parentId, $parentType, $name, $type, $config = [] ) { $query = static::queryByParent( $parentId, $parentType, $config ); $query->andWhere( 'name=:name AND type=:type', [ ':name' => $name, ':type' => $type ] ); return $query; }
[ "public", "static", "function", "queryByNameType", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "name", ",", "$", "type", ",", "$", "config", "=", "[", "]", ")", "{", "$", "query", "=", "static", "::", "queryByParent", "(", "$", "parentId", ...
Return query to find the model meta by given parent id, parent type, name and type. @param integer $parentId @param string $parentType @param string $name @param string $type @param array $config @return \yii\db\ActiveQuery to query by parent id, parent type and name.
[ "Return", "query", "to", "find", "the", "model", "meta", "by", "given", "parent", "id", "parent", "type", "name", "and", "type", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/resources/ModelMeta.php#L214-L221
39,396
cmsgears/module-core
common/models/resources/ModelMeta.php
ModelMeta.findByName
public static function findByName( $parentId, $parentType, $name, $config = [] ) { return self::queryByName( $parentId, $parentType, $name, $config )->all(); }
php
public static function findByName( $parentId, $parentType, $name, $config = [] ) { return self::queryByName( $parentId, $parentType, $name, $config )->all(); }
[ "public", "static", "function", "findByName", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "name", ",", "$", "config", "=", "[", "]", ")", "{", "return", "self", "::", "queryByName", "(", "$", "parentId", ",", "$", "parentType", ",", "$", ...
Find and return the meta associated with parent for given name. @param integer $parentId @param string $parentType @param string $name @param array $config @return ModelMeta[]
[ "Find", "and", "return", "the", "meta", "associated", "with", "parent", "for", "given", "name", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/resources/ModelMeta.php#L234-L237
39,397
cmsgears/module-core
common/models/resources/ModelMeta.php
ModelMeta.findByType
public static function findByType( $parentId, $parentType, $type, $config = [] ) { return self::queryByType( $parentId, $parentType, $type, $config )->all(); }
php
public static function findByType( $parentId, $parentType, $type, $config = [] ) { return self::queryByType( $parentId, $parentType, $type, $config )->all(); }
[ "public", "static", "function", "findByType", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "type", ",", "$", "config", "=", "[", "]", ")", "{", "return", "self", "::", "queryByType", "(", "$", "parentId", ",", "$", "parentType", ",", "$", ...
Find and return the meta associated with parent for given type. @param integer $parentId @param string $parentType @param string $type @param array $config @return ModelMeta[]
[ "Find", "and", "return", "the", "meta", "associated", "with", "parent", "for", "given", "type", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/resources/ModelMeta.php#L248-L251
39,398
cmsgears/module-core
common/models/resources/ModelMeta.php
ModelMeta.findByNameType
public static function findByNameType( $parentId, $parentType, $name, $type, $config = [] ) { return self::queryByNameType( $parentId, $parentType, $name, $type, $config )->one(); }
php
public static function findByNameType( $parentId, $parentType, $name, $type, $config = [] ) { return self::queryByNameType( $parentId, $parentType, $name, $type, $config )->one(); }
[ "public", "static", "function", "findByNameType", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "name", ",", "$", "type", ",", "$", "config", "=", "[", "]", ")", "{", "return", "self", "::", "queryByNameType", "(", "$", "parentId", ",", "$", ...
Find and return the meta associated with parent for given name and type. @param integer $parentId @param string $parentType @param string $name @param string $type @param array $config @return ModelMeta
[ "Find", "and", "return", "the", "meta", "associated", "with", "parent", "for", "given", "name", "and", "type", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/resources/ModelMeta.php#L263-L266
39,399
cmsgears/module-core
common/models/resources/ModelMeta.php
ModelMeta.isExistByNameType
public static function isExistByNameType( $parentId, $parentType, $name, $type, $config = [] ) { $meta = self::queryByNameType( $parentId, $parentType, $name, $type, $config )->one(); return isset( $meta ); }
php
public static function isExistByNameType( $parentId, $parentType, $name, $type, $config = [] ) { $meta = self::queryByNameType( $parentId, $parentType, $name, $type, $config )->one(); return isset( $meta ); }
[ "public", "static", "function", "isExistByNameType", "(", "$", "parentId", ",", "$", "parentType", ",", "$", "name", ",", "$", "type", ",", "$", "config", "=", "[", "]", ")", "{", "$", "meta", "=", "self", "::", "queryByNameType", "(", "$", "parentId",...
Check whether meta exist for parent using given name and type. @param integer $parentId @param string $parentType @param string $name @param string $type @param array $config @return boolean
[ "Check", "whether", "meta", "exist", "for", "parent", "using", "given", "name", "and", "type", "." ]
ce1b1f7afff2931847d71afa152c72355f374dc6
https://github.com/cmsgears/module-core/blob/ce1b1f7afff2931847d71afa152c72355f374dc6/common/models/resources/ModelMeta.php#L278-L283