repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.setValue
public function setValue($key, $value) { if( !isset($key) ) { // Invalid key throw new Exception("nullKey"); } else if( !in_array($key, static::$fields) ) { // Unknown key throw new FieldNotFoundException($key, static::getClass()); } else if( $key === static::$IDFIELD ) { // ID is not editable throw new Exception("idNotEditable"); } else if( $value !== $this->data[$key] ) { // The value is different $this->addModFields($key); $this->data[$key] = $value; } return $this; }
php
public function setValue($key, $value) { if( !isset($key) ) { // Invalid key throw new Exception("nullKey"); } else if( !in_array($key, static::$fields) ) { // Unknown key throw new FieldNotFoundException($key, static::getClass()); } else if( $key === static::$IDFIELD ) { // ID is not editable throw new Exception("idNotEditable"); } else if( $value !== $this->data[$key] ) { // The value is different $this->addModFields($key); $this->data[$key] = $value; } return $this; }
[ "public", "function", "setValue", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "!", "isset", "(", "$", "key", ")", ")", "{", "// Invalid key", "throw", "new", "Exception", "(", "\"nullKey\"", ")", ";", "}", "else", "if", "(", "!", "in_a...
Set the value of a field @param string $key Name of the field to set @param mixed $value New value of the field @return $this @throws Exception @throws FieldNotFoundException Set the field $key with the new $value.
[ "Set", "the", "value", "of", "a", "field" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L624-L643
train
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.equals
public function equals($o) { return (get_class($this) == get_class($o) && $this->id() == $o->id()); }
php
public function equals($o) { return (get_class($this) == get_class($o) && $this->id() == $o->id()); }
[ "public", "function", "equals", "(", "$", "o", ")", "{", "return", "(", "get_class", "(", "$", "this", ")", "==", "get_class", "(", "$", "o", ")", "&&", "$", "this", "->", "id", "(", ")", "==", "$", "o", "->", "id", "(", ")", ")", ";", "}" ]
Verify equality with another object @param object $o The object to compare. @return boolean True if this object represents the same data, else False. Compare the class and the ID field value of the 2 objects.
[ "Verify", "equality", "with", "another", "object" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L653-L655
train
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.getLogEvent
public static function getLogEvent($event, $time = null, $ipAdd = null) { return array( $event . '_time' => isset($time) ? $time : time(), $event . '_date' => isset($time) ? sqlDatetime($time) : sqlDatetime(), $event . '_ip' => isset($ipAdd) ? $ipAdd : (!empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'), ); }
php
public static function getLogEvent($event, $time = null, $ipAdd = null) { return array( $event . '_time' => isset($time) ? $time : time(), $event . '_date' => isset($time) ? sqlDatetime($time) : sqlDatetime(), $event . '_ip' => isset($ipAdd) ? $ipAdd : (!empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'), ); }
[ "public", "static", "function", "getLogEvent", "(", "$", "event", ",", "$", "time", "=", "null", ",", "$", "ipAdd", "=", "null", ")", "{", "return", "array", "(", "$", "event", ".", "'_time'", "=>", "isset", "(", "$", "time", ")", "?", "$", "time",...
Get the log of an event @param string $event The event to log in this object @param int $time A specified time to use for logging event @param string $ipAdd A specified IP Address to use for logging event @return array @deprecated @see logEvent() Build a new log event for $event for this time and the user IP address.
[ "Get", "the", "log", "of", "an", "event" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L729-L735
train
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.isFieldEditable
public static function isFieldEditable($fieldName) { if( $fieldName == static::$IDFIELD ) { return false; } if( !is_null(static::$editableFields) ) { return in_array($fieldName, static::$editableFields); } if( method_exists(static::$validator, 'isFieldEditable') ) { return in_array($fieldName, static::$editableFields); } return in_array($fieldName, static::$fields); }
php
public static function isFieldEditable($fieldName) { if( $fieldName == static::$IDFIELD ) { return false; } if( !is_null(static::$editableFields) ) { return in_array($fieldName, static::$editableFields); } if( method_exists(static::$validator, 'isFieldEditable') ) { return in_array($fieldName, static::$editableFields); } return in_array($fieldName, static::$fields); }
[ "public", "static", "function", "isFieldEditable", "(", "$", "fieldName", ")", "{", "if", "(", "$", "fieldName", "==", "static", "::", "$", "IDFIELD", ")", "{", "return", "false", ";", "}", "if", "(", "!", "is_null", "(", "static", "::", "$", "editable...
Test if field is editable @param string $fieldName @return boolean
[ "Test", "if", "field", "is", "editable" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L756-L767
train
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.get
public static function get($options = null) { if( $options === null ) { /** @noinspection PhpIncompatibleReturnTypeInspection */ return static::select(); } if( $options instanceof SQLSelectRequest ) { $options->setSQLAdapter(static::getSQLAdapter()); $options->setIDField(static::$IDFIELD); $options->from(static::$table); return $options->run(); } if( is_string($options) ) { $args = func_get_args(); $options = array();// Pointing argument foreach( array('where', 'orderby') as $i => $key ) { if( !isset($args[$i]) ) { break; } $options[$key] = $args[$i]; } } $options['table'] = static::$table; // May be incompatible with old revisions (< R398) if( !isset($options['output']) ) { $options['output'] = SQLAdapter::ARR_OBJECTS; } //This method intercepts outputs of array of objects. $onlyOne = $objects = 0; if( in_array($options['output'], array(SQLAdapter::ARR_OBJECTS, SQLAdapter::OBJECT)) ) { if( $options['output'] == SQLAdapter::OBJECT ) { $options['number'] = 1; $onlyOne = 1; } $options['output'] = SQLAdapter::ARR_ASSOC; $objects = 1; } $sqlAdapter = static::getSQLAdapter(); $r = $sqlAdapter->select($options); if( empty($r) && in_array($options['output'], array(SQLAdapter::ARR_ASSOC, SQLAdapter::ARR_OBJECTS, SQLAdapter::ARR_FIRST)) ) { return $onlyOne && $objects ? null : array(); } if( !empty($r) && $objects ) { if( $onlyOne ) { $r = static::load($r[0]); } else { foreach( $r as &$rdata ) { $rdata = static::load($rdata); } } } return $r; }
php
public static function get($options = null) { if( $options === null ) { /** @noinspection PhpIncompatibleReturnTypeInspection */ return static::select(); } if( $options instanceof SQLSelectRequest ) { $options->setSQLAdapter(static::getSQLAdapter()); $options->setIDField(static::$IDFIELD); $options->from(static::$table); return $options->run(); } if( is_string($options) ) { $args = func_get_args(); $options = array();// Pointing argument foreach( array('where', 'orderby') as $i => $key ) { if( !isset($args[$i]) ) { break; } $options[$key] = $args[$i]; } } $options['table'] = static::$table; // May be incompatible with old revisions (< R398) if( !isset($options['output']) ) { $options['output'] = SQLAdapter::ARR_OBJECTS; } //This method intercepts outputs of array of objects. $onlyOne = $objects = 0; if( in_array($options['output'], array(SQLAdapter::ARR_OBJECTS, SQLAdapter::OBJECT)) ) { if( $options['output'] == SQLAdapter::OBJECT ) { $options['number'] = 1; $onlyOne = 1; } $options['output'] = SQLAdapter::ARR_ASSOC; $objects = 1; } $sqlAdapter = static::getSQLAdapter(); $r = $sqlAdapter->select($options); if( empty($r) && in_array($options['output'], array(SQLAdapter::ARR_ASSOC, SQLAdapter::ARR_OBJECTS, SQLAdapter::ARR_FIRST)) ) { return $onlyOne && $objects ? null : array(); } if( !empty($r) && $objects ) { if( $onlyOne ) { $r = static::load($r[0]); } else { foreach( $r as &$rdata ) { $rdata = static::load($rdata); } } } return $r; }
[ "public", "static", "function", "get", "(", "$", "options", "=", "null", ")", "{", "if", "(", "$", "options", "===", "null", ")", "{", "/** @noinspection PhpIncompatibleReturnTypeInspection */", "return", "static", "::", "select", "(", ")", ";", "}", "if", "...
Get some permanent objects @param array $options The options used to get the permanents object @return SQLSelectRequest|static|static[]|array An array of array containing object's data @see SQLAdapter Get an objects' list using this class' table. Take care that output=SQLAdapter::ARR_OBJECTS and number=1 is different from output=SQLAdapter::OBJECT
[ "Get", "some", "permanent", "objects" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L790-L841
train
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.load
public static function load($in, $nullable = true, $usingCache = true) { if( empty($in) ) { if( $nullable ) { return null; } static::throwNotFound('invalidParameter_load'); } // Try to load an object from this class if( is_object($in) && $in instanceof static ) { return $in; } $IDFIELD = static::$IDFIELD; // If $in is an array, we trust him, as data of the object. if( is_array($in) ) { $id = $in[$IDFIELD]; $data = $in; } else { $id = $in; } if( !is_ID($id) ) { static::throwException('invalidID'); } // Loading cached if( $usingCache && isset(static::$instances[static::getClass()][$id]) ) { return static::$instances[static::getClass()][$id]; } // If we don't get the data, we request them. if( empty($data) ) { // Getting data $obj = static::get(array( 'where' => $IDFIELD . '=' . $id, 'output' => SQLAdapter::OBJECT, )); // Ho no, we don't have the data, we can't load the object ! if( empty($obj) ) { if( $nullable ) { return null; } static::throwNotFound(); } } else { $obj = new static($data); } // Caching object return $usingCache ? $obj->checkCache() : $obj; }
php
public static function load($in, $nullable = true, $usingCache = true) { if( empty($in) ) { if( $nullable ) { return null; } static::throwNotFound('invalidParameter_load'); } // Try to load an object from this class if( is_object($in) && $in instanceof static ) { return $in; } $IDFIELD = static::$IDFIELD; // If $in is an array, we trust him, as data of the object. if( is_array($in) ) { $id = $in[$IDFIELD]; $data = $in; } else { $id = $in; } if( !is_ID($id) ) { static::throwException('invalidID'); } // Loading cached if( $usingCache && isset(static::$instances[static::getClass()][$id]) ) { return static::$instances[static::getClass()][$id]; } // If we don't get the data, we request them. if( empty($data) ) { // Getting data $obj = static::get(array( 'where' => $IDFIELD . '=' . $id, 'output' => SQLAdapter::OBJECT, )); // Ho no, we don't have the data, we can't load the object ! if( empty($obj) ) { if( $nullable ) { return null; } static::throwNotFound(); } } else { $obj = new static($data); } // Caching object return $usingCache ? $obj->checkCache() : $obj; }
[ "public", "static", "function", "load", "(", "$", "in", ",", "$", "nullable", "=", "true", ",", "$", "usingCache", "=", "true", ")", "{", "if", "(", "empty", "(", "$", "in", ")", ")", "{", "if", "(", "$", "nullable", ")", "{", "return", "null", ...
Load a permanent object @param mixed|mixed[] $in The object ID to load or a valid array of the object's data @param boolean $nullable True to silent errors row and return null @param boolean $usingCache True to cache load and set cache, false to not cache @return static The object loaded from database @see static::get() Loads the object with the ID $id or the array data. The return value is always a static object (no null, no array, no other object).
[ "Load", "a", "permanent", "object" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L855-L900
train
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.checkCache
protected function checkCache() { if( isset(static::$instances[static::getClass()][$this->id()]) ) { return static::$instances[static::getClass()][$this->id()]; } static::$instances[static::getClass()][$this->id()] = $this; return $this; }
php
protected function checkCache() { if( isset(static::$instances[static::getClass()][$this->id()]) ) { return static::$instances[static::getClass()][$this->id()]; } static::$instances[static::getClass()][$this->id()] = $this; return $this; }
[ "protected", "function", "checkCache", "(", ")", "{", "if", "(", "isset", "(", "static", "::", "$", "instances", "[", "static", "::", "getClass", "(", ")", "]", "[", "$", "this", "->", "id", "(", ")", "]", ")", ")", "{", "return", "static", "::", ...
Check if this object is cached and cache it @return \Orpheus\Publisher\PermanentObject\PermanentObject
[ "Check", "if", "this", "object", "is", "cached", "and", "cache", "it" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L920-L926
train
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.clearDeletedInstances
public static function clearDeletedInstances() { if( !isset(static::$instances[static::getClass()]) ) { return; } $instances = &static::$instances[static::getClass()]; foreach( $instances as $id => $obj ) { /* @var static $obj */ if( $obj->isDeleted() ) { unset($instances[$id]); } } }
php
public static function clearDeletedInstances() { if( !isset(static::$instances[static::getClass()]) ) { return; } $instances = &static::$instances[static::getClass()]; foreach( $instances as $id => $obj ) { /* @var static $obj */ if( $obj->isDeleted() ) { unset($instances[$id]); } } }
[ "public", "static", "function", "clearDeletedInstances", "(", ")", "{", "if", "(", "!", "isset", "(", "static", "::", "$", "instances", "[", "static", "::", "getClass", "(", ")", "]", ")", ")", "{", "return", ";", "}", "$", "instances", "=", "&", "st...
Remove deleted instances from cache
[ "Remove", "deleted", "instances", "from", "cache" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L940-L951
train
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.escapeIdentifier
public static function escapeIdentifier($identifier = null) { $sqlAdapter = static::getSQLAdapter(); return $sqlAdapter->escapeIdentifier($identifier ? $identifier : static::$table); }
php
public static function escapeIdentifier($identifier = null) { $sqlAdapter = static::getSQLAdapter(); return $sqlAdapter->escapeIdentifier($identifier ? $identifier : static::$table); }
[ "public", "static", "function", "escapeIdentifier", "(", "$", "identifier", "=", "null", ")", "{", "$", "sqlAdapter", "=", "static", "::", "getSQLAdapter", "(", ")", ";", "return", "$", "sqlAdapter", "->", "escapeIdentifier", "(", "$", "identifier", "?", "$"...
Escape identifier through instance @param string $identifier The identifier to escape. Default is table name. @return string The escaped identifier @see SQLAdapter::escapeIdentifier() @see static::ei()
[ "Escape", "identifier", "through", "instance" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L978-L981
train
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.getCreateOperation
public static function getCreateOperation($input, $fields) { $operation = new CreateTransactionOperation(static::getClass(), $input, $fields); $operation->setSQLAdapter(static::getSQLAdapter()); return $operation; }
php
public static function getCreateOperation($input, $fields) { $operation = new CreateTransactionOperation(static::getClass(), $input, $fields); $operation->setSQLAdapter(static::getSQLAdapter()); return $operation; }
[ "public", "static", "function", "getCreateOperation", "(", "$", "input", ",", "$", "fields", ")", "{", "$", "operation", "=", "new", "CreateTransactionOperation", "(", "static", "::", "getClass", "(", ")", ",", "$", "input", ",", "$", "fields", ")", ";", ...
Get the create operation @param array $input The input data we will check and extract, used by children @param string[] $fields The array of fields to check @return CreateTransactionOperation
[ "Get", "the", "create", "operation" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L1082-L1086
train
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.onValidCreate
public static function onValidCreate(&$input, $newErrors) { if( $newErrors ) { static::throwException('errorCreateChecking'); } static::fillLogEvent($input, 'create'); static::fillLogEvent($input, 'edit'); // $input = static::getLogEvent('create') + static::getLogEvent('edit') + $input; return true; }
php
public static function onValidCreate(&$input, $newErrors) { if( $newErrors ) { static::throwException('errorCreateChecking'); } static::fillLogEvent($input, 'create'); static::fillLogEvent($input, 'edit'); // $input = static::getLogEvent('create') + static::getLogEvent('edit') + $input; return true; }
[ "public", "static", "function", "onValidCreate", "(", "&", "$", "input", ",", "$", "newErrors", ")", "{", "if", "(", "$", "newErrors", ")", "{", "static", "::", "throwException", "(", "'errorCreateChecking'", ")", ";", "}", "static", "::", "fillLogEvent", ...
Callback when validating create @param array $input @param int $newErrors @return boolean
[ "Callback", "when", "validating", "create" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L1095-L1103
train
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.extractCreateQuery
public static function extractCreateQuery(&$input) { // To do on Edit static::onEdit($input, null); foreach( $input as $fieldname => $fieldvalue ) { if( !in_array($fieldname, static::$fields) ) { unset($input[$fieldname]); } } $options = array( 'table' => static::$table, 'what' => $input, ); return $options; }
php
public static function extractCreateQuery(&$input) { // To do on Edit static::onEdit($input, null); foreach( $input as $fieldname => $fieldvalue ) { if( !in_array($fieldname, static::$fields) ) { unset($input[$fieldname]); } } $options = array( 'table' => static::$table, 'what' => $input, ); return $options; }
[ "public", "static", "function", "extractCreateQuery", "(", "&", "$", "input", ")", "{", "// To do on Edit", "static", "::", "onEdit", "(", "$", "input", ",", "null", ")", ";", "foreach", "(", "$", "input", "as", "$", "fieldname", "=>", "$", "fieldvalue", ...
Extract a create query from this class @param array $input @return array
[ "Extract", "a", "create", "query", "from", "this", "class" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L1111-L1126
train
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.completeFields
public static function completeFields($data) { foreach( static::$fields as $fieldname ) { if( !isset($data[$fieldname]) ) { $data[$fieldname] = ''; } } return $data; }
php
public static function completeFields($data) { foreach( static::$fields as $fieldname ) { if( !isset($data[$fieldname]) ) { $data[$fieldname] = ''; } } return $data; }
[ "public", "static", "function", "completeFields", "(", "$", "data", ")", "{", "foreach", "(", "static", "::", "$", "fields", "as", "$", "fieldname", ")", "{", "if", "(", "!", "isset", "(", "$", "data", "[", "$", "fieldname", "]", ")", ")", "{", "$"...
Complete missing fields @param array $data The data array to complete. @return array The completed data array. Complete an array of data of an object of this class by setting missing fields with empty string.
[ "Complete", "missing", "fields" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L1153-L1160
train
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.checkUserInput
public static function checkUserInput($input, $fields = null, $ref = null, &$errCount = 0) { if( !isset($errCount) ) { $errCount = 0; } // Allow reversed parameters 2 & 3 - Declared as useless // if( !is_array($fields) && !is_object($ref) ) { // $tmp = $fields; $fields = $ref; $ref = $tmp; unset($tmp); // } // if( is_null($ref) && is_object($ref) ) { // $ref = $fields; // $fields = null; // } if( is_array(static::$validator) ) { if( $fields === null ) { $fields = static::$editableFields; } if( empty($fields) ) { return array(); } $data = array(); foreach( $fields as $field ) { // If editing the id field if( $field == static::$IDFIELD ) { continue; } $value = $notset = null; try { try { // Field to validate if( !empty(static::$validator[$field]) ) { $checkMeth = static::$validator[$field]; // If not defined, we just get the value without check $value = static::$checkMeth($input, $ref); // Field to NOT validate } else if( array_key_exists($field, $input) ) { $value = $input[$field]; } else { $notset = 1; } if( !isset($notset) && ($ref === null || $value != $ref->$field) && ($fields === null || in_array($field, $fields)) ) { $data[$field] = $value; } } catch( UserException $e ) { if( $value === null && isset($input[$field]) ) { $value = $input[$field]; } throw InvalidFieldException::from($e, $field, $value); } } catch( InvalidFieldException $e ) { $errCount++; reportError($e, static::getDomain()); } } return $data; } else if( is_object(static::$validator) ) { if( method_exists(static::$validator, 'validate') ) { return static::$validator->validate($input, $fields, $ref, $errCount); } } return array(); }
php
public static function checkUserInput($input, $fields = null, $ref = null, &$errCount = 0) { if( !isset($errCount) ) { $errCount = 0; } // Allow reversed parameters 2 & 3 - Declared as useless // if( !is_array($fields) && !is_object($ref) ) { // $tmp = $fields; $fields = $ref; $ref = $tmp; unset($tmp); // } // if( is_null($ref) && is_object($ref) ) { // $ref = $fields; // $fields = null; // } if( is_array(static::$validator) ) { if( $fields === null ) { $fields = static::$editableFields; } if( empty($fields) ) { return array(); } $data = array(); foreach( $fields as $field ) { // If editing the id field if( $field == static::$IDFIELD ) { continue; } $value = $notset = null; try { try { // Field to validate if( !empty(static::$validator[$field]) ) { $checkMeth = static::$validator[$field]; // If not defined, we just get the value without check $value = static::$checkMeth($input, $ref); // Field to NOT validate } else if( array_key_exists($field, $input) ) { $value = $input[$field]; } else { $notset = 1; } if( !isset($notset) && ($ref === null || $value != $ref->$field) && ($fields === null || in_array($field, $fields)) ) { $data[$field] = $value; } } catch( UserException $e ) { if( $value === null && isset($input[$field]) ) { $value = $input[$field]; } throw InvalidFieldException::from($e, $field, $value); } } catch( InvalidFieldException $e ) { $errCount++; reportError($e, static::getDomain()); } } return $data; } else if( is_object(static::$validator) ) { if( method_exists(static::$validator, 'validate') ) { return static::$validator->validate($input, $fields, $ref, $errCount); } } return array(); }
[ "public", "static", "function", "checkUserInput", "(", "$", "input", ",", "$", "fields", "=", "null", ",", "$", "ref", "=", "null", ",", "&", "$", "errCount", "=", "0", ")", "{", "if", "(", "!", "isset", "(", "$", "errCount", ")", ")", "{", "$", ...
Check user input @param array $input The user input data to check. @param string[] $fields The array of fields to check. Default value is null. @param PermanentObject $ref The referenced object (update only). Default value is null. @param int $errCount The resulting error count, as pointer. Output parameter. @return array The valid data. Check if the class could generate a valid object from $input. The method could modify the user input to fix them but it must return the data. The data are passed through the validator, for different cases: - If empty, this function return an empty array. - If an array, it uses an field => checkMethod association.
[ "Check", "user", "input" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L1262-L1329
train
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.getClassData
public static function getClassData(&$classData = null) { $class = static::getClass(); if( !isset(static::$knownClassData[$class]) ) { static::$knownClassData[$class] = (object)array( 'sqlAdapter' => null, ); } $classData = static::$knownClassData[$class]; return $classData; }
php
public static function getClassData(&$classData = null) { $class = static::getClass(); if( !isset(static::$knownClassData[$class]) ) { static::$knownClassData[$class] = (object)array( 'sqlAdapter' => null, ); } $classData = static::$knownClassData[$class]; return $classData; }
[ "public", "static", "function", "getClassData", "(", "&", "$", "classData", "=", "null", ")", "{", "$", "class", "=", "static", "::", "getClass", "(", ")", ";", "if", "(", "!", "isset", "(", "static", "::", "$", "knownClassData", "[", "$", "class", "...
Get all gathered data about this class @param array $classData @return array
[ "Get", "all", "gathered", "data", "about", "this", "class" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L1386-L1395
train
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.getSQLAdapter
public static function getSQLAdapter() { $classData = null; static::getClassData($classData); if( !isset($classData->sqlAdapter) || !$classData->sqlAdapter ) { $classData->sqlAdapter = SQLAdapter::getInstance(static::$DBInstance); } // This after $knownClassData classData return $classData->sqlAdapter; }
php
public static function getSQLAdapter() { $classData = null; static::getClassData($classData); if( !isset($classData->sqlAdapter) || !$classData->sqlAdapter ) { $classData->sqlAdapter = SQLAdapter::getInstance(static::$DBInstance); } // This after $knownClassData classData return $classData->sqlAdapter; }
[ "public", "static", "function", "getSQLAdapter", "(", ")", "{", "$", "classData", "=", "null", ";", "static", "::", "getClassData", "(", "$", "classData", ")", ";", "if", "(", "!", "isset", "(", "$", "classData", "->", "sqlAdapter", ")", "||", "!", "$"...
Get the SQL Adapter of this class @return SQLAdapter
[ "Get", "the", "SQL", "Adapter", "of", "this", "class" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L1402-L1410
train
asika32764/joomla-framework-console
Option/OptionSet.php
OptionSet.offsetGet
public function offsetGet($name) { $name = $this->resolveAlias($name); if (!$this->offsetExists($name)) { return null; } return parent::offsetGet($name); }
php
public function offsetGet($name) { $name = $this->resolveAlias($name); if (!$this->offsetExists($name)) { return null; } return parent::offsetGet($name); }
[ "public", "function", "offsetGet", "(", "$", "name", ")", "{", "$", "name", "=", "$", "this", "->", "resolveAlias", "(", "$", "name", ")", ";", "if", "(", "!", "$", "this", "->", "offsetExists", "(", "$", "name", ")", ")", "{", "return", "null", ...
Get an option by name. @param mixed $name Option name to get option. @return Option|null Return option object if exists. @since 1.0
[ "Get", "an", "option", "by", "name", "." ]
fe28cf9e1c694049e015121e2bd041268e814249
https://github.com/asika32764/joomla-framework-console/blob/fe28cf9e1c694049e015121e2bd041268e814249/Option/OptionSet.php#L68-L78
train
asika32764/joomla-framework-console
Option/OptionSet.php
OptionSet.setAlias
public function setAlias($aliases, $option) { $aliases = (array) $aliases; foreach ($aliases as $alias) { $this->aliases[$alias] = $option; } return $this; }
php
public function setAlias($aliases, $option) { $aliases = (array) $aliases; foreach ($aliases as $alias) { $this->aliases[$alias] = $option; } return $this; }
[ "public", "function", "setAlias", "(", "$", "aliases", ",", "$", "option", ")", "{", "$", "aliases", "=", "(", "array", ")", "$", "aliases", ";", "foreach", "(", "$", "aliases", "as", "$", "alias", ")", "{", "$", "this", "->", "aliases", "[", "$", ...
Set Alias of an option. @param array|string $aliases An alias of a option, can be array. @param string $option The option which we want to add alias. @return OptionSet Return self to support chaining. @since 1.0
[ "Set", "Alias", "of", "an", "option", "." ]
fe28cf9e1c694049e015121e2bd041268e814249
https://github.com/asika32764/joomla-framework-console/blob/fe28cf9e1c694049e015121e2bd041268e814249/Option/OptionSet.php#L132-L142
train
asika32764/joomla-framework-console
Option/OptionSet.php
OptionSet.resolveAlias
protected function resolveAlias($alias) { if (!empty($this->aliases[$alias])) { return $this->aliases[$alias]; } return $alias; }
php
protected function resolveAlias($alias) { if (!empty($this->aliases[$alias])) { return $this->aliases[$alias]; } return $alias; }
[ "protected", "function", "resolveAlias", "(", "$", "alias", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "aliases", "[", "$", "alias", "]", ")", ")", "{", "return", "$", "this", "->", "aliases", "[", "$", "alias", "]", ";", "}", "re...
Resolve alias for an option. @param string $alias An alias to help us get option name. @return string Return name if found, or return alias as name. @since 1.0
[ "Resolve", "alias", "for", "an", "option", "." ]
fe28cf9e1c694049e015121e2bd041268e814249
https://github.com/asika32764/joomla-framework-console/blob/fe28cf9e1c694049e015121e2bd041268e814249/Option/OptionSet.php#L153-L161
train
hiqdev/hidev-readme
src/components/Readme.php
Readme.renderSections
public function renderSections($sections = null) { if ($sections === null) { $sections = $this->getSections(); } $res = ''; foreach ($sections as $section) { $res .= $this->renderSection($section); } return $res; }
php
public function renderSections($sections = null) { if ($sections === null) { $sections = $this->getSections(); } $res = ''; foreach ($sections as $section) { $res .= $this->renderSection($section); } return $res; }
[ "public", "function", "renderSections", "(", "$", "sections", "=", "null", ")", "{", "if", "(", "$", "sections", "===", "null", ")", "{", "$", "sections", "=", "$", "this", "->", "getSections", "(", ")", ";", "}", "$", "res", "=", "''", ";", "forea...
Render all configured sections. @return string
[ "Render", "all", "configured", "sections", "." ]
87e3fe8a464d1b25a94eed072b50c877174f6083
https://github.com/hiqdev/hidev-readme/blob/87e3fe8a464d1b25a94eed072b50c877174f6083/src/components/Readme.php#L138-L149
train
hiqdev/hidev-readme
src/components/Readme.php
Readme.renderBadges
public function renderBadges() { $badges = $this->badges; if (!$badges) { return ''; } $pm = $this->take('package')->getPackageManager(); $res = ''; foreach ($badges as $badge => $tpl) { if (!$tpl) { $tpl = $this->knownBadges[$badge]; } if ($tpl === 'disabled') { continue; } $res .= $this->renderBadge($tpl) . "\n"; } return $res ? "\n$res" : ''; }
php
public function renderBadges() { $badges = $this->badges; if (!$badges) { return ''; } $pm = $this->take('package')->getPackageManager(); $res = ''; foreach ($badges as $badge => $tpl) { if (!$tpl) { $tpl = $this->knownBadges[$badge]; } if ($tpl === 'disabled') { continue; } $res .= $this->renderBadge($tpl) . "\n"; } return $res ? "\n$res" : ''; }
[ "public", "function", "renderBadges", "(", ")", "{", "$", "badges", "=", "$", "this", "->", "badges", ";", "if", "(", "!", "$", "badges", ")", "{", "return", "''", ";", "}", "$", "pm", "=", "$", "this", "->", "take", "(", "'package'", ")", "->", ...
Render all configured badges. @return string
[ "Render", "all", "configured", "badges", "." ]
87e3fe8a464d1b25a94eed072b50c877174f6083
https://github.com/hiqdev/hidev-readme/blob/87e3fe8a464d1b25a94eed072b50c877174f6083/src/components/Readme.php#L155-L174
train
hiqdev/hidev-readme
src/components/Readme.php
Readme.renderBadge
public function renderBadge($template) { $tpl = $this->getTwig()->createTemplate($template); return $tpl->render(['app' => Yii::$app]); }
php
public function renderBadge($template) { $tpl = $this->getTwig()->createTemplate($template); return $tpl->render(['app' => Yii::$app]); }
[ "public", "function", "renderBadge", "(", "$", "template", ")", "{", "$", "tpl", "=", "$", "this", "->", "getTwig", "(", ")", "->", "createTemplate", "(", "$", "template", ")", ";", "return", "$", "tpl", "->", "render", "(", "[", "'app'", "=>", "Yii"...
Render badge by given template. @param string $template string to render @return string
[ "Render", "badge", "by", "given", "template", "." ]
87e3fe8a464d1b25a94eed072b50c877174f6083
https://github.com/hiqdev/hidev-readme/blob/87e3fe8a464d1b25a94eed072b50c877174f6083/src/components/Readme.php#L181-L186
train
hiqdev/hidev-readme
src/components/Readme.php
Readme.getTwig
public function getTwig() { if ($this->_twig === null) { $this->_twig = new \Twig_Environment(new \Twig_Loader_Array()); } return $this->_twig; }
php
public function getTwig() { if ($this->_twig === null) { $this->_twig = new \Twig_Environment(new \Twig_Loader_Array()); } return $this->_twig; }
[ "public", "function", "getTwig", "(", ")", "{", "if", "(", "$", "this", "->", "_twig", "===", "null", ")", "{", "$", "this", "->", "_twig", "=", "new", "\\", "Twig_Environment", "(", "new", "\\", "Twig_Loader_Array", "(", ")", ")", ";", "}", "return"...
Twig getter. @return \Twig_Environment
[ "Twig", "getter", "." ]
87e3fe8a464d1b25a94eed072b50c877174f6083
https://github.com/hiqdev/hidev-readme/blob/87e3fe8a464d1b25a94eed072b50c877174f6083/src/components/Readme.php#L192-L199
train
registripe/registripe-core
code/emails/EventRegistrationDetailsEmail.php
EventRegistrationDetailsEmail.factory
public static function factory(EventRegistration $registration) { $email = new self(); $siteconfig = SiteConfig::current_site_config(); $email->setTo($registration->Email); $email->setSubject(sprintf( 'Registration Details For %s (%s)', $registration->Event()->Title, $siteconfig->Title)); $email->populateTemplate(array( 'Registration' => $registration, 'SiteConfig' => $siteconfig )); singleton(get_class())->extend('updateEmail', $email, $registration); return $email; }
php
public static function factory(EventRegistration $registration) { $email = new self(); $siteconfig = SiteConfig::current_site_config(); $email->setTo($registration->Email); $email->setSubject(sprintf( 'Registration Details For %s (%s)', $registration->Event()->Title, $siteconfig->Title)); $email->populateTemplate(array( 'Registration' => $registration, 'SiteConfig' => $siteconfig )); singleton(get_class())->extend('updateEmail', $email, $registration); return $email; }
[ "public", "static", "function", "factory", "(", "EventRegistration", "$", "registration", ")", "{", "$", "email", "=", "new", "self", "(", ")", ";", "$", "siteconfig", "=", "SiteConfig", "::", "current_site_config", "(", ")", ";", "$", "email", "->", "setT...
Creates an email instance from a registration object. @param EventRegistration $registration @return EventRegistrationDetailsEmail
[ "Creates", "an", "email", "instance", "from", "a", "registration", "object", "." ]
e52b3340aef323067ebfa9bd5fa07cb81bb63db9
https://github.com/registripe/registripe-core/blob/e52b3340aef323067ebfa9bd5fa07cb81bb63db9/code/emails/EventRegistrationDetailsEmail.php#L17-L34
train
asbsoft/yii2module-modmgr_1_161205
models/Modmgr.php
Modmgr.loadData
public function loadData($installModel) { $this->is_active = false; $this->create_at = new Expression('NOW()'); // server time $this->module_id = $installModel->moduleId; $this->parent_uid = $installModel->parentUid; $fileBody = file_get_contents($installModel->moduleClassFile->tempName); //$regexp = "/namespace[ \t]+([A-Za-z0-9\\_]+);/"; //?? $regexp = "/namespace[ \t]+([^;]+);/"; $n = preg_match($regexp, $fileBody, $found); if ($n < 1) { $this->addError('module_class', $error = Yii::t($this->tc, "Can't find namespace in module class file")); return; } else { $this->module_class = $found[1] . "\\" . basename($installModel->moduleClassFile->name, '.php'); $cmd = "return {$this->module_class}::className();"; if(function_exists('runkit_lint') && !runkit_lint($cmd)) { $this->addError('module_class', $error = Yii::t($this->tc, 'Module class file has errors')); return; } //*?? try { $className = @eval($cmd); if ($className != $this->module_class) { $this->addError('module_class', $error = Yii::t($this->tc, 'Bad module class file')); return; } } catch (Exception $e) { // not catch syntax error $this->addError('module_class', $error = Yii::t($this->tc, $e->getMessage())); return; } /**/ $configDefault = $this->buildDefaultConfig($this->module_class); $this->config_default = var_export($configDefault, true); $this->name = empty($configDefault['params']['label']) ? ('Module ' . dirname($this->module_class)) : $configDefault['params']['label']; $config = []; if (isset($configDefault['params'])) { $config['params'] = $configDefault['params']; } if (isset($configDefault['routesConfig'])) { $config['routesConfig'] = $configDefault['routesConfig']; } else { //$config['routesConfig'] = []; //!! error if not-UniModule } $this->config_text = var_export($config, true); } }
php
public function loadData($installModel) { $this->is_active = false; $this->create_at = new Expression('NOW()'); // server time $this->module_id = $installModel->moduleId; $this->parent_uid = $installModel->parentUid; $fileBody = file_get_contents($installModel->moduleClassFile->tempName); //$regexp = "/namespace[ \t]+([A-Za-z0-9\\_]+);/"; //?? $regexp = "/namespace[ \t]+([^;]+);/"; $n = preg_match($regexp, $fileBody, $found); if ($n < 1) { $this->addError('module_class', $error = Yii::t($this->tc, "Can't find namespace in module class file")); return; } else { $this->module_class = $found[1] . "\\" . basename($installModel->moduleClassFile->name, '.php'); $cmd = "return {$this->module_class}::className();"; if(function_exists('runkit_lint') && !runkit_lint($cmd)) { $this->addError('module_class', $error = Yii::t($this->tc, 'Module class file has errors')); return; } //*?? try { $className = @eval($cmd); if ($className != $this->module_class) { $this->addError('module_class', $error = Yii::t($this->tc, 'Bad module class file')); return; } } catch (Exception $e) { // not catch syntax error $this->addError('module_class', $error = Yii::t($this->tc, $e->getMessage())); return; } /**/ $configDefault = $this->buildDefaultConfig($this->module_class); $this->config_default = var_export($configDefault, true); $this->name = empty($configDefault['params']['label']) ? ('Module ' . dirname($this->module_class)) : $configDefault['params']['label']; $config = []; if (isset($configDefault['params'])) { $config['params'] = $configDefault['params']; } if (isset($configDefault['routesConfig'])) { $config['routesConfig'] = $configDefault['routesConfig']; } else { //$config['routesConfig'] = []; //!! error if not-UniModule } $this->config_text = var_export($config, true); } }
[ "public", "function", "loadData", "(", "$", "installModel", ")", "{", "$", "this", "->", "is_active", "=", "false", ";", "$", "this", "->", "create_at", "=", "new", "Expression", "(", "'NOW()'", ")", ";", "// server time", "$", "this", "->", "module_id", ...
Load data from install model
[ "Load", "data", "from", "install", "model" ]
febe4c5a66430ea762ee425947c42c957812bff1
https://github.com/asbsoft/yii2module-modmgr_1_161205/blob/febe4c5a66430ea762ee425947c42c957812bff1/models/Modmgr.php#L213-L267
train
asbsoft/yii2module-modmgr_1_161205
models/Modmgr.php
Modmgr.isActive
protected static function isActive($dbId) { if (!isset(static::$_modulesData[$dbId])) { $result = static::findOne($dbId); static::$_modulesData[$dbId] = $result; } if (empty(static::$_modulesData[$dbId])) { return false; } else { $isActive = static::$_modulesData[$dbId]->is_active; return $isActive; } }
php
protected static function isActive($dbId) { if (!isset(static::$_modulesData[$dbId])) { $result = static::findOne($dbId); static::$_modulesData[$dbId] = $result; } if (empty(static::$_modulesData[$dbId])) { return false; } else { $isActive = static::$_modulesData[$dbId]->is_active; return $isActive; } }
[ "protected", "static", "function", "isActive", "(", "$", "dbId", ")", "{", "if", "(", "!", "isset", "(", "static", "::", "$", "_modulesData", "[", "$", "dbId", "]", ")", ")", "{", "$", "result", "=", "static", "::", "findOne", "(", "$", "dbId", ")"...
Check if active dynamicly attached module
[ "Check", "if", "active", "dynamicly", "attached", "module" ]
febe4c5a66430ea762ee425947c42c957812bff1
https://github.com/asbsoft/yii2module-modmgr_1_161205/blob/febe4c5a66430ea762ee425947c42c957812bff1/models/Modmgr.php#L286-L298
train
asbsoft/yii2module-modmgr_1_161205
models/Modmgr.php
Modmgr.hasUnactiveContainer
public function hasUnactiveContainer() { $parent = $this->parent_uid; if (preg_match_all('|\{(\d+)\}|', $parent, $matches)) { if (!empty($matches[1])) { foreach($matches[1] as $nextDbId) { if (!static::isActive($nextDbId)) return true; } } } return false; }
php
public function hasUnactiveContainer() { $parent = $this->parent_uid; if (preg_match_all('|\{(\d+)\}|', $parent, $matches)) { if (!empty($matches[1])) { foreach($matches[1] as $nextDbId) { if (!static::isActive($nextDbId)) return true; } } } return false; }
[ "public", "function", "hasUnactiveContainer", "(", ")", "{", "$", "parent", "=", "$", "this", "->", "parent_uid", ";", "if", "(", "preg_match_all", "(", "'|\\{(\\d+)\\}|'", ",", "$", "parent", ",", "$", "matches", ")", ")", "{", "if", "(", "!", "empty", ...
Check if this module has unactive container
[ "Check", "if", "this", "module", "has", "unactive", "container" ]
febe4c5a66430ea762ee425947c42c957812bff1
https://github.com/asbsoft/yii2module-modmgr_1_161205/blob/febe4c5a66430ea762ee425947c42c957812bff1/models/Modmgr.php#L300-L311
train
asbsoft/yii2module-modmgr_1_161205
models/Modmgr.php
Modmgr.correctParents
public function correctParents($oldSubmodulesParentUid, $newSubmodulesParentUid) { if ($oldSubmodulesParentUid === $newSubmodulesParentUid) return; $query = static::find()->where(['like', 'parent_uid', "{$oldSubmodulesParentUid}%", false]); $list = $query->all(); foreach ($list as $item) { if (0 === strpos($item->parent_uid, $oldSubmodulesParentUid)) { $item->parent_uid = $newSubmodulesParentUid . mb_substr($item->parent_uid, mb_strlen($oldSubmodulesParentUid)); $item->save(); } } }
php
public function correctParents($oldSubmodulesParentUid, $newSubmodulesParentUid) { if ($oldSubmodulesParentUid === $newSubmodulesParentUid) return; $query = static::find()->where(['like', 'parent_uid', "{$oldSubmodulesParentUid}%", false]); $list = $query->all(); foreach ($list as $item) { if (0 === strpos($item->parent_uid, $oldSubmodulesParentUid)) { $item->parent_uid = $newSubmodulesParentUid . mb_substr($item->parent_uid, mb_strlen($oldSubmodulesParentUid)); $item->save(); } } }
[ "public", "function", "correctParents", "(", "$", "oldSubmodulesParentUid", ",", "$", "newSubmodulesParentUid", ")", "{", "if", "(", "$", "oldSubmodulesParentUid", "===", "$", "newSubmodulesParentUid", ")", "return", ";", "$", "query", "=", "static", "::", "find",...
Correct parent_uid chain if module-container change it's own name or container
[ "Correct", "parent_uid", "chain", "if", "module", "-", "container", "change", "it", "s", "own", "name", "or", "container" ]
febe4c5a66430ea762ee425947c42c957812bff1
https://github.com/asbsoft/yii2module-modmgr_1_161205/blob/febe4c5a66430ea762ee425947c42c957812bff1/models/Modmgr.php#L314-L327
train
Apatis/Http-Message
src/Stream.php
Stream.processStreamCallback
private function processStreamCallback(string $task, ...$params) { if (! isset($this->stream)) { throw new \RuntimeException('Stream is detached'); } $task = strtolower($task); $fn = 'f'; if ($this->streamType === 'ZLIB') { if ($task === 'stat') { return false; } $fn = 'gz'; } // default using f$task -> eg fopen() on gzip using gzopen $fn .= $task; if (! function_exists($fn)) { return false; } switch ($task) { case 'seek': case 'write': if ($task === 'seek' && ! $this->seekable) { throw new \RuntimeException('Stream is not seekable'); } elseif ($task === 'write' && ! $this->writable) { throw new \RuntimeException('Cannot write to a non-writable stream'); } if (isset($params[1])) { return $fn($this->stream, $params[0], $params[1]); } return $fn($this->stream, $params[0]); case 'read': return $fn($this->stream, $params[0]); default: return $fn($this->stream, ...$params); } }
php
private function processStreamCallback(string $task, ...$params) { if (! isset($this->stream)) { throw new \RuntimeException('Stream is detached'); } $task = strtolower($task); $fn = 'f'; if ($this->streamType === 'ZLIB') { if ($task === 'stat') { return false; } $fn = 'gz'; } // default using f$task -> eg fopen() on gzip using gzopen $fn .= $task; if (! function_exists($fn)) { return false; } switch ($task) { case 'seek': case 'write': if ($task === 'seek' && ! $this->seekable) { throw new \RuntimeException('Stream is not seekable'); } elseif ($task === 'write' && ! $this->writable) { throw new \RuntimeException('Cannot write to a non-writable stream'); } if (isset($params[1])) { return $fn($this->stream, $params[0], $params[1]); } return $fn($this->stream, $params[0]); case 'read': return $fn($this->stream, $params[0]); default: return $fn($this->stream, ...$params); } }
[ "private", "function", "processStreamCallback", "(", "string", "$", "task", ",", "...", "$", "params", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "stream", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Stream is detached'"...
Helper callback processor @param string $task @param array ...$params @return array|bool|int|string @access private
[ "Helper", "callback", "processor" ]
9ede3f8bcdd2400b238e0624a4af8f09c60da222
https://github.com/Apatis/Http-Message/blob/9ede3f8bcdd2400b238e0624a4af8f09c60da222/src/Stream.php#L168-L205
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.checkBoxRow
public function checkBoxRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CHECKBOX, $model, $attribute, null, $htmlOptions); }
php
public function checkBoxRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CHECKBOX, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "checkBoxRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_CHECKBOX", ",", "$", "model", ",", "$", "att...
Renders a checkbox input row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "checkbox", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L71-L74
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.toggleButtonRow
public function toggleButtonRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TOGGLEBUTTON, $model, $attribute, null, $htmlOptions); }
php
public function toggleButtonRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TOGGLEBUTTON, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "toggleButtonRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_TOGGLEBUTTON", ",", "$", "model", ",", "$"...
Renders a toggle input row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes (options key sets the options for the toggle component) @return string the generated row
[ "Renders", "a", "toggle", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L83-L86
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.checkBoxListRow
public function checkBoxListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CHECKBOXLIST, $model, $attribute, $data, $htmlOptions); }
php
public function checkBoxListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CHECKBOXLIST, $model, $attribute, $data, $htmlOptions); }
[ "public", "function", "checkBoxListRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "data", "=", "array", "(", ")", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "T...
Renders a checkbox list input row. @param CModel $model the data model @param string $attribute the attribute @param array $data the list data @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "checkbox", "list", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L96-L99
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.checkBoxListInlineRow
public function checkBoxListInlineRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CHECKBOXLIST_INLINE, $model, $attribute, $data, $htmlOptions); }
php
public function checkBoxListInlineRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CHECKBOXLIST_INLINE, $model, $attribute, $data, $htmlOptions); }
[ "public", "function", "checkBoxListInlineRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "data", "=", "array", "(", ")", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::"...
Renders a checkbox list inline input row. @param CModel $model the data model @param string $attribute the attribute @param array $data the list data @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "checkbox", "list", "inline", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L109-L112
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.dropDownListRow
public function dropDownListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_DROPDOWN, $model, $attribute, $data, $htmlOptions); }
php
public function dropDownListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_DROPDOWN, $model, $attribute, $data, $htmlOptions); }
[ "public", "function", "dropDownListRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "data", "=", "array", "(", ")", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "T...
Renders a drop-down list input row. @param CModel $model the data model @param string $attribute the attribute @param array $data the list data @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "drop", "-", "down", "list", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L122-L125
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.fileFieldRow
public function fileFieldRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_FILE, $model, $attribute, null, $htmlOptions); }
php
public function fileFieldRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_FILE, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "fileFieldRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_FILE", ",", "$", "model", ",", "$", "attrib...
Renders a file field input row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "file", "field", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L134-L137
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.passwordFieldRow
public function passwordFieldRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_PASSWORD, $model, $attribute, null, $htmlOptions); }
php
public function passwordFieldRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_PASSWORD, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "passwordFieldRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_PASSWORD", ",", "$", "model", ",", "$", ...
Renders a password field input row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "password", "field", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L146-L149
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.radioButtonRow
public function radioButtonRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIO, $model, $attribute, null, $htmlOptions); }
php
public function radioButtonRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIO, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "radioButtonRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_RADIO", ",", "$", "model", ",", "$", "att...
Renders a radio button input row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "radio", "button", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L158-L161
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.radioButtonListRow
public function radioButtonListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIOLIST, $model, $attribute, $data, $htmlOptions); }
php
public function radioButtonListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIOLIST, $model, $attribute, $data, $htmlOptions); }
[ "public", "function", "radioButtonListRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "data", "=", "array", "(", ")", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", ...
Renders a radio button list input row. @param CModel $model the data model @param string $attribute the attribute @param array $data the list data @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "radio", "button", "list", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L171-L174
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.radioButtonListInlineRow
public function radioButtonListInlineRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIOLIST_INLINE, $model, $attribute, $data, $htmlOptions); }
php
public function radioButtonListInlineRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIOLIST_INLINE, $model, $attribute, $data, $htmlOptions); }
[ "public", "function", "radioButtonListInlineRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "data", "=", "array", "(", ")", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "...
Renders a radio button list inline input row. @param CModel $model the data model @param string $attribute the attribute @param array $data the list data @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "radio", "button", "list", "inline", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L184-L187
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.radioButtonGroupsListRow
public function radioButtonGroupsListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIOBUTTONGROUPSLIST, $model, $attribute, $data, $htmlOptions); }
php
public function radioButtonGroupsListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIOBUTTONGROUPSLIST, $model, $attribute, $data, $htmlOptions); }
[ "public", "function", "radioButtonGroupsListRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "data", "=", "array", "(", ")", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "...
Renders a radio button list input row using Button Groups. @param CModel $model the data model @param string $attribute the attribute @param array $data the list data @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "radio", "button", "list", "input", "row", "using", "Button", "Groups", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L197-L200
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.textFieldRow
public function textFieldRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TEXT, $model, $attribute, null, $htmlOptions); }
php
public function textFieldRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TEXT, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "textFieldRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_TEXT", ",", "$", "model", ",", "$", "attrib...
Renders a text field input row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "text", "field", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L209-L212
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.textAreaRow
public function textAreaRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TEXTAREA, $model, $attribute, null, $htmlOptions); }
php
public function textAreaRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TEXTAREA, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "textAreaRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_TEXTAREA", ",", "$", "model", ",", "$", "att...
Renders a text area input row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "text", "area", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L221-L224
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.redactorRow
public function redactorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_REDACTOR, $model, $attribute, null, $htmlOptions); }
php
public function redactorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_REDACTOR, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "redactorRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_REDACTOR", ",", "$", "model", ",", "$", "att...
Renders a WYSIWYG redactor editor @param $model @param $attribute @param array $htmlOptions @return string
[ "Renders", "a", "WYSIWYG", "redactor", "editor" ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L233-L236
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.markdownEditorRow
public function markdownEditorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_MARKDOWNEDITOR, $model, $attribute, null, $htmlOptions); }
php
public function markdownEditorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_MARKDOWNEDITOR, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "markdownEditorRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_MARKDOWNEDITOR", ",", "$", "model", ",", ...
Renders a WYSIWYG Markdown editor @param $model @param $attribute @param array $htmlOptions @return string
[ "Renders", "a", "WYSIWYG", "Markdown", "editor" ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L245-L248
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.html5EditorRow
public function html5EditorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_HTML5EDITOR, $model, $attribute, null, $htmlOptions); }
php
public function html5EditorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_HTML5EDITOR, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "html5EditorRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_HTML5EDITOR", ",", "$", "model", ",", "$", ...
Renders a WYSIWYG bootstrap editor @param $model @param $attribute @param array $htmlOptions @return string
[ "Renders", "a", "WYSIWYG", "bootstrap", "editor" ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L257-L260
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.ckEditorRow
public function ckEditorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CKEDITOR, $model, $attribute, null, $htmlOptions); }
php
public function ckEditorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CKEDITOR, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "ckEditorRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_CKEDITOR", ",", "$", "model", ",", "$", "att...
Renders a WYSIWYG ckeditor @param $model @param $attribute @param array $htmlOptions @return string
[ "Renders", "a", "WYSIWYG", "ckeditor" ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L269-L272
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.captchaRow
public function captchaRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CAPTCHA, $model, $attribute, null, $htmlOptions); }
php
public function captchaRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CAPTCHA, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "captchaRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_CAPTCHA", ",", "$", "model", ",", "$", "attri...
Renders a captcha row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row @since 0.9.3
[ "Renders", "a", "captcha", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L282-L285
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.uneditableRow
public function uneditableRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_UNEDITABLE, $model, $attribute, null, $htmlOptions); }
php
public function uneditableRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_UNEDITABLE, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "uneditableRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_UNEDITABLE", ",", "$", "model", ",", "$", ...
Renders an uneditable text field row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row @since 0.9.5
[ "Renders", "an", "uneditable", "text", "field", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L295-L298
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.datepickerRow
public function datepickerRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_DATEPICKER, $model, $attribute, null, $htmlOptions); }
php
public function datepickerRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_DATEPICKER, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "datepickerRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_DATEPICKER", ",", "$", "model", ",", "$", ...
Renders a datepicker field row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes. 'events' and 'options' key specify the events and configuration options of datepicker respectively. @return string the generated row @since 1.0.2 Booster
[ "Renders", "a", "datepicker", "field", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L309-L312
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.colorpickerRow
public function colorpickerRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_COLORPICKER, $model, $attribute, null, $htmlOptions); }
php
public function colorpickerRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_COLORPICKER, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "colorpickerRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_COLORPICKER", ",", "$", "model", ",", "$", ...
Renders a colorpicker field row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes. 'events' and 'options' key specify the events and configuration options of colorpicker respectively. @return string the generated row @since 1.0.3 Booster
[ "Renders", "a", "colorpicker", "field", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L323-L326
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.timepickerRow
public function timepickerRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TIMEPICKER, $model, $attribute, null, $htmlOptions); }
php
public function timepickerRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TIMEPICKER, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "timepickerRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_TIMEPICKER", ",", "$", "model", ",", "$", ...
Renders a timepicker field row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row @since 0.10.0
[ "Renders", "a", "timepicker", "field", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L347-L350
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.select2Row
public function select2Row($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_SELECT2, $model, $attribute, null, $htmlOptions); }
php
public function select2Row($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_SELECT2, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "select2Row", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_SELECT2", ",", "$", "model", ",", "$", "attri...
Renders a select2 field row @param $model @param $attribute @param array $htmlOptions @return string
[ "Renders", "a", "select2", "field", "row" ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L359-L362
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.radioButtonGroupsList
public function radioButtonGroupsList($model, $attribute, $data, $htmlOptions = array()) { $buttons = array(); $scripts = array(); $hiddenFieldId = CHtml::getIdByName(get_class($model) . '[' . $attribute . ']'); $buttonType = isset($htmlOptions['type']) ? $htmlOptions['type'] : null; foreach ($data as $key => $value) { $btnId = CHtml::getIdByName(get_class($model) . '[' . $attribute . '][' . $key . ']'); $button = array(); $button['label'] = $value; $button['htmlOptions'] = array( 'value' => $key, 'id' => $btnId, 'class' => (isset($model->$attribute) && $model->$attribute == $key ? 'active': ''), ); $buttons[] = $button; // event as ordinary input $scripts[] = "\$('#" . $btnId . "').click(function(){ \$('#" . $hiddenFieldId . "').val('" . $key . "').trigger('change'); });"; } Yii::app()->controller->widget('bootstrap.widgets.CiiButtonGroup', array( 'buttonType' => 'button', 'toggle' => 'radio', 'htmlOptions' => $htmlOptions, 'buttons' => $buttons, 'type' => $buttonType, )); echo $this->hiddenField($model, $attribute); Yii::app()->clientScript->registerScript('radiobuttongrouplist-' . $attribute, implode("\n", $scripts)); }
php
public function radioButtonGroupsList($model, $attribute, $data, $htmlOptions = array()) { $buttons = array(); $scripts = array(); $hiddenFieldId = CHtml::getIdByName(get_class($model) . '[' . $attribute . ']'); $buttonType = isset($htmlOptions['type']) ? $htmlOptions['type'] : null; foreach ($data as $key => $value) { $btnId = CHtml::getIdByName(get_class($model) . '[' . $attribute . '][' . $key . ']'); $button = array(); $button['label'] = $value; $button['htmlOptions'] = array( 'value' => $key, 'id' => $btnId, 'class' => (isset($model->$attribute) && $model->$attribute == $key ? 'active': ''), ); $buttons[] = $button; // event as ordinary input $scripts[] = "\$('#" . $btnId . "').click(function(){ \$('#" . $hiddenFieldId . "').val('" . $key . "').trigger('change'); });"; } Yii::app()->controller->widget('bootstrap.widgets.CiiButtonGroup', array( 'buttonType' => 'button', 'toggle' => 'radio', 'htmlOptions' => $htmlOptions, 'buttons' => $buttons, 'type' => $buttonType, )); echo $this->hiddenField($model, $attribute); Yii::app()->clientScript->registerScript('radiobuttongrouplist-' . $attribute, implode("\n", $scripts)); }
[ "public", "function", "radioButtonGroupsList", "(", "$", "model", ",", "$", "attribute", ",", "$", "data", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "$", "buttons", "=", "array", "(", ")", ";", "$", "scripts", "=", "array", "(", ")",...
Renders a radio button list for a model attribute using Button Groups. @param CModel $model the data model @param string $attribute the attribute @param array $data value-label pairs used to generate the radio button list. @param array $htmlOptions additional HTML options. @return string the generated radio button list @since 0.9.5
[ "Renders", "a", "radio", "button", "list", "for", "a", "model", "attribute", "using", "Button", "Groups", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L407-L444
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.inputRow
public function inputRow($type, $model, $attribute, $data = null, $htmlOptions = array()) { ob_start(); Yii::app()->controller->widget($this->getInputClassName(), array( 'type' => $type, 'form' => $this, 'model' => $model, 'attribute' => $attribute, 'data' => $data, 'htmlOptions' => $htmlOptions, )); return ob_get_clean(); }
php
public function inputRow($type, $model, $attribute, $data = null, $htmlOptions = array()) { ob_start(); Yii::app()->controller->widget($this->getInputClassName(), array( 'type' => $type, 'form' => $this, 'model' => $model, 'attribute' => $attribute, 'data' => $data, 'htmlOptions' => $htmlOptions, )); return ob_get_clean(); }
[ "public", "function", "inputRow", "(", "$", "type", ",", "$", "model", ",", "$", "attribute", ",", "$", "data", "=", "null", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "ob_start", "(", ")", ";", "Yii", "::", "app", "(", ")", "->",...
Creates an input row of a specific type. @param string $type the input type @param CModel $model the data model @param string $attribute the attribute @param array $data the data for list inputs @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Creates", "an", "input", "row", "of", "a", "specific", "type", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L671-L683
train
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.getInputClassName
protected function getInputClassName() { if (isset($this->input)) return $this->input; else { switch ($this->type) { case self::TYPE_HORIZONTAL: return self::INPUT_HORIZONTAL; break; case self::TYPE_INLINE: return self::INPUT_INLINE; break; case self::TYPE_SEARCH: return self::INPUT_SEARCH; break; case self::TYPE_VERTICAL: default: return self::INPUT_VERTICAL; break; } } }
php
protected function getInputClassName() { if (isset($this->input)) return $this->input; else { switch ($this->type) { case self::TYPE_HORIZONTAL: return self::INPUT_HORIZONTAL; break; case self::TYPE_INLINE: return self::INPUT_INLINE; break; case self::TYPE_SEARCH: return self::INPUT_SEARCH; break; case self::TYPE_VERTICAL: default: return self::INPUT_VERTICAL; break; } } }
[ "protected", "function", "getInputClassName", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "input", ")", ")", "return", "$", "this", "->", "input", ";", "else", "{", "switch", "(", "$", "this", "->", "type", ")", "{", "case", "self", ...
Returns the input widget class name suitable for the form. @return string the class name
[ "Returns", "the", "input", "widget", "class", "name", "suitable", "for", "the", "form", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L689-L715
train
eix/core
src/php/main/Eix/Services/Net/Mail/Message.php
Message.send
public function send() { $settings = Application::getSettings()->mail; $mailTransport = new Transport( @$settings->smtp->host ? : 'localhost', @$settings->smtp->port ? : 25, @$settings->smtp->timeout ? : 15 ); $mailTransport->setUser( @$settings->smtp->user, @$settings->smtp->password ); $mailTransport->addMessage($this); $mailTransport->send(); }
php
public function send() { $settings = Application::getSettings()->mail; $mailTransport = new Transport( @$settings->smtp->host ? : 'localhost', @$settings->smtp->port ? : 25, @$settings->smtp->timeout ? : 15 ); $mailTransport->setUser( @$settings->smtp->user, @$settings->smtp->password ); $mailTransport->addMessage($this); $mailTransport->send(); }
[ "public", "function", "send", "(", ")", "{", "$", "settings", "=", "Application", "::", "getSettings", "(", ")", "->", "mail", ";", "$", "mailTransport", "=", "new", "Transport", "(", "@", "$", "settings", "->", "smtp", "->", "host", "?", ":", "'localh...
Sends the current mail message.
[ "Sends", "the", "current", "mail", "message", "." ]
a5b4c09cc168221e85804fdfeb78e519a0415466
https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Services/Net/Mail/Message.php#L180-L197
train
nonetallt/jinitialize-core
src/Input/Input.php
Input.walk
private function walk(callable $cb) { foreach($this->values() as $key => $value) { $cb($key, $value); } }
php
private function walk(callable $cb) { foreach($this->values() as $key => $value) { $cb($key, $value); } }
[ "private", "function", "walk", "(", "callable", "$", "cb", ")", "{", "foreach", "(", "$", "this", "->", "values", "(", ")", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "cb", "(", "$", "key", ",", "$", "value", ")", ";", "}", "}" ]
Apply a callback to each input value
[ "Apply", "a", "callback", "to", "each", "input", "value" ]
284fbd72b7c1d6f5f8f265dfe2589c0d99b6a88f
https://github.com/nonetallt/jinitialize-core/blob/284fbd72b7c1d6f5f8f265dfe2589c0d99b6a88f/src/Input/Input.php#L139-L144
train
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.setDefaultConfig
protected function setDefaultConfig() { //database prefix $this->config['db.prefix'] = ''; //dynamic sql environment id $this->config['env.id'] = 'default'; //dynamic sql environment class $this->config['env.class'] = 'eMapper\Dynamic\Environment\DynamicSQLEnvironment'; //default relation depth $this->config['depth.current'] = 0; //default relation depth limit $this->config['depth.limit'] = 1; //cache metakey $this->config['cache.metakey'] = '__cache__'; }
php
protected function setDefaultConfig() { //database prefix $this->config['db.prefix'] = ''; //dynamic sql environment id $this->config['env.id'] = 'default'; //dynamic sql environment class $this->config['env.class'] = 'eMapper\Dynamic\Environment\DynamicSQLEnvironment'; //default relation depth $this->config['depth.current'] = 0; //default relation depth limit $this->config['depth.limit'] = 1; //cache metakey $this->config['cache.metakey'] = '__cache__'; }
[ "protected", "function", "setDefaultConfig", "(", ")", "{", "//database prefix", "$", "this", "->", "config", "[", "'db.prefix'", "]", "=", "''", ";", "//dynamic sql environment id", "$", "this", "->", "config", "[", "'env.id'", "]", "=", "'default'", ";", "//...
Applies default configuration options
[ "Applies", "default", "configuration", "options" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L84-L102
train
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.addType
public function addType($type, TypeHandler $typeHandler, $alias = null) { $this->typeManager->setTypeHandler($type, $typeHandler); if (!is_null($alias)) { if (is_array($alias)) { foreach ($alias as $al) $this->typeManager->addAlias($type, $al); } else $this->typeManager->addAlias($type, $alias); } }
php
public function addType($type, TypeHandler $typeHandler, $alias = null) { $this->typeManager->setTypeHandler($type, $typeHandler); if (!is_null($alias)) { if (is_array($alias)) { foreach ($alias as $al) $this->typeManager->addAlias($type, $al); } else $this->typeManager->addAlias($type, $alias); } }
[ "public", "function", "addType", "(", "$", "type", ",", "TypeHandler", "$", "typeHandler", ",", "$", "alias", "=", "null", ")", "{", "$", "this", "->", "typeManager", "->", "setTypeHandler", "(", "$", "type", ",", "$", "typeHandler", ")", ";", "if", "(...
Adds a new type handler @param string $type @param \eMapper\Type\TypeHandler $typeHandler @param string | array $alias
[ "Adds", "a", "new", "type", "handler" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L189-L200
train
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.sql
public function sql($query, $args = []) { if (!is_string($query) || empty($query)) throw new \InvalidArgumentException("Query is not a valid string"); //open connection $this->driver->connect(); //build statement $stmt = $this->driver->buildStatement($this->typeManager); //build query $query = $stmt->format($query, $args, $this->config); //invoke debug callback if ($this->hasOption('callback.debug')) { $callback = $this->getOption('callback.debug'); if ($callback instanceof \Closure) $callback->__invoke($query); } //run query $result = $this->driver->query($query); //check query execution if ($result === false) $this->driver->throwQueryException($stmt); return $result; }
php
public function sql($query, $args = []) { if (!is_string($query) || empty($query)) throw new \InvalidArgumentException("Query is not a valid string"); //open connection $this->driver->connect(); //build statement $stmt = $this->driver->buildStatement($this->typeManager); //build query $query = $stmt->format($query, $args, $this->config); //invoke debug callback if ($this->hasOption('callback.debug')) { $callback = $this->getOption('callback.debug'); if ($callback instanceof \Closure) $callback->__invoke($query); } //run query $result = $this->driver->query($query); //check query execution if ($result === false) $this->driver->throwQueryException($stmt); return $result; }
[ "public", "function", "sql", "(", "$", "query", ",", "$", "args", "=", "[", "]", ")", "{", "if", "(", "!", "is_string", "(", "$", "query", ")", "||", "empty", "(", "$", "query", ")", ")", "throw", "new", "\\", "InvalidArgumentException", "(", "\"Qu...
Runs a query @param string $query @return mixed
[ "Runs", "a", "query" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L655-L683
train
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.query
public function query($query) { $args = func_get_args(); $query = array_shift($args); return $this->execute($query, $args); }
php
public function query($query) { $args = func_get_args(); $query = array_shift($args); return $this->execute($query, $args); }
[ "public", "function", "query", "(", "$", "query", ")", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "$", "query", "=", "array_shift", "(", "$", "args", ")", ";", "return", "$", "this", "->", "execute", "(", "$", "query", ",", "$", "args",...
Executes a query with the given arguments @param string $query @return mixed
[ "Executes", "a", "query", "with", "the", "given", "arguments" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L690-L694
train
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.beginTransaction
public function beginTransaction() { $this->connect(); if ($this->txStatus == self::TX_NOT_STARTED) { $this->txStatus = self::TX_STARTED; $this->txCounter = 1; return $this->driver->begin(); } $this->txCounter++; return false; }
php
public function beginTransaction() { $this->connect(); if ($this->txStatus == self::TX_NOT_STARTED) { $this->txStatus = self::TX_STARTED; $this->txCounter = 1; return $this->driver->begin(); } $this->txCounter++; return false; }
[ "public", "function", "beginTransaction", "(", ")", "{", "$", "this", "->", "connect", "(", ")", ";", "if", "(", "$", "this", "->", "txStatus", "==", "self", "::", "TX_NOT_STARTED", ")", "{", "$", "this", "->", "txStatus", "=", "self", "::", "TX_STARTE...
Begins a transaction
[ "Begins", "a", "transaction" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L733-L744
train
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.commit
public function commit() { if ($this->txStatus == self::TX_STARTED && $this->txCounter == 1) { $this->txStatus = self::TX_NOT_STARTED; $this->txCounter = 0; return $this->driver->commit(); } $this->txCounter--; return false; }
php
public function commit() { if ($this->txStatus == self::TX_STARTED && $this->txCounter == 1) { $this->txStatus = self::TX_NOT_STARTED; $this->txCounter = 0; return $this->driver->commit(); } $this->txCounter--; return false; }
[ "public", "function", "commit", "(", ")", "{", "if", "(", "$", "this", "->", "txStatus", "==", "self", "::", "TX_STARTED", "&&", "$", "this", "->", "txCounter", "==", "1", ")", "{", "$", "this", "->", "txStatus", "=", "self", "::", "TX_NOT_STARTED", ...
Commits current transaction
[ "Commits", "current", "transaction" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L749-L758
train
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.rollback
public function rollback() { $this->txStatus = self::TX_NOT_STARTED; $this->txCounter = 0; return $this->driver->rollback(); }
php
public function rollback() { $this->txStatus = self::TX_NOT_STARTED; $this->txCounter = 0; return $this->driver->rollback(); }
[ "public", "function", "rollback", "(", ")", "{", "$", "this", "->", "txStatus", "=", "self", "::", "TX_NOT_STARTED", ";", "$", "this", "->", "txCounter", "=", "0", ";", "return", "$", "this", "->", "driver", "->", "rollback", "(", ")", ";", "}" ]
Rollbacks current transaction
[ "Rollbacks", "current", "transaction" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L763-L767
train
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.newManager
public function newManager($classname) { $profile = Profiler::getClassProfile($classname); if (!$profile->isEntity()) throw new \InvalidArgumentException(sprintf("Class %s is not declared as an entity", $profile->reflectionClass->getName())); return new Manager($this, $profile); }
php
public function newManager($classname) { $profile = Profiler::getClassProfile($classname); if (!$profile->isEntity()) throw new \InvalidArgumentException(sprintf("Class %s is not declared as an entity", $profile->reflectionClass->getName())); return new Manager($this, $profile); }
[ "public", "function", "newManager", "(", "$", "classname", ")", "{", "$", "profile", "=", "Profiler", "::", "getClassProfile", "(", "$", "classname", ")", ";", "if", "(", "!", "$", "profile", "->", "isEntity", "(", ")", ")", "throw", "new", "\\", "Inva...
Returns a new Manager instance @param string $classname @throws \InvalidArgumentException @return \eMapper\ORM\Manager
[ "Returns", "a", "new", "Manager", "instance" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L805-L810
train
SetBased/php-abc-phing
src/Task/OptimizeResourceTask.php
OptimizeResourceTask.main
public function main() { // Get base info about project. $this->prepareProjectData(); // Get all info about source files. $this->getInfoSourceFiles(); // Get all info about resource files. $this->getInfoResourceFiles(); // Prepare all place holders. $this->preparePlaceHolders(); // Replace references to resource files with references to optimized/minimized resource files. $this->processingSourceFiles(); // Compress and rename files with hash. $this->processResourceFiles(); // Create pre-compressed versions of the optimized/minimized resource files. if ($this->gzipFlag) $this->gzipCompressOptimizedResourceFiles(); // Remove original resource files that are optimized/minimized. $this->unlinkResourceFiles(); }
php
public function main() { // Get base info about project. $this->prepareProjectData(); // Get all info about source files. $this->getInfoSourceFiles(); // Get all info about resource files. $this->getInfoResourceFiles(); // Prepare all place holders. $this->preparePlaceHolders(); // Replace references to resource files with references to optimized/minimized resource files. $this->processingSourceFiles(); // Compress and rename files with hash. $this->processResourceFiles(); // Create pre-compressed versions of the optimized/minimized resource files. if ($this->gzipFlag) $this->gzipCompressOptimizedResourceFiles(); // Remove original resource files that are optimized/minimized. $this->unlinkResourceFiles(); }
[ "public", "function", "main", "(", ")", "{", "// Get base info about project.", "$", "this", "->", "prepareProjectData", "(", ")", ";", "// Get all info about source files.", "$", "this", "->", "getInfoSourceFiles", "(", ")", ";", "// Get all info about resource files.", ...
Main method of this Phing task.
[ "Main", "method", "of", "this", "Phing", "task", "." ]
eb3d337ceafa7c1ae0caa5b70074dfea03d94017
https://github.com/SetBased/php-abc-phing/blob/eb3d337ceafa7c1ae0caa5b70074dfea03d94017/src/Task/OptimizeResourceTask.php#L59-L84
train
SetBased/php-abc-phing
src/Task/OptimizeResourceTask.php
OptimizeResourceTask.getClasses
protected function getClasses(string $phpCode): array { $tokens = token_get_all($phpCode); $mode = ''; $namespace = ''; $classes = []; foreach ($tokens as $i => $token) { // If this token is the namespace declaring, then flag that the next tokens will be the namespace name if (is_array($token) && $token[0]==T_NAMESPACE) { $mode = 'namespace'; $namespace = ''; continue; } // If this token is the class declaring, then flag that the next tokens will be the class name if (is_array($token) && in_array($token[0], [T_CLASS, T_INTERFACE, T_TRAIT])) { $mode = 'class'; continue; } // While we're grabbing the namespace name... if ($mode=='namespace') { // If the token is a string or the namespace separator... if (is_array($token) && in_array($token[0], [T_STRING, T_NS_SEPARATOR])) { //Append the token's value to the name of the namespace $namespace .= $token[1]; } elseif (is_array($token) && $token[0]==T_WHITESPACE) { // Ignore whitespace. } elseif ($token===';') { // If the token is the semicolon, then we're done with the namespace declaration $mode = ''; } elseif ($token==='{') { throw new LogicException('Bracketed syntax for namespace not supported.'); } else { throw new LogicException("Unexpected token %s", print_r($token, true)); } } // While we're grabbing the class name... if ($mode=='class') { // If the token is a string, it's the name of the class if (is_array($token) && $token[0]==T_STRING) { // Store the token's value as the class name $classes[$token[2]] = ['namespace' => $namespace, 'class' => $token[1], 'line' => $token[2]]; $mode = ''; } } } return $classes; }
php
protected function getClasses(string $phpCode): array { $tokens = token_get_all($phpCode); $mode = ''; $namespace = ''; $classes = []; foreach ($tokens as $i => $token) { // If this token is the namespace declaring, then flag that the next tokens will be the namespace name if (is_array($token) && $token[0]==T_NAMESPACE) { $mode = 'namespace'; $namespace = ''; continue; } // If this token is the class declaring, then flag that the next tokens will be the class name if (is_array($token) && in_array($token[0], [T_CLASS, T_INTERFACE, T_TRAIT])) { $mode = 'class'; continue; } // While we're grabbing the namespace name... if ($mode=='namespace') { // If the token is a string or the namespace separator... if (is_array($token) && in_array($token[0], [T_STRING, T_NS_SEPARATOR])) { //Append the token's value to the name of the namespace $namespace .= $token[1]; } elseif (is_array($token) && $token[0]==T_WHITESPACE) { // Ignore whitespace. } elseif ($token===';') { // If the token is the semicolon, then we're done with the namespace declaration $mode = ''; } elseif ($token==='{') { throw new LogicException('Bracketed syntax for namespace not supported.'); } else { throw new LogicException("Unexpected token %s", print_r($token, true)); } } // While we're grabbing the class name... if ($mode=='class') { // If the token is a string, it's the name of the class if (is_array($token) && $token[0]==T_STRING) { // Store the token's value as the class name $classes[$token[2]] = ['namespace' => $namespace, 'class' => $token[1], 'line' => $token[2]]; $mode = ''; } } } return $classes; }
[ "protected", "function", "getClasses", "(", "string", "$", "phpCode", ")", ":", "array", "{", "$", "tokens", "=", "token_get_all", "(", "$", "phpCode", ")", ";", "$", "mode", "=", "''", ";", "$", "namespace", "=", "''", ";", "$", "classes", "=", "[",...
Returns an array with classes and namespaces defined in PHP code. @param string $phpCode The PHP code. @return array
[ "Returns", "an", "array", "with", "classes", "and", "namespaces", "defined", "in", "PHP", "code", "." ]
eb3d337ceafa7c1ae0caa5b70074dfea03d94017
https://github.com/SetBased/php-abc-phing/blob/eb3d337ceafa7c1ae0caa5b70074dfea03d94017/src/Task/OptimizeResourceTask.php#L138-L207
train
SetBased/php-abc-phing
src/Task/OptimizeResourceTask.php
OptimizeResourceTask.getInfoSourceFiles
private function getInfoSourceFiles(): void { $this->logVerbose('Get resource files info.'); // Get the base dir of the sources. $dir = $this->getProject()->getReference($this->sourcesFilesetId)->getDir($this->getProject()); foreach ($this->sourceFileNames as $theFileName) { $filename = $dir.'/'.$theFileName; $real_path = realpath($filename); $this->sourceFilesInfo[$real_path] = $filename; } $suc = ksort($this->sourceFilesInfo); if ($suc===false) $this->logError("ksort failed."); }
php
private function getInfoSourceFiles(): void { $this->logVerbose('Get resource files info.'); // Get the base dir of the sources. $dir = $this->getProject()->getReference($this->sourcesFilesetId)->getDir($this->getProject()); foreach ($this->sourceFileNames as $theFileName) { $filename = $dir.'/'.$theFileName; $real_path = realpath($filename); $this->sourceFilesInfo[$real_path] = $filename; } $suc = ksort($this->sourceFilesInfo); if ($suc===false) $this->logError("ksort failed."); }
[ "private", "function", "getInfoSourceFiles", "(", ")", ":", "void", "{", "$", "this", "->", "logVerbose", "(", "'Get resource files info.'", ")", ";", "// Get the base dir of the sources.", "$", "dir", "=", "$", "this", "->", "getProject", "(", ")", "->", "getRe...
Gets full path for each source file in the source fileset.
[ "Gets", "full", "path", "for", "each", "source", "file", "in", "the", "source", "fileset", "." ]
eb3d337ceafa7c1ae0caa5b70074dfea03d94017
https://github.com/SetBased/php-abc-phing/blob/eb3d337ceafa7c1ae0caa5b70074dfea03d94017/src/Task/OptimizeResourceTask.php#L336-L352
train
SetBased/php-abc-phing
src/Task/OptimizeResourceTask.php
OptimizeResourceTask.getResourceFilesInSource
private function getResourceFilesInSource(string $sourceFileContent): array { $resource_files = []; foreach ($this->getResourcesInfo() as $file_info) { if (strpos($sourceFileContent, $file_info['path_name_in_sources_with_hash'])!==false) { $resource_files[] = $file_info; } } return $resource_files; }
php
private function getResourceFilesInSource(string $sourceFileContent): array { $resource_files = []; foreach ($this->getResourcesInfo() as $file_info) { if (strpos($sourceFileContent, $file_info['path_name_in_sources_with_hash'])!==false) { $resource_files[] = $file_info; } } return $resource_files; }
[ "private", "function", "getResourceFilesInSource", "(", "string", "$", "sourceFileContent", ")", ":", "array", "{", "$", "resource_files", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getResourcesInfo", "(", ")", "as", "$", "file_info", ")", "{", ...
Returns an array with info about resource files referenced from a source file. @param string $sourceFileContent Content of updated source file. @return array
[ "Returns", "an", "array", "with", "info", "about", "resource", "files", "referenced", "from", "a", "source", "file", "." ]
eb3d337ceafa7c1ae0caa5b70074dfea03d94017
https://github.com/SetBased/php-abc-phing/blob/eb3d337ceafa7c1ae0caa5b70074dfea03d94017/src/Task/OptimizeResourceTask.php#L391-L403
train
samurai-fw/samurai
src/Samurai/Component/Cache/ArrayCache.php
ArrayCache.cache
public function cache($key, $value, $expire = null) { $this->_caches[$key] = $value; return true; }
php
public function cache($key, $value, $expire = null) { $this->_caches[$key] = $value; return true; }
[ "public", "function", "cache", "(", "$", "key", ",", "$", "value", ",", "$", "expire", "=", "null", ")", "{", "$", "this", "->", "_caches", "[", "$", "key", "]", "=", "$", "value", ";", "return", "true", ";", "}" ]
expire not supported. {@inheritdoc}
[ "expire", "not", "supported", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Samurai/Component/Cache/ArrayCache.php#L57-L61
train
nattreid/gallery
src/Control/Gallery.php
Gallery.handleDeleteAllImages
public function handleDeleteAllImages(): void { if ($this->request->isAjax()) { $result = $this->getStorage()->delete(); foreach ($result as $row) { $this->imageStorage->delete($row); } $this->redrawControl('gallery'); } else { throw new AbortException; } }
php
public function handleDeleteAllImages(): void { if ($this->request->isAjax()) { $result = $this->getStorage()->delete(); foreach ($result as $row) { $this->imageStorage->delete($row); } $this->redrawControl('gallery'); } else { throw new AbortException; } }
[ "public", "function", "handleDeleteAllImages", "(", ")", ":", "void", "{", "if", "(", "$", "this", "->", "request", "->", "isAjax", "(", ")", ")", "{", "$", "result", "=", "$", "this", "->", "getStorage", "(", ")", "->", "delete", "(", ")", ";", "f...
Smaze vsechny obrazky z modelu @secured @throws AbortException
[ "Smaze", "vsechny", "obrazky", "z", "modelu" ]
1f2a222ab157f7184ffdd623aa12eee98cad0cdb
https://github.com/nattreid/gallery/blob/1f2a222ab157f7184ffdd623aa12eee98cad0cdb/src/Control/Gallery.php#L140-L152
train
nattreid/gallery
src/Control/Gallery.php
Gallery.handleDeleteImages
public function handleDeleteImages(string $json): void { if ($this->request->isAjax()) { $data = Json::decode($json); $result = $this->getStorage()->delete($data); foreach ($result as $row) { $this->imageStorage->delete($row); } $this->redrawControl('gallery'); } else { throw new AbortException; } }
php
public function handleDeleteImages(string $json): void { if ($this->request->isAjax()) { $data = Json::decode($json); $result = $this->getStorage()->delete($data); foreach ($result as $row) { $this->imageStorage->delete($row); } $this->redrawControl('gallery'); } else { throw new AbortException; } }
[ "public", "function", "handleDeleteImages", "(", "string", "$", "json", ")", ":", "void", "{", "if", "(", "$", "this", "->", "request", "->", "isAjax", "(", ")", ")", "{", "$", "data", "=", "Json", "::", "decode", "(", "$", "json", ")", ";", "$", ...
Smaze vybrane obrazky @param string $json @secured @throws \Nette\Utils\JsonException @throws AbortException
[ "Smaze", "vybrane", "obrazky" ]
1f2a222ab157f7184ffdd623aa12eee98cad0cdb
https://github.com/nattreid/gallery/blob/1f2a222ab157f7184ffdd623aa12eee98cad0cdb/src/Control/Gallery.php#L161-L175
train
nattreid/gallery
src/Control/Gallery.php
Gallery.handleNextImage
public function handleNextImage(int $id): void { if ($this->request->isAjax()) { $row = $this->getStorage()->getNext($id); if ($row) { $this->template->viewImage = $row; $this->redrawControl('image'); } else { throw new AbortException; } } else { throw new AbortException; } }
php
public function handleNextImage(int $id): void { if ($this->request->isAjax()) { $row = $this->getStorage()->getNext($id); if ($row) { $this->template->viewImage = $row; $this->redrawControl('image'); } else { throw new AbortException; } } else { throw new AbortException; } }
[ "public", "function", "handleNextImage", "(", "int", "$", "id", ")", ":", "void", "{", "if", "(", "$", "this", "->", "request", "->", "isAjax", "(", ")", ")", "{", "$", "row", "=", "$", "this", "->", "getStorage", "(", ")", "->", "getNext", "(", ...
Zobrazi dalsi obrazek @param int $id @secured @throws AbortException
[ "Zobrazi", "dalsi", "obrazek" ]
1f2a222ab157f7184ffdd623aa12eee98cad0cdb
https://github.com/nattreid/gallery/blob/1f2a222ab157f7184ffdd623aa12eee98cad0cdb/src/Control/Gallery.php#L218-L231
train
nattreid/gallery
src/Control/Gallery.php
Gallery.handlePreviousImage
public function handlePreviousImage(int $id): void { if ($this->request->isAjax()) { $row = $this->getStorage()->getPrevious($id); if ($row) { $this->template->viewImage = $row; $this->redrawControl('image'); } else { throw new AbortException; } } else { throw new AbortException; } }
php
public function handlePreviousImage(int $id): void { if ($this->request->isAjax()) { $row = $this->getStorage()->getPrevious($id); if ($row) { $this->template->viewImage = $row; $this->redrawControl('image'); } else { throw new AbortException; } } else { throw new AbortException; } }
[ "public", "function", "handlePreviousImage", "(", "int", "$", "id", ")", ":", "void", "{", "if", "(", "$", "this", "->", "request", "->", "isAjax", "(", ")", ")", "{", "$", "row", "=", "$", "this", "->", "getStorage", "(", ")", "->", "getPrevious", ...
Zobrazi predchozi obrazek @param int $id @secured @throws AbortException
[ "Zobrazi", "predchozi", "obrazek" ]
1f2a222ab157f7184ffdd623aa12eee98cad0cdb
https://github.com/nattreid/gallery/blob/1f2a222ab157f7184ffdd623aa12eee98cad0cdb/src/Control/Gallery.php#L239-L252
train
nattreid/gallery
src/Control/Gallery.php
Gallery.handleUpdatePosition
public function handleUpdatePosition(string $json): void { if ($this->request->isAjax()) { $data = Json::decode($json); $this->getStorage()->updatePosition($data); } throw new AbortException; }
php
public function handleUpdatePosition(string $json): void { if ($this->request->isAjax()) { $data = Json::decode($json); $this->getStorage()->updatePosition($data); } throw new AbortException; }
[ "public", "function", "handleUpdatePosition", "(", "string", "$", "json", ")", ":", "void", "{", "if", "(", "$", "this", "->", "request", "->", "isAjax", "(", ")", ")", "{", "$", "data", "=", "Json", "::", "decode", "(", "$", "json", ")", ";", "$",...
Aktualizuje poradi obrazku @param string $json @secured @throws \Nette\Utils\JsonException @throws AbortException
[ "Aktualizuje", "poradi", "obrazku" ]
1f2a222ab157f7184ffdd623aa12eee98cad0cdb
https://github.com/nattreid/gallery/blob/1f2a222ab157f7184ffdd623aa12eee98cad0cdb/src/Control/Gallery.php#L261-L268
train
nattreid/gallery
src/Control/Gallery.php
Gallery.setForeignKey
public function setForeignKey(string $keyName, int $value): void { if ($this->storage instanceof NetteDatabaseStorage) { $this->storage->setForeignKey($keyName, $value); } elseif ($this->storage instanceof NextrasOrmStorage) { $this->storage->setForeignKey($keyName, $value); } else { throw new InvalidArgumentException('Storage is not database'); } }
php
public function setForeignKey(string $keyName, int $value): void { if ($this->storage instanceof NetteDatabaseStorage) { $this->storage->setForeignKey($keyName, $value); } elseif ($this->storage instanceof NextrasOrmStorage) { $this->storage->setForeignKey($keyName, $value); } else { throw new InvalidArgumentException('Storage is not database'); } }
[ "public", "function", "setForeignKey", "(", "string", "$", "keyName", ",", "int", "$", "value", ")", ":", "void", "{", "if", "(", "$", "this", "->", "storage", "instanceof", "NetteDatabaseStorage", ")", "{", "$", "this", "->", "storage", "->", "setForeignK...
Nastavi cizi klic @param string $keyName @param int $value
[ "Nastavi", "cizi", "klic" ]
1f2a222ab157f7184ffdd623aa12eee98cad0cdb
https://github.com/nattreid/gallery/blob/1f2a222ab157f7184ffdd623aa12eee98cad0cdb/src/Control/Gallery.php#L292-L301
train
gorriecoe/silverstripe-htmltag
src/view/HTMLTag.php
HTMLTag.addAttribute
public function addAttribute($name = null, $value) { if ($value) { $this->attributes[$name] = $value; } return $this; }
php
public function addAttribute($name = null, $value) { if ($value) { $this->attributes[$name] = $value; } return $this; }
[ "public", "function", "addAttribute", "(", "$", "name", "=", "null", ",", "$", "value", ")", "{", "if", "(", "$", "value", ")", "{", "$", "this", "->", "attributes", "[", "$", "name", "]", "=", "$", "value", ";", "}", "return", "$", "this", ";", ...
Defines an HTML attribute to add @param string $name Attribute name @param string $value Attribute value @return HTMLTag $this
[ "Defines", "an", "HTML", "attribute", "to", "add" ]
53a0e075977e7c56af0046b8c91406f417b7aad1
https://github.com/gorriecoe/silverstripe-htmltag/blob/53a0e075977e7c56af0046b8c91406f417b7aad1/src/view/HTMLTag.php#L89-L95
train
gorriecoe/silverstripe-htmltag
src/view/HTMLTag.php
HTMLTag.setClass
public function setClass($value) { $classes = []; foreach (explode(' ', $value) as $class) { $classes[$class] = $class; } $this->classes = $classes; return $this; }
php
public function setClass($value) { $classes = []; foreach (explode(' ', $value) as $class) { $classes[$class] = $class; } $this->classes = $classes; return $this; }
[ "public", "function", "setClass", "(", "$", "value", ")", "{", "$", "classes", "=", "[", "]", ";", "foreach", "(", "explode", "(", "' '", ",", "$", "value", ")", "as", "$", "class", ")", "{", "$", "classes", "[", "$", "class", "]", "=", "$", "c...
Defines CSS classes @param string $value CSS class @return HTMLTag $this
[ "Defines", "CSS", "classes" ]
53a0e075977e7c56af0046b8c91406f417b7aad1
https://github.com/gorriecoe/silverstripe-htmltag/blob/53a0e075977e7c56af0046b8c91406f417b7aad1/src/view/HTMLTag.php#L133-L141
train
gorriecoe/silverstripe-htmltag
src/view/HTMLTag.php
HTMLTag.Render
public function Render() { $string = $this->string; $tag = $this->tag; $classes = $this->classes; if (Count($classes)) { if ($classPrefix = $this->classPrefix) { foreach ($classes as $key => $value) { $prefixedClass = $classPrefix . '__' . $value; $classes[$prefixedClass] = $prefixedClass; } } $this->addAttribute('class', implode(' ', $classes)); } if ($this->isVoidElement() && $string) { if ($voidAttributeName = $this->VoidElements[$tag]) { $this->addAttribute($voidAttributeName, $string); } else { throw new InvalidArgumentException("Void element \"{$tag}\" cannot have string"); } } $attributes = []; foreach ($this->attributes as $name => $value) { $attributes[] = sprintf( '%s="%s"', $name, Convert::raw2att($value) ); } $attributes = Count($attributes) ? ' ' . implode(' ', $attributes) : ''; if ($this->isVoidElement()) { return "<{$tag}{$attributes} />"; } if (!isset($string) || !$string || $string == '') { return null; } return "<{$tag}{$attributes}>{$string}</{$tag}>"; }
php
public function Render() { $string = $this->string; $tag = $this->tag; $classes = $this->classes; if (Count($classes)) { if ($classPrefix = $this->classPrefix) { foreach ($classes as $key => $value) { $prefixedClass = $classPrefix . '__' . $value; $classes[$prefixedClass] = $prefixedClass; } } $this->addAttribute('class', implode(' ', $classes)); } if ($this->isVoidElement() && $string) { if ($voidAttributeName = $this->VoidElements[$tag]) { $this->addAttribute($voidAttributeName, $string); } else { throw new InvalidArgumentException("Void element \"{$tag}\" cannot have string"); } } $attributes = []; foreach ($this->attributes as $name => $value) { $attributes[] = sprintf( '%s="%s"', $name, Convert::raw2att($value) ); } $attributes = Count($attributes) ? ' ' . implode(' ', $attributes) : ''; if ($this->isVoidElement()) { return "<{$tag}{$attributes} />"; } if (!isset($string) || !$string || $string == '') { return null; } return "<{$tag}{$attributes}>{$string}</{$tag}>"; }
[ "public", "function", "Render", "(", ")", "{", "$", "string", "=", "$", "this", "->", "string", ";", "$", "tag", "=", "$", "this", "->", "tag", ";", "$", "classes", "=", "$", "this", "->", "classes", ";", "if", "(", "Count", "(", "$", "classes", ...
Returns the rendered html markup @return string
[ "Returns", "the", "rendered", "html", "markup" ]
53a0e075977e7c56af0046b8c91406f417b7aad1
https://github.com/gorriecoe/silverstripe-htmltag/blob/53a0e075977e7c56af0046b8c91406f417b7aad1/src/view/HTMLTag.php#L205-L248
train
jaredtking/jaqb
src/ConnectionManager.php
ConnectionManager.get
public function get($id) { if (isset($this->connections[$id])) { return $this->connections[$id]; } if (!isset($this->config[$id])) { throw new JAQBException('No configuration or connection has been supplied for the ID "'.$id.'".'); } $this->connections[$id] = $this->buildFromConfig($this->config[$id], $id); return $this->connections[$id]; }
php
public function get($id) { if (isset($this->connections[$id])) { return $this->connections[$id]; } if (!isset($this->config[$id])) { throw new JAQBException('No configuration or connection has been supplied for the ID "'.$id.'".'); } $this->connections[$id] = $this->buildFromConfig($this->config[$id], $id); return $this->connections[$id]; }
[ "public", "function", "get", "(", "$", "id", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "connections", "[", "$", "id", "]", ")", ")", "{", "return", "$", "this", "->", "connections", "[", "$", "id", "]", ";", "}", "if", "(", "!", "...
Gets a database connection by ID. @param string $id @throws JAQBException if the connection does not exist @return QueryBuilder
[ "Gets", "a", "database", "connection", "by", "ID", "." ]
04a853b530fcc12a9863349d3d0da6377d1b9995
https://github.com/jaredtking/jaqb/blob/04a853b530fcc12a9863349d3d0da6377d1b9995/src/ConnectionManager.php#L65-L78
train
jaredtking/jaqb
src/ConnectionManager.php
ConnectionManager.getDefault
public function getDefault() { // get the memoized default if ($this->default) { return $this->get($this->default); } // no configurations available // check for existing connections if (0 === count($this->config)) { if (1 === count($this->connections)) { $this->default = array_keys($this->connections)[0]; return $this->get($this->default); } elseif (count($this->connections) > 1) { throw new JAQBException('Could not determine the default connection because multiple connections were available and the default has not been set.'); } throw new JAQBException('The default connection is not available because no configurations have been supplied.'); } // handle the case where there is a single configuration if (1 === count($this->config)) { $this->default = array_keys($this->config)[0]; return $this->get($this->default); } // handle multiple configurations foreach ($this->config as $k => $v) { if (array_value($v, 'default')) { $this->default = $k; return $this->get($this->default); } } throw new JAQBException('There is no default connection.'); }
php
public function getDefault() { // get the memoized default if ($this->default) { return $this->get($this->default); } // no configurations available // check for existing connections if (0 === count($this->config)) { if (1 === count($this->connections)) { $this->default = array_keys($this->connections)[0]; return $this->get($this->default); } elseif (count($this->connections) > 1) { throw new JAQBException('Could not determine the default connection because multiple connections were available and the default has not been set.'); } throw new JAQBException('The default connection is not available because no configurations have been supplied.'); } // handle the case where there is a single configuration if (1 === count($this->config)) { $this->default = array_keys($this->config)[0]; return $this->get($this->default); } // handle multiple configurations foreach ($this->config as $k => $v) { if (array_value($v, 'default')) { $this->default = $k; return $this->get($this->default); } } throw new JAQBException('There is no default connection.'); }
[ "public", "function", "getDefault", "(", ")", "{", "// get the memoized default", "if", "(", "$", "this", "->", "default", ")", "{", "return", "$", "this", "->", "get", "(", "$", "this", "->", "default", ")", ";", "}", "// no configurations available", "// c...
Gets the default database connection. @throws JAQBException if there is not a default connection @return QueryBuilder
[ "Gets", "the", "default", "database", "connection", "." ]
04a853b530fcc12a9863349d3d0da6377d1b9995
https://github.com/jaredtking/jaqb/blob/04a853b530fcc12a9863349d3d0da6377d1b9995/src/ConnectionManager.php#L87-L125
train
jaredtking/jaqb
src/ConnectionManager.php
ConnectionManager.add
public function add($id, QueryBuilder $connection) { if (isset($this->connections[$id])) { throw new InvalidArgumentException('A connection with the ID "'.$id.'" already exists.'); } $this->connections[$id] = $connection; $this->default = false; return $this; }
php
public function add($id, QueryBuilder $connection) { if (isset($this->connections[$id])) { throw new InvalidArgumentException('A connection with the ID "'.$id.'" already exists.'); } $this->connections[$id] = $connection; $this->default = false; return $this; }
[ "public", "function", "add", "(", "$", "id", ",", "QueryBuilder", "$", "connection", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "connections", "[", "$", "id", "]", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'A connection ...
Adds a connection. @param string $id @param QueryBuilder $connection @throws InvalidArgumentException if a connection with the given ID already exists @return $this
[ "Adds", "a", "connection", "." ]
04a853b530fcc12a9863349d3d0da6377d1b9995
https://github.com/jaredtking/jaqb/blob/04a853b530fcc12a9863349d3d0da6377d1b9995/src/ConnectionManager.php#L137-L147
train
jaredtking/jaqb
src/ConnectionManager.php
ConnectionManager.buildDsn
public function buildDsn(array $config, $id) { if (!isset($config['type'])) { throw new JAQBException('Missing connection type for configuration "'.$id.'"!'); } $dsn = $config['type'].':'; $params = []; foreach (self::$connectionParams as $j => $k) { if (isset($config[$j])) { $params[] = $k.'='.$config[$j]; } } $dsn .= implode(';', $params); return $dsn; }
php
public function buildDsn(array $config, $id) { if (!isset($config['type'])) { throw new JAQBException('Missing connection type for configuration "'.$id.'"!'); } $dsn = $config['type'].':'; $params = []; foreach (self::$connectionParams as $j => $k) { if (isset($config[$j])) { $params[] = $k.'='.$config[$j]; } } $dsn .= implode(';', $params); return $dsn; }
[ "public", "function", "buildDsn", "(", "array", "$", "config", ",", "$", "id", ")", "{", "if", "(", "!", "isset", "(", "$", "config", "[", "'type'", "]", ")", ")", "{", "throw", "new", "JAQBException", "(", "'Missing connection type for configuration \"'", ...
Builds a PDO DSN string from a JAQB connection configuration. @param array $config @param string $id configuration ID @throws JAQBException if the configuration is invalid @return string
[ "Builds", "a", "PDO", "DSN", "string", "from", "a", "JAQB", "connection", "configuration", "." ]
04a853b530fcc12a9863349d3d0da6377d1b9995
https://github.com/jaredtking/jaqb/blob/04a853b530fcc12a9863349d3d0da6377d1b9995/src/ConnectionManager.php#L188-L204
train
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.initializeUserSession
public function initializeUserSession(WebRequest $request, Response $response, User $user) { // If the session already has user data ... if ($request->getSessionData('userUuid') !== false) { $sessionToken = $request->getSessionData('userSessionToken'); $sessionTokenLifetime = $request->getSessionData('userSessionTokenLifetime'); // Cleanup the session $this->cleanupSession($request); // Save the old session token for some requests in the next 60 seconds if ($sessionToken !== false) { $request->setSessionData('oldUserSessionToken', $sessionToken); $request->setSessionData('oldUserSessionTokenLifetime', $sessionTokenLifetime); } } // Regenerate the session $this->regenerateSession($request); $sessionToken = md5($user->getUuid()) . '-' . md5(uniqid()); $sessionTokenLifeTime = time() + 300; $request->setSessionData('userUuid', $user->getUuid()); $request->setSessionData('userSessionToken', $sessionToken); $request->setSessionData('userSessionTokenLifetime', $sessionTokenLifeTime); setcookie($sessionToken, $sessionTokenLifeTime, 0, '/', '', $request->isSsl()); }
php
public function initializeUserSession(WebRequest $request, Response $response, User $user) { // If the session already has user data ... if ($request->getSessionData('userUuid') !== false) { $sessionToken = $request->getSessionData('userSessionToken'); $sessionTokenLifetime = $request->getSessionData('userSessionTokenLifetime'); // Cleanup the session $this->cleanupSession($request); // Save the old session token for some requests in the next 60 seconds if ($sessionToken !== false) { $request->setSessionData('oldUserSessionToken', $sessionToken); $request->setSessionData('oldUserSessionTokenLifetime', $sessionTokenLifetime); } } // Regenerate the session $this->regenerateSession($request); $sessionToken = md5($user->getUuid()) . '-' . md5(uniqid()); $sessionTokenLifeTime = time() + 300; $request->setSessionData('userUuid', $user->getUuid()); $request->setSessionData('userSessionToken', $sessionToken); $request->setSessionData('userSessionTokenLifetime', $sessionTokenLifeTime); setcookie($sessionToken, $sessionTokenLifeTime, 0, '/', '', $request->isSsl()); }
[ "public", "function", "initializeUserSession", "(", "WebRequest", "$", "request", ",", "Response", "$", "response", ",", "User", "$", "user", ")", "{", "// If the session already has user data ...", "if", "(", "$", "request", "->", "getSessionData", "(", "'userUuid'...
Initializes the user session @access public @param \Zepi\Turbo\Request\WebRequest $request @param \Zepi\Turbo\Response\Response $response @param \Zepi\Web\AccessControl\Entity\User $user
[ "Initializes", "the", "user", "session" ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L84-L112
train
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.reinitializeSession
public function reinitializeSession(Framework $framework, WebRequest $request, Response $response) { // Sets the correct name: session_name('ZTSM'); // Start the session session_start(); // If the session wasn't started before, we start it now... if ($request->getSessionData('sessionStarted') === false) { $this->startSession($request); } // Validate the session data $valid = $this->validateSessionData($request); // If the session not is valid we redirect to the start of everything if (!$valid) { $response->redirectTo(''); } // There is a 1% chance that we regenerate the session if (mt_rand(1, 100) <= 1) { $this->regenerateSession($request); } // Initialize the user session if ($request->getSessionData('userUuid') !== false) { $this->reinitializeUserSession($framework, $request, $response); } }
php
public function reinitializeSession(Framework $framework, WebRequest $request, Response $response) { // Sets the correct name: session_name('ZTSM'); // Start the session session_start(); // If the session wasn't started before, we start it now... if ($request->getSessionData('sessionStarted') === false) { $this->startSession($request); } // Validate the session data $valid = $this->validateSessionData($request); // If the session not is valid we redirect to the start of everything if (!$valid) { $response->redirectTo(''); } // There is a 1% chance that we regenerate the session if (mt_rand(1, 100) <= 1) { $this->regenerateSession($request); } // Initialize the user session if ($request->getSessionData('userUuid') !== false) { $this->reinitializeUserSession($framework, $request, $response); } }
[ "public", "function", "reinitializeSession", "(", "Framework", "$", "framework", ",", "WebRequest", "$", "request", ",", "Response", "$", "response", ")", "{", "// Sets the correct name:", "session_name", "(", "'ZTSM'", ")", ";", "// Start the session", "session_start...
Initializes the session @access public @param \Zepi\Turbo\Request\WebRequest $request @param \Zepi\Turbo\Response\Response $response
[ "Initializes", "the", "session" ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L121-L151
train
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.logoutUser
public function logoutUser(WebRequest $request, Response $response) { $this->cleanupSession($request); $request->removeSession(); }
php
public function logoutUser(WebRequest $request, Response $response) { $this->cleanupSession($request); $request->removeSession(); }
[ "public", "function", "logoutUser", "(", "WebRequest", "$", "request", ",", "Response", "$", "response", ")", "{", "$", "this", "->", "cleanupSession", "(", "$", "request", ")", ";", "$", "request", "->", "removeSession", "(", ")", ";", "}" ]
Logouts the logged in user @access public @param \Zepi\Turbo\Request\WebRequest $request @param \Zepi\Turbo\Response\Response $response
[ "Logouts", "the", "logged", "in", "user" ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L160-L165
train
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.reinitializeUserSession
protected function reinitializeUserSession(Framework $framework, WebRequest $request, Response $response) { $token = $request->getSessionData('userSessionToken'); $lifetime = $request->getSessionData('userSessionTokenLifetime'); list($notValid, $token, $lifetime, $userUuid) = $this->verifyToken($request, $token, $lifetime); // We do not load any user session because this session isn't // okey. Our session token is not set or the lifetime is invalid or expired. // This is maybe an expired session or a hijacking attack... if ($notValid) { $this->cleanupSession($request); $this->regenerateSession($request); return false; } // Load the user $user = $this->userManager->getUserForUuid($userUuid); // If the user is disabled we cannot initialize the session if (!$user->hasAccess('\\Global\\*') && $user->hasAccess('\\Global\\Disabled')) { return false; } // Generate a new session object $session = new Session($user, $token, $lifetime); $request->setSession($session); // Generate a new token if the lifetime expires soon... if ($lifetime - 30 < time()) { $this->initializeUserSession($request, $response, $user); } return true; }
php
protected function reinitializeUserSession(Framework $framework, WebRequest $request, Response $response) { $token = $request->getSessionData('userSessionToken'); $lifetime = $request->getSessionData('userSessionTokenLifetime'); list($notValid, $token, $lifetime, $userUuid) = $this->verifyToken($request, $token, $lifetime); // We do not load any user session because this session isn't // okey. Our session token is not set or the lifetime is invalid or expired. // This is maybe an expired session or a hijacking attack... if ($notValid) { $this->cleanupSession($request); $this->regenerateSession($request); return false; } // Load the user $user = $this->userManager->getUserForUuid($userUuid); // If the user is disabled we cannot initialize the session if (!$user->hasAccess('\\Global\\*') && $user->hasAccess('\\Global\\Disabled')) { return false; } // Generate a new session object $session = new Session($user, $token, $lifetime); $request->setSession($session); // Generate a new token if the lifetime expires soon... if ($lifetime - 30 < time()) { $this->initializeUserSession($request, $response, $user); } return true; }
[ "protected", "function", "reinitializeUserSession", "(", "Framework", "$", "framework", ",", "WebRequest", "$", "request", ",", "Response", "$", "response", ")", "{", "$", "token", "=", "$", "request", "->", "getSessionData", "(", "'userSessionToken'", ")", ";",...
Verifies the session tokens and the session token life time and loads the user for the session. @access protected @param \Zepi\Turbo\Framework $framework @param \Zepi\Turbo\Request\WebRequest $request @param \Zepi\Turbo\Response\Response $response @return boolean
[ "Verifies", "the", "session", "tokens", "and", "the", "session", "token", "life", "time", "and", "loads", "the", "user", "for", "the", "session", "." ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L177-L212
train
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.verifyToken
protected function verifyToken(WebRequest $request, $token, $lifetime) { $notValid = false; // Cookie does not exists - this is maybe a session hijacking attack if ($request->getCookieData($token) === false) { $notValid = true; } // Check for the old data if ($notValid && $request->getSessionData('oldUserSessionToken') !== false) { $token = $request->getSessionData('oldUserSessionToken'); $lifetime = $request->getSessionData('oldUserSessionTokenLifetime'); // Look for the old session token cookie... if ($request->getCookieData($token) === false) { $notValid = true; } } // Check the lifetime of the cookie and the session if (!$notValid && $request->getCookieData($token) != $lifetime) { $notValid = true; } // If the session token expired more than 30 minutes ago // the session isn't valid anymore if (!$notValid && $lifetime < time() - 1800) { $notValid = true; } $userUuid = $request->getSessionData('userUuid'); // If the given uuid doesn't exists, this session can't be valid if (!$notValid && !$this->userManager->hasUserForUuid($userUuid)) { $notValid = true; } return array($notValid, $token, $lifetime, $userUuid); }
php
protected function verifyToken(WebRequest $request, $token, $lifetime) { $notValid = false; // Cookie does not exists - this is maybe a session hijacking attack if ($request->getCookieData($token) === false) { $notValid = true; } // Check for the old data if ($notValid && $request->getSessionData('oldUserSessionToken') !== false) { $token = $request->getSessionData('oldUserSessionToken'); $lifetime = $request->getSessionData('oldUserSessionTokenLifetime'); // Look for the old session token cookie... if ($request->getCookieData($token) === false) { $notValid = true; } } // Check the lifetime of the cookie and the session if (!$notValid && $request->getCookieData($token) != $lifetime) { $notValid = true; } // If the session token expired more than 30 minutes ago // the session isn't valid anymore if (!$notValid && $lifetime < time() - 1800) { $notValid = true; } $userUuid = $request->getSessionData('userUuid'); // If the given uuid doesn't exists, this session can't be valid if (!$notValid && !$this->userManager->hasUserForUuid($userUuid)) { $notValid = true; } return array($notValid, $token, $lifetime, $userUuid); }
[ "protected", "function", "verifyToken", "(", "WebRequest", "$", "request", ",", "$", "token", ",", "$", "lifetime", ")", "{", "$", "notValid", "=", "false", ";", "// Cookie does not exists - this is maybe a session hijacking attack", "if", "(", "$", "request", "->",...
Verifies the given session token and lifetime @param \Zepi\Turbo\Request\WebRequest $request @param string $token @param string $lifetime @return array
[ "Verifies", "the", "given", "session", "token", "and", "lifetime" ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L222-L261
train
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.startSession
protected function startSession(WebRequest $request) { // Save the nonce base on the session $request->setSessionData('nonceBase', md5(uniqid())); // Save the ip address on the session $request->setSessionData('ipAddress', $_SERVER['REMOTE_ADDR']); // Save the user agent on the session if (isset($_SERVER['HTTP_USER_AGENT'])) { $request->setSessionData('userAgent', $_SERVER['HTTP_USER_AGENT']); } // Save the boolean that we started the session $request->setSessionData('sessionStarted', true); }
php
protected function startSession(WebRequest $request) { // Save the nonce base on the session $request->setSessionData('nonceBase', md5(uniqid())); // Save the ip address on the session $request->setSessionData('ipAddress', $_SERVER['REMOTE_ADDR']); // Save the user agent on the session if (isset($_SERVER['HTTP_USER_AGENT'])) { $request->setSessionData('userAgent', $_SERVER['HTTP_USER_AGENT']); } // Save the boolean that we started the session $request->setSessionData('sessionStarted', true); }
[ "protected", "function", "startSession", "(", "WebRequest", "$", "request", ")", "{", "// Save the nonce base on the session", "$", "request", "->", "setSessionData", "(", "'nonceBase'", ",", "md5", "(", "uniqid", "(", ")", ")", ")", ";", "// Save the ip address on ...
Starts the session and saves the base session informations. @access protected @param \Zepi\Turbo\Request\WebRequest $request
[ "Starts", "the", "session", "and", "saves", "the", "base", "session", "informations", "." ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L269-L284
train
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.cleanupSession
protected function cleanupSession(WebRequest $request) { $sessionToken = $request->getSessionData('userSessionToken'); setcookie($sessionToken, 0, time() - 60, '/', '', $request->isSsl()); $oldSessionToken = $request->getSessionData('oldUserSessionToken'); if ($oldSessionToken != '') { setcookie($oldSessionToken, 0, time() - 60, '/', '', $request->isSsl()); } $request->deleteSessionData('userUuid'); $request->deleteSessionData('userSessionToken'); $request->deleteSessionData('userSessionTokenLifetime'); $request->deleteSessionData('oldUserSessionToken'); $request->deleteSessionData('oldUserSessionTokenLifetime'); }
php
protected function cleanupSession(WebRequest $request) { $sessionToken = $request->getSessionData('userSessionToken'); setcookie($sessionToken, 0, time() - 60, '/', '', $request->isSsl()); $oldSessionToken = $request->getSessionData('oldUserSessionToken'); if ($oldSessionToken != '') { setcookie($oldSessionToken, 0, time() - 60, '/', '', $request->isSsl()); } $request->deleteSessionData('userUuid'); $request->deleteSessionData('userSessionToken'); $request->deleteSessionData('userSessionTokenLifetime'); $request->deleteSessionData('oldUserSessionToken'); $request->deleteSessionData('oldUserSessionTokenLifetime'); }
[ "protected", "function", "cleanupSession", "(", "WebRequest", "$", "request", ")", "{", "$", "sessionToken", "=", "$", "request", "->", "getSessionData", "(", "'userSessionToken'", ")", ";", "setcookie", "(", "$", "sessionToken", ",", "0", ",", "time", "(", ...
Removes all user and token data from the session @access protected @param \Zepi\Turbo\Request\WebRequest $request
[ "Removes", "all", "user", "and", "token", "data", "from", "the", "session" ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L292-L307
train
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.validateSessionData
protected function validateSessionData(WebRequest $request) { if ($request->getSessionData('isObsolete') && $request->getSessionData('maxLifetime') < time()) { return false; } return true; }
php
protected function validateSessionData(WebRequest $request) { if ($request->getSessionData('isObsolete') && $request->getSessionData('maxLifetime') < time()) { return false; } return true; }
[ "protected", "function", "validateSessionData", "(", "WebRequest", "$", "request", ")", "{", "if", "(", "$", "request", "->", "getSessionData", "(", "'isObsolete'", ")", "&&", "$", "request", "->", "getSessionData", "(", "'maxLifetime'", ")", "<", "time", "(",...
Validates the session. If the session is obsolete and the max lieftime is reached the function will return false, otherwise true. @access protected @param \Zepi\Turbo\Request\WebRequest $request @return boolean
[ "Validates", "the", "session", ".", "If", "the", "session", "is", "obsolete", "and", "the", "max", "lieftime", "is", "reached", "the", "function", "will", "return", "false", "otherwise", "true", "." ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L317-L324
train
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.regenerateSession
protected function regenerateSession(WebRequest $request) { // Let the old session expire... $request->setSessionData('isObsolete', true); $request->setSessionData('maxLifetime', time() + 60); // Regenerate the session id but don't delete the old one session_regenerate_id(false); // Get the new session id $newSessionId = session_id(); // Close both sessions to free them for other requests session_write_close(); // Start the session with the new id session_id($newSessionId); session_start(); // Delete the temporary session data $request->deleteSessionData('isObsolete'); $request->deleteSessionData('maxLifetime'); }
php
protected function regenerateSession(WebRequest $request) { // Let the old session expire... $request->setSessionData('isObsolete', true); $request->setSessionData('maxLifetime', time() + 60); // Regenerate the session id but don't delete the old one session_regenerate_id(false); // Get the new session id $newSessionId = session_id(); // Close both sessions to free them for other requests session_write_close(); // Start the session with the new id session_id($newSessionId); session_start(); // Delete the temporary session data $request->deleteSessionData('isObsolete'); $request->deleteSessionData('maxLifetime'); }
[ "protected", "function", "regenerateSession", "(", "WebRequest", "$", "request", ")", "{", "// Let the old session expire...", "$", "request", "->", "setSessionData", "(", "'isObsolete'", ",", "true", ")", ";", "$", "request", "->", "setSessionData", "(", "'maxLifet...
Regenerates the session. It makes the old session id obsolete and generates a new session id. @access protected @param \Zepi\Turbo\Request\WebRequest $request
[ "Regenerates", "the", "session", ".", "It", "makes", "the", "old", "session", "id", "obsolete", "and", "generates", "a", "new", "session", "id", "." ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L333-L355
train
joffreydemetz/utilities
src/Timer/Timer.php
Timer.addTimer
public function addTimer(Timer $timer) { if ( false === ($step=$this->currentStep()) ){ throw new \Exception('No current step'); } $step->setTimer($timer); return $this; }
php
public function addTimer(Timer $timer) { if ( false === ($step=$this->currentStep()) ){ throw new \Exception('No current step'); } $step->setTimer($timer); return $this; }
[ "public", "function", "addTimer", "(", "Timer", "$", "timer", ")", "{", "if", "(", "false", "===", "(", "$", "step", "=", "$", "this", "->", "currentStep", "(", ")", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'No current step'", ")", ";"...
Add timer to current step
[ "Add", "timer", "to", "current", "step" ]
aa62a178bc463c10067a2ff2992d39c6f0037b9f
https://github.com/joffreydemetz/utilities/blob/aa62a178bc463c10067a2ff2992d39c6f0037b9f/src/Timer/Timer.php#L161-L169
train
joffreydemetz/utilities
src/Timer/Timer.php
Timer.addMessage
public function addMessage(string $message) { if ( false === ($step=$this->currentStep()) ){ throw new \Exception('No current step'); } $step->addMessage($message); return $this; }
php
public function addMessage(string $message) { if ( false === ($step=$this->currentStep()) ){ throw new \Exception('No current step'); } $step->addMessage($message); return $this; }
[ "public", "function", "addMessage", "(", "string", "$", "message", ")", "{", "if", "(", "false", "===", "(", "$", "step", "=", "$", "this", "->", "currentStep", "(", ")", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'No current step'", ")", ...
Add message to current step
[ "Add", "message", "to", "current", "step" ]
aa62a178bc463c10067a2ff2992d39c6f0037b9f
https://github.com/joffreydemetz/utilities/blob/aa62a178bc463c10067a2ff2992d39c6f0037b9f/src/Timer/Timer.php#L174-L182
train
nattreid/app-manager
src/Helpers/Logs.php
Logs.getFile
public function getFile(string $id): ?FileResponse { $log = $this->getLog($id); if ($log) { $file = $log->name; if (Strings::endsWith($file, '.html')) { $contentType = 'text/html'; } else { $contentType = 'text/plain'; } return new FileResponse($this->path . $file, $file, $contentType, false); } return null; }
php
public function getFile(string $id): ?FileResponse { $log = $this->getLog($id); if ($log) { $file = $log->name; if (Strings::endsWith($file, '.html')) { $contentType = 'text/html'; } else { $contentType = 'text/plain'; } return new FileResponse($this->path . $file, $file, $contentType, false); } return null; }
[ "public", "function", "getFile", "(", "string", "$", "id", ")", ":", "?", "FileResponse", "{", "$", "log", "=", "$", "this", "->", "getLog", "(", "$", "id", ")", ";", "if", "(", "$", "log", ")", "{", "$", "file", "=", "$", "log", "->", "name", ...
Vrati soubor ke stazeni @param string $id @return FileResponse|null @throws BadRequestException
[ "Vrati", "soubor", "ke", "stazeni" ]
7821d09a0b3e58ba9c6eb81d44e35aacce55de75
https://github.com/nattreid/app-manager/blob/7821d09a0b3e58ba9c6eb81d44e35aacce55de75/src/Helpers/Logs.php#L117-L130
train
bearframework/emails-addon
classes/Emails/Email/Recipients.php
Recipients.add
public function add(string $email, string $name = null): void { $recipient = $this->make(); $recipient->email = $email; if ($name !== null) { $recipient->name = $name; } $this->set($recipient); }
php
public function add(string $email, string $name = null): void { $recipient = $this->make(); $recipient->email = $email; if ($name !== null) { $recipient->name = $name; } $this->set($recipient); }
[ "public", "function", "add", "(", "string", "$", "email", ",", "string", "$", "name", "=", "null", ")", ":", "void", "{", "$", "recipient", "=", "$", "this", "->", "make", "(", ")", ";", "$", "recipient", "->", "email", "=", "$", "email", ";", "i...
Add a recipient. @param string $email The recipient email address. @param string|null $name The recipient name.
[ "Add", "a", "recipient", "." ]
43a68c47e2b1d231dc69a324249ff5f6827201ca
https://github.com/bearframework/emails-addon/blob/43a68c47e2b1d231dc69a324249ff5f6827201ca/classes/Emails/Email/Recipients.php#L34-L42
train
RowlandOti/ooglee-core
src/OoGlee/Domain/Providers/HashingServiceProvider.php
HashingServiceProvider.register
public function register() { // Bind the returned class to the namespace 'Ooglee\Domain\Contracts\IHashingService' $this->app->singleton('Ooglee\Domain\Contracts\IHashingService', function($app) { //$hasher = $this->app['config']['ioc.app.hasher']; $hasher = \Config::get('ooglee::ioc.app.hasher'); //return new HashingService(new HasherExample()); return new HashingService(new $hasher); }); }
php
public function register() { // Bind the returned class to the namespace 'Ooglee\Domain\Contracts\IHashingService' $this->app->singleton('Ooglee\Domain\Contracts\IHashingService', function($app) { //$hasher = $this->app['config']['ioc.app.hasher']; $hasher = \Config::get('ooglee::ioc.app.hasher'); //return new HashingService(new HasherExample()); return new HashingService(new $hasher); }); }
[ "public", "function", "register", "(", ")", "{", "// Bind the returned class to the namespace 'Ooglee\\Domain\\Contracts\\IHashingService'\r", "$", "this", "->", "app", "->", "singleton", "(", "'Ooglee\\Domain\\Contracts\\IHashingService'", ",", "function", "(", "$", "app", "...
Registers the service in the IoC Container
[ "Registers", "the", "service", "in", "the", "IoC", "Container" ]
6cd8a8e58e37749e1c58e99063ea72c9d37a98bc
https://github.com/RowlandOti/ooglee-core/blob/6cd8a8e58e37749e1c58e99063ea72c9d37a98bc/src/OoGlee/Domain/Providers/HashingServiceProvider.php#L15-L25
train
cubiche/cqt
src/Cubiche/Tools/CodeQualityTool.php
CodeQualityTool.checkComposer
private function checkComposer() { $composerJsonDetected = false; $composerLockDetected = false; foreach (GitUtils::extractCommitedFiles() as $file) { if ($file === 'composer.json') { $composerJsonDetected = true; } if ($file === 'composer.lock') { $composerLockDetected = true; } } if ($composerJsonDetected && !$composerLockDetected) { $this->output->writeln( '<bg=yellow;fg=black> composer.lock must be commited if composer.json is modified! </bg=yellow;fg=black>' ); } }
php
private function checkComposer() { $composerJsonDetected = false; $composerLockDetected = false; foreach (GitUtils::extractCommitedFiles() as $file) { if ($file === 'composer.json') { $composerJsonDetected = true; } if ($file === 'composer.lock') { $composerLockDetected = true; } } if ($composerJsonDetected && !$composerLockDetected) { $this->output->writeln( '<bg=yellow;fg=black> composer.lock must be commited if composer.json is modified! </bg=yellow;fg=black>' ); } }
[ "private", "function", "checkComposer", "(", ")", "{", "$", "composerJsonDetected", "=", "false", ";", "$", "composerLockDetected", "=", "false", ";", "foreach", "(", "GitUtils", "::", "extractCommitedFiles", "(", ")", "as", "$", "file", ")", "{", "if", "(",...
Check composer.json and composer.lock files
[ "Check", "composer", ".", "json", "and", "composer", ".", "lock", "files" ]
5cae76821df0b3ad442f629c62d39fe8e455c8c7
https://github.com/cubiche/cqt/blob/5cae76821df0b3ad442f629c62d39fe8e455c8c7/src/Cubiche/Tools/CodeQualityTool.php#L96-L115
train
helionogueir/foldercreator
core/folder/Delete.class.php
Delete.rm
public function rm(string $directory): bool { if (is_dir($directory)) { foreach (new DirectoryIterator(Path::replaceOSSeparator($directory)) as $fileInfo) { if (!$fileInfo->isDot()) { if ($fileInfo->isDir()) { $this->rm($fileInfo->getPathname()); @rmdir($fileInfo->getPathname()); } else if ($fileInfo->isFile()) { @unlink($fileInfo->getPathname()); } } } @rmdir($directory); } return !file_exists($directory); }
php
public function rm(string $directory): bool { if (is_dir($directory)) { foreach (new DirectoryIterator(Path::replaceOSSeparator($directory)) as $fileInfo) { if (!$fileInfo->isDot()) { if ($fileInfo->isDir()) { $this->rm($fileInfo->getPathname()); @rmdir($fileInfo->getPathname()); } else if ($fileInfo->isFile()) { @unlink($fileInfo->getPathname()); } } } @rmdir($directory); } return !file_exists($directory); }
[ "public", "function", "rm", "(", "string", "$", "directory", ")", ":", "bool", "{", "if", "(", "is_dir", "(", "$", "directory", ")", ")", "{", "foreach", "(", "new", "DirectoryIterator", "(", "Path", "::", "replaceOSSeparator", "(", "$", "directory", ")"...
- Delete directory and sub directory recursive @param string $directory Path of directory @return bool Return if directory to be remove
[ "-", "Delete", "directory", "and", "sub", "directory", "recursive" ]
64bf53c924efec4e581d4acbe183e4a004cd4cae
https://github.com/helionogueir/foldercreator/blob/64bf53c924efec4e581d4acbe183e4a004cd4cae/core/folder/Delete.class.php#L20-L35
train
xuzhenjun130/X-framework
Controller.php
Controller.getLayoutPath
public function getLayoutPath() { $ref = new \ReflectionClass($this); return dirname(dirname($ref->getFileName())) . '/views/layouts/' . $this->layout . '.php'; }
php
public function getLayoutPath() { $ref = new \ReflectionClass($this); return dirname(dirname($ref->getFileName())) . '/views/layouts/' . $this->layout . '.php'; }
[ "public", "function", "getLayoutPath", "(", ")", "{", "$", "ref", "=", "new", "\\", "ReflectionClass", "(", "$", "this", ")", ";", "return", "dirname", "(", "dirname", "(", "$", "ref", "->", "getFileName", "(", ")", ")", ")", ".", "'/views/layouts/'", ...
get layouts path @return string @throws \ReflectionException
[ "get", "layouts", "path" ]
07b91c572d7fff79c46e9fb45389f03a6d53725f
https://github.com/xuzhenjun130/X-framework/blob/07b91c572d7fff79c46e9fb45389f03a6d53725f/Controller.php#L102-L106
train