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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
andyburton/Sonic-Framework | src/Model.php | Model.resetPK | public function resetPK ($val = FALSE)
{
if ($val === FALSE)
{
$this->reset (static::$pk);
}
else
{
$this->attributeValues[static::$pk] = $val;
}
} | php | public function resetPK ($val = FALSE)
{
if ($val === FALSE)
{
$this->reset (static::$pk);
}
else
{
$this->attributeValues[static::$pk] = $val;
}
} | [
"public",
"function",
"resetPK",
"(",
"$",
"val",
"=",
"FALSE",
")",
"{",
"if",
"(",
"$",
"val",
"===",
"FALSE",
")",
"{",
"$",
"this",
"->",
"reset",
"(",
"static",
"::",
"$",
"pk",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"attributeValues... | Reset the primary key to default or set to a specific value
@param mixed $val Value | [
"Reset",
"the",
"primary",
"key",
"to",
"default",
"or",
"set",
"to",
"a",
"specific",
"value"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L561-L573 | train |
andyburton/Sonic-Framework | src/Model.php | Model.cast | public function cast ($name, $val)
{
// Ignore if value is null
if (is_null ($val))
{
return $val;
}
// Cast value based upon attribute datatype
switch (@static::$attributes[$name]['type'])
{
case self::TYPE_INT:
$val = (int)$val;
break;
case self::TYPE_STRING:
$v... | php | public function cast ($name, $val)
{
// Ignore if value is null
if (is_null ($val))
{
return $val;
}
// Cast value based upon attribute datatype
switch (@static::$attributes[$name]['type'])
{
case self::TYPE_INT:
$val = (int)$val;
break;
case self::TYPE_STRING:
$v... | [
"public",
"function",
"cast",
"(",
"$",
"name",
",",
"$",
"val",
")",
"{",
"// Ignore if value is null",
"if",
"(",
"is_null",
"(",
"$",
"val",
")",
")",
"{",
"return",
"$",
"val",
";",
"}",
"// Cast value based upon attribute datatype",
"switch",
"(",
"@",
... | Cast a value for an attribute datatype
@param string $name Attribute name
@param mixed $val Value to cast
@return mixed | [
"Cast",
"a",
"value",
"for",
"an",
"attribute",
"datatype"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L583-L624 | train |
andyburton/Sonic-Framework | src/Model.php | Model.create | public function create ($exclude = array (), &$db = FALSE)
{
// Get columns and values
$create = $this->createColumnsAndValues ($exclude);
// Get database master for write
if ($db === FALSE)
{
$db =& $this->getDbMaster ();
}
// Prepare query
$query = $db->prepare ('
INSERT INTO `... | php | public function create ($exclude = array (), &$db = FALSE)
{
// Get columns and values
$create = $this->createColumnsAndValues ($exclude);
// Get database master for write
if ($db === FALSE)
{
$db =& $this->getDbMaster ();
}
// Prepare query
$query = $db->prepare ('
INSERT INTO `... | [
"public",
"function",
"create",
"(",
"$",
"exclude",
"=",
"array",
"(",
")",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Get columns and values",
"$",
"create",
"=",
"$",
"this",
"->",
"createColumnsAndValues",
"(",
"$",
"exclude",
")",
";",
"// Get... | Create object in the database
@param array $exclude Attributes not to set
@param \PDO $db Database connection to use, default to master resource
@return boolean | [
"Create",
"object",
"in",
"the",
"database"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L634-L686 | train |
andyburton/Sonic-Framework | src/Model.php | Model.createOrUpdate | public function createOrUpdate ($update, $exclude = array (), &$db = FALSE)
{
// Get columns and values
$create = $this->createColumnsAndValues ($exclude);
// Generate update values
$updateVals = NULL;
foreach ($update as $column => $value)
{
// Add column
$updateVals .= ', `'... | php | public function createOrUpdate ($update, $exclude = array (), &$db = FALSE)
{
// Get columns and values
$create = $this->createColumnsAndValues ($exclude);
// Generate update values
$updateVals = NULL;
foreach ($update as $column => $value)
{
// Add column
$updateVals .= ', `'... | [
"public",
"function",
"createOrUpdate",
"(",
"$",
"update",
",",
"$",
"exclude",
"=",
"array",
"(",
")",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Get columns and values",
"$",
"create",
"=",
"$",
"this",
"->",
"createColumnsAndValues",
"(",
"$",
... | Create or update an object in the database if it already exists
@param array $update Values to update
@param array $exclude Attributes not to set in create
@param \PDO $db Database connection to use, default to master resource
@return boolean | [
"Create",
"or",
"update",
"an",
"object",
"in",
"the",
"database",
"if",
"it",
"already",
"exists"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L697-L776 | train |
andyburton/Sonic-Framework | src/Model.php | Model.createColumnsAndValues | private function createColumnsAndValues (&$exclude)
{
// If there is no primary key value exclude it (i.e assume auto increment)
if (!$this->attributeHasValue (static::$pk))
{
$exclude[] = static::$pk;
}
// Set column and value variables
$columns = NULL;
$values = NULL;
// Loop through... | php | private function createColumnsAndValues (&$exclude)
{
// If there is no primary key value exclude it (i.e assume auto increment)
if (!$this->attributeHasValue (static::$pk))
{
$exclude[] = static::$pk;
}
// Set column and value variables
$columns = NULL;
$values = NULL;
// Loop through... | [
"private",
"function",
"createColumnsAndValues",
"(",
"&",
"$",
"exclude",
")",
"{",
"// If there is no primary key value exclude it (i.e assume auto increment)",
"if",
"(",
"!",
"$",
"this",
"->",
"attributeHasValue",
"(",
"static",
"::",
"$",
"pk",
")",
")",
"{",
... | Generate create query columns and values
@param array $exclude Attribute exclusion array
@return array ('columns', 'values') | [
"Generate",
"create",
"query",
"columns",
"and",
"values"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L785-L859 | train |
andyburton/Sonic-Framework | src/Model.php | Model.transformValue | private function transformValue ($name, $attribute, &$exclude)
{
// If an attribute can accept NULL and it's value is '' then NULL will be set
$value = $this->iget ($name);
if (is_null ($value) || (isset ($attribute['null']) && $attribute['null'] && $value === ''))
{
$this->iset ($name, NULL);
$valu... | php | private function transformValue ($name, $attribute, &$exclude)
{
// If an attribute can accept NULL and it's value is '' then NULL will be set
$value = $this->iget ($name);
if (is_null ($value) || (isset ($attribute['null']) && $attribute['null'] && $value === ''))
{
$this->iset ($name, NULL);
$valu... | [
"private",
"function",
"transformValue",
"(",
"$",
"name",
",",
"$",
"attribute",
",",
"&",
"$",
"exclude",
")",
"{",
"// If an attribute can accept NULL and it's value is '' then NULL will be set",
"$",
"value",
"=",
"$",
"this",
"->",
"iget",
"(",
"$",
"name",
"... | Apply any attribute value transformations for SQL query
@param string $name Attribute name
@param array $attribute Attribute property array
@param array $exclude Attribute exclusion array
@return mixed | [
"Apply",
"any",
"attribute",
"value",
"transformations",
"for",
"SQL",
"query"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L870-L916 | train |
andyburton/Sonic-Framework | src/Model.php | Model.bindAttributes | private function bindAttributes (&$query, $exclude = array ())
{
// Loop through attributes
foreach (array_keys (static::$attributes) as $name)
{
// If we're excluding the attribute then move on
if (in_array ($name, $exclude))
{
continue;
}
// Bind paramater
$query->bi... | php | private function bindAttributes (&$query, $exclude = array ())
{
// Loop through attributes
foreach (array_keys (static::$attributes) as $name)
{
// If we're excluding the attribute then move on
if (in_array ($name, $exclude))
{
continue;
}
// Bind paramater
$query->bi... | [
"private",
"function",
"bindAttributes",
"(",
"&",
"$",
"query",
",",
"$",
"exclude",
"=",
"array",
"(",
")",
")",
"{",
"// Loop through attributes",
"foreach",
"(",
"array_keys",
"(",
"static",
"::",
"$",
"attributes",
")",
"as",
"$",
"name",
")",
"{",
... | Bind object attribute values to the query
@param \PDOStatement $query Query object to bind values to
@param array $exclude Attributes to exclude
@return void | [
"Bind",
"object",
"attribute",
"values",
"to",
"the",
"query"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L926-L947 | train |
andyburton/Sonic-Framework | src/Model.php | Model.executeCreateUpdateQuery | private function executeCreateUpdateQuery (&$query)
{
// Execute
try
{
$query->execute ();
return TRUE;
}
catch (\PDOException $e)
{
// Catch some errors
switch ($e->getCode ())
{
// Duplicate Key
case 23000:
// Get attribute name and set error
i... | php | private function executeCreateUpdateQuery (&$query)
{
// Execute
try
{
$query->execute ();
return TRUE;
}
catch (\PDOException $e)
{
// Catch some errors
switch ($e->getCode ())
{
// Duplicate Key
case 23000:
// Get attribute name and set error
i... | [
"private",
"function",
"executeCreateUpdateQuery",
"(",
"&",
"$",
"query",
")",
"{",
"// Execute",
"try",
"{",
"$",
"query",
"->",
"execute",
"(",
")",
";",
"return",
"TRUE",
";",
"}",
"catch",
"(",
"\\",
"PDOException",
"$",
"e",
")",
"{",
"// Catch som... | Execute create or update query and cope with an exception
@param \PDOStatement $query Query object to bind values to
@return boolean
@throws PDOException | [
"Execute",
"create",
"or",
"update",
"query",
"and",
"cope",
"with",
"an",
"exception"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L957-L1007 | train |
andyburton/Sonic-Framework | src/Model.php | Model.read | public function read ($pkValue = FALSE, &$db = FALSE)
{
try
{
// If there is a key value passed set it
if ($pkValue !== FALSE)
{
$this->iset (static::$pk, $pkValue);
}
// Get database slave for read
if ($db === FALSE)
{
$db =& $this->getDbSlave ();
}
// Prepare quer... | php | public function read ($pkValue = FALSE, &$db = FALSE)
{
try
{
// If there is a key value passed set it
if ($pkValue !== FALSE)
{
$this->iset (static::$pk, $pkValue);
}
// Get database slave for read
if ($db === FALSE)
{
$db =& $this->getDbSlave ();
}
// Prepare quer... | [
"public",
"function",
"read",
"(",
"$",
"pkValue",
"=",
"FALSE",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"try",
"{",
"// If there is a key value passed set it",
"if",
"(",
"$",
"pkValue",
"!==",
"FALSE",
")",
"{",
"$",
"this",
"->",
"iset",
"(",
"... | Read an object from the database, populating the object attributes
@param mixed $pkValue Primary key value
@param \PDO $db Database connection to use, default to slave resource
@return boolean | [
"Read",
"an",
"object",
"from",
"the",
"database",
"populating",
"the",
"object",
"attributes"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1017-L1089 | train |
andyburton/Sonic-Framework | src/Model.php | Model.readAttribute | public function readAttribute ($name)
{
$this->iset ($name, $this->getValue (array (
'select' => $name,
'where' => array (array (static::$pk, $this->iget (static::$pk)))
)));
} | php | public function readAttribute ($name)
{
$this->iset ($name, $this->getValue (array (
'select' => $name,
'where' => array (array (static::$pk, $this->iget (static::$pk)))
)));
} | [
"public",
"function",
"readAttribute",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"iset",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"getValue",
"(",
"array",
"(",
"'select'",
"=>",
"$",
"name",
",",
"'where'",
"=>",
"array",
"(",
"array",
"(",
... | Read and set a single object attribute from the database
@param string $name Attribute name
@return void | [
"Read",
"and",
"set",
"a",
"single",
"object",
"attribute",
"from",
"the",
"database"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1098-L1104 | train |
andyburton/Sonic-Framework | src/Model.php | Model.update | public function update ($exclude = array (), &$db = FALSE)
{
// Get database master for write
if ($db === FALSE)
{
$db =& $this->getDbMaster ();
}
// Changelog
$old = FALSE;
if ($this->changelog ('update'))
{
$old = static::_Read ($this->get (static::$pk), $db);
}
// Exclude t... | php | public function update ($exclude = array (), &$db = FALSE)
{
// Get database master for write
if ($db === FALSE)
{
$db =& $this->getDbMaster ();
}
// Changelog
$old = FALSE;
if ($this->changelog ('update'))
{
$old = static::_Read ($this->get (static::$pk), $db);
}
// Exclude t... | [
"public",
"function",
"update",
"(",
"$",
"exclude",
"=",
"array",
"(",
")",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Get database master for write",
"if",
"(",
"$",
"db",
"===",
"FALSE",
")",
"{",
"$",
"db",
"=",
"&",
"$",
"this",
"->",
"g... | Update an object in the database
@param array $exclude Attributes not to update
@param \PDO $db Database connection to use, default to master resource
@return boolean | [
"Update",
"an",
"object",
"in",
"the",
"database"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1114-L1219 | train |
andyburton/Sonic-Framework | src/Model.php | Model.hookTransactions | public function hookTransactions (Resource\Db &$parent, Resource\Db &$child = NULL)
{
// Use default object database resource if none is specified
if (!$child)
{
$child =& $this->getResource ('db');
}
/**
* We only want to create the hook and begin a transaction on the database
* if a trans... | php | public function hookTransactions (Resource\Db &$parent, Resource\Db &$child = NULL)
{
// Use default object database resource if none is specified
if (!$child)
{
$child =& $this->getResource ('db');
}
/**
* We only want to create the hook and begin a transaction on the database
* if a trans... | [
"public",
"function",
"hookTransactions",
"(",
"Resource",
"\\",
"Db",
"&",
"$",
"parent",
",",
"Resource",
"\\",
"Db",
"&",
"$",
"child",
"=",
"NULL",
")",
"{",
"// Use default object database resource if none is specified",
"if",
"(",
"!",
"$",
"child",
")",
... | Hook any database queries into another database transaction
so that the queries are commited and rolled back at the same point
@param \Sonic\Resource\Db $parent Parent database
This is the database resource that is hooked and passes transaction state to the child database
@param \Sonic\Resource\Db $child Child database... | [
"Hook",
"any",
"database",
"queries",
"into",
"another",
"database",
"transaction",
"so",
"that",
"the",
"queries",
"are",
"commited",
"and",
"rolled",
"back",
"at",
"the",
"same",
"point"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1449-L1469 | train |
andyburton/Sonic-Framework | src/Model.php | Model.toXML | public function toXML ($attributes = FALSE)
{
// Set class name for the elements
// Remove the Sonic\Model prefix and convert namespace \ to _
$class = str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
// Create DOMDocument
$doc = new \DOMDocument ('1.0'... | php | public function toXML ($attributes = FALSE)
{
// Set class name for the elements
// Remove the Sonic\Model prefix and convert namespace \ to _
$class = str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
// Create DOMDocument
$doc = new \DOMDocument ('1.0'... | [
"public",
"function",
"toXML",
"(",
"$",
"attributes",
"=",
"FALSE",
")",
"{",
"// Set class name for the elements",
"// Remove the Sonic\\Model prefix and convert namespace \\ to _",
"$",
"class",
"=",
"str_replace",
"(",
"'\\\\'",
",",
"'_'",
",",
"str_replace",
"(",
... | Return a DOM tree with object attributes
@param array|boolean $attributes Attributes to include, default to false i.e all attributes
@return \DOMDocument|boolean | [
"Return",
"a",
"DOM",
"tree",
"with",
"object",
"attributes"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1478-L1510 | train |
andyburton/Sonic-Framework | src/Model.php | Model.toJSON | public function toJSON ($attributes = FALSE, $addClass = FALSE)
{
// Get array
$arr = $this->toArray ($attributes);
// Add the class name if required
if ($addClass)
{
$arr['class'] = str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
}
// Retu... | php | public function toJSON ($attributes = FALSE, $addClass = FALSE)
{
// Get array
$arr = $this->toArray ($attributes);
// Add the class name if required
if ($addClass)
{
$arr['class'] = str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
}
// Retu... | [
"public",
"function",
"toJSON",
"(",
"$",
"attributes",
"=",
"FALSE",
",",
"$",
"addClass",
"=",
"FALSE",
")",
"{",
"// Get array",
"$",
"arr",
"=",
"$",
"this",
"->",
"toArray",
"(",
"$",
"attributes",
")",
";",
"// Add the class name if required",
"if",
... | Return a JSON encoded string with object attributes
@param array|boolean $attributes Attributes to include, default to false i.e all attributes
@param boolean $addClass Whether to add the class name to each exported object
@return object|boolean | [
"Return",
"a",
"JSON",
"encoded",
"string",
"with",
"object",
"attributes"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1520-L1538 | train |
andyburton/Sonic-Framework | src/Model.php | Model.fromArray | public function fromArray ($attributes, $removeClass = FALSE, $validate = TRUE, $required = array (), $valid = array ())
{
// Remove class prefix
if ($removeClass)
{
// Set attributes to set
$arr = array ();
// Get class name
$class = strtolower ($this->getClass ());
// Loop through ... | php | public function fromArray ($attributes, $removeClass = FALSE, $validate = TRUE, $required = array (), $valid = array ())
{
// Remove class prefix
if ($removeClass)
{
// Set attributes to set
$arr = array ();
// Get class name
$class = strtolower ($this->getClass ());
// Loop through ... | [
"public",
"function",
"fromArray",
"(",
"$",
"attributes",
",",
"$",
"removeClass",
"=",
"FALSE",
",",
"$",
"validate",
"=",
"TRUE",
",",
"$",
"required",
"=",
"array",
"(",
")",
",",
"$",
"valid",
"=",
"array",
"(",
")",
")",
"{",
"// Remove class pre... | Populate object attributes from an array
@param array $attributes Attributes array
@param boolean $removeClass Remove class prefix from the attribute name
@param boolean $validate Validate attributes during set
@param array $required Required attributes
@param array $valid Valid attributes to set
@return void | [
"Populate",
"object",
"attributes",
"from",
"an",
"array"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1738-L1840 | train |
andyburton/Sonic-Framework | src/Model.php | Model.getChildren | public function getChildren ($class, $recursive = FALSE, $index = FALSE, $key = FALSE, $params = array ())
{
// Get children
$children = self::_getChildren ($class, $this->iget (self::$pk), $recursive, $key, $params);
// If we want the indexes
if ($index)
{
$children = static::_getChildrenInde... | php | public function getChildren ($class, $recursive = FALSE, $index = FALSE, $key = FALSE, $params = array ())
{
// Get children
$children = self::_getChildren ($class, $this->iget (self::$pk), $recursive, $key, $params);
// If we want the indexes
if ($index)
{
$children = static::_getChildrenInde... | [
"public",
"function",
"getChildren",
"(",
"$",
"class",
",",
"$",
"recursive",
"=",
"FALSE",
",",
"$",
"index",
"=",
"FALSE",
",",
"$",
"key",
"=",
"FALSE",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"// Get children",
"$",
"children",
"="... | Return child objects matching class type
@param string $class Child class type
@param boolean $recursive Whether to load childrens children.
This will create an object attribute called 'children' on all objects
@param boolean $index Return indexed child array rather than object array
@param string $key Attribute to use... | [
"Return",
"child",
"objects",
"matching",
"class",
"type"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1893-L1909 | train |
andyburton/Sonic-Framework | src/Model.php | Model.getValue | public function getValue ($params, $fetchMode = \PDO::FETCH_ASSOC, &$db = FALSE)
{
// Get database slave for read
if ($db === FALSE)
{
$db =& self::_getDbSlave ();
}
// Set table
$params['from'] = '`' . static::$dbTable . '`';
// Return value
return $db->getValue ($params, $fetchMode);
... | php | public function getValue ($params, $fetchMode = \PDO::FETCH_ASSOC, &$db = FALSE)
{
// Get database slave for read
if ($db === FALSE)
{
$db =& self::_getDbSlave ();
}
// Set table
$params['from'] = '`' . static::$dbTable . '`';
// Return value
return $db->getValue ($params, $fetchMode);
... | [
"public",
"function",
"getValue",
"(",
"$",
"params",
",",
"$",
"fetchMode",
"=",
"\\",
"PDO",
"::",
"FETCH_ASSOC",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Get database slave for read",
"if",
"(",
"$",
"db",
"===",
"FALSE",
")",
"{",
"$",
"db"... | Return a single row
@param array $params Parameter array
@param int $fetchMode PDO fetch mode, default to assoc
@param \PDO $db Database connection to use, default to slave resource
@return mixed | [
"Return",
"a",
"single",
"row"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L1920-L1938 | train |
andyburton/Sonic-Framework | src/Model.php | Model.& | public function &getResource ($name)
{
// If the resource is not set
if (!isset ($this->resources[$name]))
{
// Return FALSE
$bln = FALSE;
return $bln;
}
// Return resource reference
return $this->resources[$name];
} | php | public function &getResource ($name)
{
// If the resource is not set
if (!isset ($this->resources[$name]))
{
// Return FALSE
$bln = FALSE;
return $bln;
}
// Return resource reference
return $this->resources[$name];
} | [
"public",
"function",
"&",
"getResource",
"(",
"$",
"name",
")",
"{",
"// If the resource is not set",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"resources",
"[",
"$",
"name",
"]",
")",
")",
"{",
"// Return FALSE",
"$",
"bln",
"=",
"FALSE",
";",
... | Return a class resource reference
@param string $name Resource name
@return object|boolean | [
"Return",
"a",
"class",
"resource",
"reference"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2053-L2072 | train |
andyburton/Sonic-Framework | src/Model.php | Model.setResource | public function setResource ($name, $resource)
{
// Get the resource
$obj =& Sonic::getResource ($resource);
if (!$obj)
{
return FALSE;
}
// Set resource object
$this->setResourceObj ($name, $obj);
// Return
return TRUE;
} | php | public function setResource ($name, $resource)
{
// Get the resource
$obj =& Sonic::getResource ($resource);
if (!$obj)
{
return FALSE;
}
// Set resource object
$this->setResourceObj ($name, $obj);
// Return
return TRUE;
} | [
"public",
"function",
"setResource",
"(",
"$",
"name",
",",
"$",
"resource",
")",
"{",
"// Get the resource",
"$",
"obj",
"=",
"&",
"Sonic",
"::",
"getResource",
"(",
"$",
"resource",
")",
";",
"if",
"(",
"!",
"$",
"obj",
")",
"{",
"return",
"FALSE",
... | Set an internal resource from a framework resource
@param string $name Resource name
@param string|array $resource Framework resource referece
@return boolean | [
"Set",
"an",
"internal",
"resource",
"from",
"a",
"framework",
"resource"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2082-L2102 | train |
andyburton/Sonic-Framework | src/Model.php | Model.setResourceObj | public function setResourceObj ($name, &$resource)
{
// Set the resource
$this->resources[$name] =& $resource;
// If the object variable exists
if (isset ($this->$name))
{
// Assign to object variable
$this->$name =& $this->resources[$name];
}
} | php | public function setResourceObj ($name, &$resource)
{
// Set the resource
$this->resources[$name] =& $resource;
// If the object variable exists
if (isset ($this->$name))
{
// Assign to object variable
$this->$name =& $this->resources[$name];
}
} | [
"public",
"function",
"setResourceObj",
"(",
"$",
"name",
",",
"&",
"$",
"resource",
")",
"{",
"// Set the resource",
"$",
"this",
"->",
"resources",
"[",
"$",
"name",
"]",
"=",
"&",
"$",
"resource",
";",
"// If the object variable exists ",
"if",
"(",
"isse... | Set a class resource from the resource object
@param string $name Resource name
@param object $resource Resource object
@return void | [
"Set",
"a",
"class",
"resource",
"from",
"the",
"resource",
"object"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2112-L2130 | train |
andyburton/Sonic-Framework | src/Model.php | Model.removeResource | public function removeResource ($name)
{
if (isset ($this->resources[$name]))
{
unset ($this->resources[$name]);
if (isset ($this->$name))
{
unset ($this->$name);
}
}
} | php | public function removeResource ($name)
{
if (isset ($this->resources[$name]))
{
unset ($this->resources[$name]);
if (isset ($this->$name))
{
unset ($this->$name);
}
}
} | [
"public",
"function",
"removeResource",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"resources",
"[",
"$",
"name",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"resources",
"[",
"$",
"name",
"]",
")",
";",
"if"... | Remove a class resource
@param string $name Resource name
@return void | [
"Remove",
"a",
"class",
"resource"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2139-L2154 | train |
andyburton/Sonic-Framework | src/Model.php | Model.removeResources | public function removeResources ()
{
foreach (array_keys ($this->resources) as $name)
{
if (isset ($this->$name))
{
unset ($this->$name);
}
}
unset ($this->resources);
} | php | public function removeResources ()
{
foreach (array_keys ($this->resources) as $name)
{
if (isset ($this->$name))
{
unset ($this->$name);
}
}
unset ($this->resources);
} | [
"public",
"function",
"removeResources",
"(",
")",
"{",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"resources",
")",
"as",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"$",
"name",
")",
")",
"{",
"unset",
"(",
"$",
... | Remove all class resources
@return void | [
"Remove",
"all",
"class",
"resources"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2162-L2175 | train |
andyburton/Sonic-Framework | src/Model.php | Model._attributeProperties | public static function _attributeProperties ($name, $property = FALSE)
{
// If the attribute exists
if (isset (static::$attributes[$name]))
{
// If a property is specified
if ($property)
{
// If the property doesnt exist
if (!isset (static::$attributes[$name][$property]))... | php | public static function _attributeProperties ($name, $property = FALSE)
{
// If the attribute exists
if (isset (static::$attributes[$name]))
{
// If a property is specified
if ($property)
{
// If the property doesnt exist
if (!isset (static::$attributes[$name][$property]))... | [
"public",
"static",
"function",
"_attributeProperties",
"(",
"$",
"name",
",",
"$",
"property",
"=",
"FALSE",
")",
"{",
"// If the attribute exists",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"attributes",
"[",
"$",
"name",
"]",
")",
")",
"{",
"// If a... | Return an attribute parameters array or FALSE if it doesnt exist
Also pass option property array to return a single attribute property
@param string $name Attribute name
@param string $property Attribute property
@return boolean | [
"Return",
"an",
"attribute",
"parameters",
"array",
"or",
"FALSE",
"if",
"it",
"doesnt",
"exist",
"Also",
"pass",
"option",
"property",
"array",
"to",
"return",
"a",
"single",
"attribute",
"property"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2258-L2294 | train |
andyburton/Sonic-Framework | src/Model.php | Model._read | public static function _read ($params, &$db = FALSE)
{
// Create the object
$obj = new static;
// If the params are an array
if (is_array ($params))
{
// Select all
$params['select'] = '*';
// Get data
$row = static::_getValue ($params, \PDO::FETCH_ASSOC, $db);
// If no data ... | php | public static function _read ($params, &$db = FALSE)
{
// Create the object
$obj = new static;
// If the params are an array
if (is_array ($params))
{
// Select all
$params['select'] = '*';
// Get data
$row = static::_getValue ($params, \PDO::FETCH_ASSOC, $db);
// If no data ... | [
"public",
"static",
"function",
"_read",
"(",
"$",
"params",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Create the object",
"$",
"obj",
"=",
"new",
"static",
";",
"// If the params are an array",
"if",
"(",
"is_array",
"(",
"$",
"params",
")",
")",
... | Create a new object instance and read it from the database, populating the object attributes
@param mixed $params Object to read.
This can be an instance ID or a parameter array.
@param \PDO $db Database connection to use
@return \Sonic\Model | [
"Create",
"a",
"new",
"object",
"instance",
"and",
"read",
"it",
"from",
"the",
"database",
"populating",
"the",
"object",
"attributes"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2373-L2432 | train |
andyburton/Sonic-Framework | src/Model.php | Model._count | public static function _count ($params = array (), &$db = FALSE)
{
// Remove order
if (isset ($params['orderby']))
{
unset ($params['orderby']);
}
// Remove limit
if (isset ($params['limit']))
{
unset ($params['limit']);
}
// Select count
$params['select'] = 'COUNT(*)';
// Retu... | php | public static function _count ($params = array (), &$db = FALSE)
{
// Remove order
if (isset ($params['orderby']))
{
unset ($params['orderby']);
}
// Remove limit
if (isset ($params['limit']))
{
unset ($params['limit']);
}
// Select count
$params['select'] = 'COUNT(*)';
// Retu... | [
"public",
"static",
"function",
"_count",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Remove order",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'orderby'",
"]",
")",
")",
"{",
"unset",
"(",
"$",
... | Return the number of objects in the database matching the parameters
@param array $params Parameter array
@param \PDO $db Database connection to use
@return integer|boolean | [
"Return",
"the",
"number",
"of",
"objects",
"in",
"the",
"database",
"matching",
"the",
"parameters"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2463-L2488 | train |
andyburton/Sonic-Framework | src/Model.php | Model._exists | public static function _exists ($params, &$db = FALSE)
{
if (!is_array ($params))
{
$params = array (
'where' => array (
array (static::$pk, $params)
)
);
}
return self::_count ($params, $db) > 0;
} | php | public static function _exists ($params, &$db = FALSE)
{
if (!is_array ($params))
{
$params = array (
'where' => array (
array (static::$pk, $params)
)
);
}
return self::_count ($params, $db) > 0;
} | [
"public",
"static",
"function",
"_exists",
"(",
"$",
"params",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'where'",
"=>",
"array",
"(",
"array",
"... | Check to see whether the object matching the parameters exists
@param array $params Parameter array
@param \PDO $db Database connection to use
@return boolean | [
"Check",
"to",
"see",
"whether",
"the",
"object",
"matching",
"the",
"parameters",
"exists"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2498-L2512 | train |
andyburton/Sonic-Framework | src/Model.php | Model._getObjects | public static function _getObjects ($params = array (), $key = FALSE, &$db = FALSE)
{
// Select all attributes if none are set
if (!isset ($params['select']))
{
$params['select'] = '*';
}
// Get data
$rows = static::_getValues ($params, $db);
// If no data was returned return FALSE
if ... | php | public static function _getObjects ($params = array (), $key = FALSE, &$db = FALSE)
{
// Select all attributes if none are set
if (!isset ($params['select']))
{
$params['select'] = '*';
}
// Get data
$rows = static::_getValues ($params, $db);
// If no data was returned return FALSE
if ... | [
"public",
"static",
"function",
"_getObjects",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"key",
"=",
"FALSE",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Select all attributes if none are set",
"if",
"(",
"!",
"isset",
"(",
"$",
"params"... | Create and return an array of objects for query parameters
@param array $params Parameter array
@param string $key Attribute value to use as the array index, default to 0-indexed
@param \PDO $db Database connection to use
@return \Sonic\Resource\Model\Collection | [
"Create",
"and",
"return",
"an",
"array",
"of",
"objects",
"for",
"query",
"parameters"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2638-L2663 | train |
andyburton/Sonic-Framework | src/Model.php | Model._queryToObjects | public static function _queryToObjects ($query, $key = FALSE)
{
$query->execute ();
return static::_arrayToObjects ($query->fetchAll (\PDO::FETCH_ASSOC), $key);
} | php | public static function _queryToObjects ($query, $key = FALSE)
{
$query->execute ();
return static::_arrayToObjects ($query->fetchAll (\PDO::FETCH_ASSOC), $key);
} | [
"public",
"static",
"function",
"_queryToObjects",
"(",
"$",
"query",
",",
"$",
"key",
"=",
"FALSE",
")",
"{",
"$",
"query",
"->",
"execute",
"(",
")",
";",
"return",
"static",
"::",
"_arrayToObjects",
"(",
"$",
"query",
"->",
"fetchAll",
"(",
"\\",
"P... | Execute a PDOStatement query and convert the results into objects
@param \PDOStatement Query to execute
@param string $key Attribute value to use as the array index, default to 0-indexed
@return Resource\Model\Collection | [
"Execute",
"a",
"PDOStatement",
"query",
"and",
"convert",
"the",
"results",
"into",
"objects"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2673-L2677 | train |
andyburton/Sonic-Framework | src/Model.php | Model._arrayToObjects | public static function _arrayToObjects ($arr, $key = FALSE)
{
// Set object array
$objs = new Resource\Model\Collection;
// If no data
if (!$arr)
{
return $objs;
}
// For each row
foreach ($arr as $row)
{
// Create the object
$obj = new static;
// Set each attribute va... | php | public static function _arrayToObjects ($arr, $key = FALSE)
{
// Set object array
$objs = new Resource\Model\Collection;
// If no data
if (!$arr)
{
return $objs;
}
// For each row
foreach ($arr as $row)
{
// Create the object
$obj = new static;
// Set each attribute va... | [
"public",
"static",
"function",
"_arrayToObjects",
"(",
"$",
"arr",
",",
"$",
"key",
"=",
"FALSE",
")",
"{",
"// Set object array",
"$",
"objs",
"=",
"new",
"Resource",
"\\",
"Model",
"\\",
"Collection",
";",
"// If no data",
"if",
"(",
"!",
"$",
"arr",
... | Convert an array into objects
@param array $arr Array to convert
@param string $key Attribute value to use as the array index, default to 0-indexed
@return Resource\Model\Collection | [
"Convert",
"an",
"array",
"into",
"objects"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2687-L2739 | train |
andyburton/Sonic-Framework | src/Model.php | Model._genQuery | public static function _genQuery ($params, &$db = FALSE)
{
// Set select
if (!isset ($params['select']))
{
$params['select'] = '*';
}
// Set from
if (!isset ($params['from']))
{
$params['from'] = '`' . static::$dbTable . '`';
}
// Get database slave for read
if ($db === FALSE)
... | php | public static function _genQuery ($params, &$db = FALSE)
{
// Set select
if (!isset ($params['select']))
{
$params['select'] = '*';
}
// Set from
if (!isset ($params['from']))
{
$params['from'] = '`' . static::$dbTable . '`';
}
// Get database slave for read
if ($db === FALSE)
... | [
"public",
"static",
"function",
"_genQuery",
"(",
"$",
"params",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Set select",
"if",
"(",
"!",
"isset",
"(",
"$",
"params",
"[",
"'select'",
"]",
")",
")",
"{",
"$",
"params",
"[",
"'select'",
"]",
"=... | Generate a query and return the PDOStatement object
@param array $params Query parameters
@param \Sonic\Resource\Db $db Database resource, default to class slave
@return \PDOStatement
@throws Exception | [
"Generate",
"a",
"query",
"and",
"return",
"the",
"PDOStatement",
"object"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2750-L2783 | train |
andyburton/Sonic-Framework | src/Model.php | Model._genSQL | public static function _genSQL ($params = array (), &$db = FALSE)
{
// Set select
if (!isset ($params['select']))
{
$params['select'] = '*';
}
// Set from
if (!isset ($params['from']))
{
$params['from'] = '`' . static::$dbTable . '`';
}
// Get database slave for read
if ($db === ... | php | public static function _genSQL ($params = array (), &$db = FALSE)
{
// Set select
if (!isset ($params['select']))
{
$params['select'] = '*';
}
// Set from
if (!isset ($params['from']))
{
$params['from'] = '`' . static::$dbTable . '`';
}
// Get database slave for read
if ($db === ... | [
"public",
"static",
"function",
"_genSQL",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Set select",
"if",
"(",
"!",
"isset",
"(",
"$",
"params",
"[",
"'select'",
"]",
")",
")",
"{",
"$",
"params",
... | Generate the SQL for a query on the model
@param array $params Parameter array
@param \PDO $db Database connection to use, default db
@return string | [
"Generate",
"the",
"SQL",
"for",
"a",
"query",
"on",
"the",
"model"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2793-L2826 | train |
andyburton/Sonic-Framework | src/Model.php | Model._toXML | public static function _toXML ($params = array (), $attributes = FALSE, &$db = FALSE)
{
// Set class name for the elements
// Remove the Sonic\Model prefix and convert namespace \ to _
$class = str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
// Create DOM... | php | public static function _toXML ($params = array (), $attributes = FALSE, &$db = FALSE)
{
// Set class name for the elements
// Remove the Sonic\Model prefix and convert namespace \ to _
$class = str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
// Create DOM... | [
"public",
"static",
"function",
"_toXML",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"attributes",
"=",
"FALSE",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Set class name for the elements",
"// Remove the Sonic\\Model prefix and convert namespace \\... | Return a DOM tree with objects for given query parameters
@param array $params Parameter array
@param array|boolean $attributes Attributes to include, default to false i.e all attributes
@param \PDO $db Database connection to use
@return \DOMDocument|boolean | [
"Return",
"a",
"DOM",
"tree",
"with",
"objects",
"for",
"given",
"query",
"parameters"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2837-L2884 | train |
andyburton/Sonic-Framework | src/Model.php | Model._toJSON | public static function _toJSON ($params = array (), $attributes = FALSE, $addClass = FALSE, &$db = FALSE)
{
// Get objects
$rows = static::_toArray ($params, $attributes, $db);
// Add the class name if required
if ($addClass)
{
// Set class name for the elements
// Remove the Sonic\Mo... | php | public static function _toJSON ($params = array (), $attributes = FALSE, $addClass = FALSE, &$db = FALSE)
{
// Get objects
$rows = static::_toArray ($params, $attributes, $db);
// Add the class name if required
if ($addClass)
{
// Set class name for the elements
// Remove the Sonic\Mo... | [
"public",
"static",
"function",
"_toJSON",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"attributes",
"=",
"FALSE",
",",
"$",
"addClass",
"=",
"FALSE",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// Get objects",
"$",
"rows",
"=",
"static"... | Return a JSON encoded string with objects for given query parameters
@param array $params Parameter array
@param array|boolean $attributes Attributes to include, default to false i.e all attributes
@param boolean $addClass Whether to add the class name to each exported object
@param \PDO $db Database connection to use
... | [
"Return",
"a",
"JSON",
"encoded",
"string",
"with",
"objects",
"for",
"given",
"query",
"parameters"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2896-L2924 | train |
andyburton/Sonic-Framework | src/Model.php | Model._toArray | public static function _toArray ($params = array (), $attributes = FALSE, &$db = FALSE)
{
// If no attributes are set to display, get all class attributes with get allowed
if ($attributes === FALSE)
{
$attributes = array ();
$obj = new static;
foreach (array_keys (static::$attributes) as ... | php | public static function _toArray ($params = array (), $attributes = FALSE, &$db = FALSE)
{
// If no attributes are set to display, get all class attributes with get allowed
if ($attributes === FALSE)
{
$attributes = array ();
$obj = new static;
foreach (array_keys (static::$attributes) as ... | [
"public",
"static",
"function",
"_toArray",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"attributes",
"=",
"FALSE",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// If no attributes are set to display, get all class attributes with get allowed",
"if",
"(... | Return an array with object attributes for given query parameters
@param array $params Parameter array
@param array|boolean $attributes Attributes to include, default to false i.e all attributes
@param \PDO $db Database connection to use
@return object|boolean | [
"Return",
"an",
"array",
"with",
"object",
"attributes",
"for",
"given",
"query",
"parameters"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L2935-L3006 | train |
andyburton/Sonic-Framework | src/Model.php | Model._getRelationPaths | public static function _getRelationPaths ($endClass, $fork = array (), $paths = array (), $processed = array (), $depth = 0)
{
// Remove first \ from end class
if ($endClass[0] == '\\')
{
$endClass = substr ($endClass, 1);
}
// Make sure fork is an array
if ($fork === FALSE)
{
$fork = a... | php | public static function _getRelationPaths ($endClass, $fork = array (), $paths = array (), $processed = array (), $depth = 0)
{
// Remove first \ from end class
if ($endClass[0] == '\\')
{
$endClass = substr ($endClass, 1);
}
// Make sure fork is an array
if ($fork === FALSE)
{
$fork = a... | [
"public",
"static",
"function",
"_getRelationPaths",
"(",
"$",
"endClass",
",",
"$",
"fork",
"=",
"array",
"(",
")",
",",
"$",
"paths",
"=",
"array",
"(",
")",
",",
"$",
"processed",
"=",
"array",
"(",
")",
",",
"$",
"depth",
"=",
"0",
")",
"{",
... | Return an array of available paths to a related class
@param string $class Destination class
@param array $fork Used to determine which fork to use when there are
multiple attributes related to the same class (see getRelated comments)
@param array $paths Available paths, set recursively
@param array $processed Already ... | [
"Return",
"an",
"array",
"of",
"available",
"paths",
"to",
"a",
"related",
"class"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3020-L3091 | train |
andyburton/Sonic-Framework | src/Model.php | Model._getRelation | public static function _getRelation ($obj, $path, $params = array ())
{
foreach ($path as $class => $name)
{
$class = get_class ($obj);
$childClass = $class::$attributes[$name]['relation'];
if ($obj->iget ($name))
{
$params['where'][] = array ($childClass::$pk, $obj->iget ($name));
... | php | public static function _getRelation ($obj, $path, $params = array ())
{
foreach ($path as $class => $name)
{
$class = get_class ($obj);
$childClass = $class::$attributes[$name]['relation'];
if ($obj->iget ($name))
{
$params['where'][] = array ($childClass::$pk, $obj->iget ($name));
... | [
"public",
"static",
"function",
"_getRelation",
"(",
"$",
"obj",
",",
"$",
"path",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"path",
"as",
"$",
"class",
"=>",
"$",
"name",
")",
"{",
"$",
"class",
"=",
"get_class",
... | Return a related object for a given object and path
@param Model $obj Starting object
@param array $path Path to the end object
@param array $params Query parameter array
@return \Sonic\Model|boolean | [
"Return",
"a",
"related",
"object",
"for",
"a",
"given",
"object",
"and",
"path"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3140-L3163 | train |
andyburton/Sonic-Framework | src/Model.php | Model._getChildren | public static function _getChildren ($class, $id, $recursive = FALSE, $key = FALSE, $params = array ())
{
// Remove first \ from class
if ($class[0] == '\\')
{
$class = substr ($class, 1);
}
// Get current (parent) class
$parent = get_called_class ();
// Find the child variable pointing... | php | public static function _getChildren ($class, $id, $recursive = FALSE, $key = FALSE, $params = array ())
{
// Remove first \ from class
if ($class[0] == '\\')
{
$class = substr ($class, 1);
}
// Get current (parent) class
$parent = get_called_class ();
// Find the child variable pointing... | [
"public",
"static",
"function",
"_getChildren",
"(",
"$",
"class",
",",
"$",
"id",
",",
"$",
"recursive",
"=",
"FALSE",
",",
"$",
"key",
"=",
"FALSE",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"// Remove first \\ from class",
"if",
"(",
"$"... | Return child objects with an attribute matching the current class and specified ID
@param string $class Child class
@param integer $id Parent ID
@param boolean $recursive Whether to load childrens children.
This will create an object attribute called 'children' on all objects
@param string $key Attribute to use as arra... | [
"Return",
"child",
"objects",
"with",
"an",
"attribute",
"matching",
"the",
"current",
"class",
"and",
"specified",
"ID"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3177-L3246 | train |
andyburton/Sonic-Framework | src/Model.php | Model.getFromPivot | public function getFromPivot (\Sonic\Model $target, \Sonic\Model $pivot, $key = FALSE, $params = [])
{
// Find the pivot attribute pointing to the source
$sourceClass = get_called_class ();
$sourceRef = FALSE;
foreach ($pivot::$attributes as $name => $attribute)
{
if (isset ($attribute['relation... | php | public function getFromPivot (\Sonic\Model $target, \Sonic\Model $pivot, $key = FALSE, $params = [])
{
// Find the pivot attribute pointing to the source
$sourceClass = get_called_class ();
$sourceRef = FALSE;
foreach ($pivot::$attributes as $name => $attribute)
{
if (isset ($attribute['relation... | [
"public",
"function",
"getFromPivot",
"(",
"\\",
"Sonic",
"\\",
"Model",
"$",
"target",
",",
"\\",
"Sonic",
"\\",
"Model",
"$",
"pivot",
",",
"$",
"key",
"=",
"FALSE",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"// Find the pivot attribute pointing to th... | Return related objects from a many-to-many pivot table
@param \Sonic\Model $target Target objects to return
@param \Sonic\Model $pivot Pivot object
@return boolean|Model\Collection | [
"Return",
"related",
"objects",
"from",
"a",
"many",
"-",
"to",
"-",
"many",
"pivot",
"table"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3278-L3343 | train |
andyburton/Sonic-Framework | src/Model.php | Model._getGrid | public static function _getGrid ($params = array (), $relations = array (), &$db = FALSE)
{
// If no limit has been set
if (!$params || !isset ($params['limit']))
{
// Set default query limit
$params['limit'] = array (0, 50);
}
// Get data
if ($relations)
{
$objs = static::_g... | php | public static function _getGrid ($params = array (), $relations = array (), &$db = FALSE)
{
// If no limit has been set
if (!$params || !isset ($params['limit']))
{
// Set default query limit
$params['limit'] = array (0, 50);
}
// Get data
if ($relations)
{
$objs = static::_g... | [
"public",
"static",
"function",
"_getGrid",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"relations",
"=",
"array",
"(",
")",
",",
"&",
"$",
"db",
"=",
"FALSE",
")",
"{",
"// If no limit has been set",
"if",
"(",
"!",
"$",
"params",
"||",
"!... | Return an array of items with total result count
@param array $params Array of query parameters - MUST BE ESCAPED!
@param array $relations Array of related object attributes or tranformed method attributes to return
e.g. related value - 'query_name' => array ('\Sonic\Model\User\Group', 'name')
e.g. tranformed value - '... | [
"Return",
"an",
"array",
"of",
"items",
"with",
"total",
"result",
"count"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3356-L3425 | train |
andyburton/Sonic-Framework | src/Model.php | Model.& | public static function &_getResource ($name)
{
if (is_array ($name))
{
return Sonic::getResource ($name);
}
else if (isset (static::$defaultResources[$name]))
{
return Sonic::getResource (static::$defaultResources[$name]);
}
else
{
return Sonic::getSelectedResource ($name);
}
} | php | public static function &_getResource ($name)
{
if (is_array ($name))
{
return Sonic::getResource ($name);
}
else if (isset (static::$defaultResources[$name]))
{
return Sonic::getResource (static::$defaultResources[$name]);
}
else
{
return Sonic::getSelectedResource ($name);
}
} | [
"public",
"static",
"function",
"&",
"_getResource",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"return",
"Sonic",
"::",
"getResource",
"(",
"$",
"name",
")",
";",
"}",
"else",
"if",
"(",
"isset",
"(",
"stat... | Return a class resource
This will either be the default as defined for the class or the global framework resource
@param string|array $name Resource name
@return object|boolean | [
"Return",
"a",
"class",
"resource",
"This",
"will",
"either",
"be",
"the",
"default",
"as",
"defined",
"for",
"the",
"class",
"or",
"the",
"global",
"framework",
"resource"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3435-L3451 | train |
andyburton/Sonic-Framework | src/Model.php | Model.& | public static function &_getRandomDbResource ($group)
{
$obj = FALSE;
while (Sonic::countResourceGroup ($group) > 0)
{
$name = Sonic::selectRandomResource ($group);
$obj =& Sonic::getResource (array ($group, $name));
// If a PDO object
if ($obj instanceof \PDO)
{
// Attempt to con... | php | public static function &_getRandomDbResource ($group)
{
$obj = FALSE;
while (Sonic::countResourceGroup ($group) > 0)
{
$name = Sonic::selectRandomResource ($group);
$obj =& Sonic::getResource (array ($group, $name));
// If a PDO object
if ($obj instanceof \PDO)
{
// Attempt to con... | [
"public",
"static",
"function",
"&",
"_getRandomDbResource",
"(",
"$",
"group",
")",
"{",
"$",
"obj",
"=",
"FALSE",
";",
"while",
"(",
"Sonic",
"::",
"countResourceGroup",
"(",
"$",
"group",
")",
">",
"0",
")",
"{",
"$",
"name",
"=",
"Sonic",
"::",
"... | Return random database resource object
@param string $group Group name
@return boolean|\Sonic\Model\PDO | [
"Return",
"random",
"database",
"resource",
"object"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3460-L3518 | train |
andyburton/Sonic-Framework | src/Model.php | Model.changelog | private function changelog ($type)
{
// If changelog or type is disabled for the class return FALSE
if (isset (static::$changelogIgnore))
{
if (static::$changelogIgnore === TRUE ||
is_array (static::$changelogIgnore) && in_array ($type, static::$changelogIgnore))
{
return FALSE;
}
... | php | private function changelog ($type)
{
// If changelog or type is disabled for the class return FALSE
if (isset (static::$changelogIgnore))
{
if (static::$changelogIgnore === TRUE ||
is_array (static::$changelogIgnore) && in_array ($type, static::$changelogIgnore))
{
return FALSE;
}
... | [
"private",
"function",
"changelog",
"(",
"$",
"type",
")",
"{",
"// If changelog or type is disabled for the class return FALSE",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"changelogIgnore",
")",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"changelogIgnore",
"==... | Whether to write to the changelog
@param string $type Change type (create, update, delete)
@return boolean | [
"Whether",
"to",
"write",
"to",
"the",
"changelog"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L3624-L3652 | train |
frankfoerster/cakephp-asset | src/View/Helper/AssetHelper.php | AssetHelper.css | public function css($path, $plugin = false, $appendTime = true, array $attributes = [])
{
$href = $this->getUrl($path, $plugin, $appendTime);
return '<link rel="stylesheet" type="text/css" href="' . $href . '"' . $this->_renderAttributes($attributes) . '>';
} | php | public function css($path, $plugin = false, $appendTime = true, array $attributes = [])
{
$href = $this->getUrl($path, $plugin, $appendTime);
return '<link rel="stylesheet" type="text/css" href="' . $href . '"' . $this->_renderAttributes($attributes) . '>';
} | [
"public",
"function",
"css",
"(",
"$",
"path",
",",
"$",
"plugin",
"=",
"false",
",",
"$",
"appendTime",
"=",
"true",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"href",
"=",
"$",
"this",
"->",
"getUrl",
"(",
"$",
"path",
",",
... | Output a link stylesheet tag for a specific css file and optionally
append a last modified timestamp to clear the browser cache.
@param string $path The path to the css file relative to WEBROOT
@param bool $plugin Either false or the name of a plugin.
@param bool $appendTime Whether to append a last modified timestamp... | [
"Output",
"a",
"link",
"stylesheet",
"tag",
"for",
"a",
"specific",
"css",
"file",
"and",
"optionally",
"append",
"a",
"last",
"modified",
"timestamp",
"to",
"clear",
"the",
"browser",
"cache",
"."
] | 07b3646006d9bbf4f2d6fceeb319373392752b63 | https://github.com/frankfoerster/cakephp-asset/blob/07b3646006d9bbf4f2d6fceeb319373392752b63/src/View/Helper/AssetHelper.php#L52-L57 | train |
frankfoerster/cakephp-asset | src/View/Helper/AssetHelper.php | AssetHelper.js | public function js($path, $plugin = false, $appendTime = true, array $attributes = [])
{
$src = $this->getUrl($path, $plugin, $appendTime);
return '<script type="text/javascript" src="' . $src . '"' . $this->_renderAttributes($attributes) . '></script>';
} | php | public function js($path, $plugin = false, $appendTime = true, array $attributes = [])
{
$src = $this->getUrl($path, $plugin, $appendTime);
return '<script type="text/javascript" src="' . $src . '"' . $this->_renderAttributes($attributes) . '></script>';
} | [
"public",
"function",
"js",
"(",
"$",
"path",
",",
"$",
"plugin",
"=",
"false",
",",
"$",
"appendTime",
"=",
"true",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"src",
"=",
"$",
"this",
"->",
"getUrl",
"(",
"$",
"path",
",",
... | Output a script tag for a specific js file and optionally
append a last modified timestamp to clear the browser cache.
@param string $path The path to the css file relative to the app or plugin webroot.
@param bool|string $plugin Either false or the name of a plugin.
@param bool $appendTime Whether to append a last mo... | [
"Output",
"a",
"script",
"tag",
"for",
"a",
"specific",
"js",
"file",
"and",
"optionally",
"append",
"a",
"last",
"modified",
"timestamp",
"to",
"clear",
"the",
"browser",
"cache",
"."
] | 07b3646006d9bbf4f2d6fceeb319373392752b63 | https://github.com/frankfoerster/cakephp-asset/blob/07b3646006d9bbf4f2d6fceeb319373392752b63/src/View/Helper/AssetHelper.php#L69-L74 | train |
frankfoerster/cakephp-asset | src/View/Helper/AssetHelper.php | AssetHelper.getUrl | public function getUrl($path, $plugin, $appendTime = true)
{
$pathParts = explode('/', $path);
$isAssetPath = ($pathParts[0] === 'ASSETS');
if ($isAssetPath) {
$absPath = $this->_getBaseAssetPath($plugin) . join('/', array_slice($pathParts, 1));
} else {
$abs... | php | public function getUrl($path, $plugin, $appendTime = true)
{
$pathParts = explode('/', $path);
$isAssetPath = ($pathParts[0] === 'ASSETS');
if ($isAssetPath) {
$absPath = $this->_getBaseAssetPath($plugin) . join('/', array_slice($pathParts, 1));
} else {
$abs... | [
"public",
"function",
"getUrl",
"(",
"$",
"path",
",",
"$",
"plugin",
",",
"$",
"appendTime",
"=",
"true",
")",
"{",
"$",
"pathParts",
"=",
"explode",
"(",
"'/'",
",",
"$",
"path",
")",
";",
"$",
"isAssetPath",
"=",
"(",
"$",
"pathParts",
"[",
"0",... | Get the asset url for a specific file.
@param string $path The path to the css file relative to the app or plugin webroot.
@param bool|string $plugin Either false or the name of a plugin.
@param bool $appendTime Whether to append a last modified timestamp to the url.
@return string | [
"Get",
"the",
"asset",
"url",
"for",
"a",
"specific",
"file",
"."
] | 07b3646006d9bbf4f2d6fceeb319373392752b63 | https://github.com/frankfoerster/cakephp-asset/blob/07b3646006d9bbf4f2d6fceeb319373392752b63/src/View/Helper/AssetHelper.php#L84-L113 | train |
frankfoerster/cakephp-asset | src/View/Helper/AssetHelper.php | AssetHelper._getBasePath | protected function _getBasePath($plugin = false)
{
if ($plugin !== false) {
return $this->_getPluginPath($plugin) . 'webroot' . DS;
}
return WWW_ROOT;
} | php | protected function _getBasePath($plugin = false)
{
if ($plugin !== false) {
return $this->_getPluginPath($plugin) . 'webroot' . DS;
}
return WWW_ROOT;
} | [
"protected",
"function",
"_getBasePath",
"(",
"$",
"plugin",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"plugin",
"!==",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"_getPluginPath",
"(",
"$",
"plugin",
")",
".",
"'webroot'",
".",
"DS",
";",
"}",
"r... | Get the base path to the app webroot or a plugin webroot.
@param bool|string $plugin Either false or the name of a plugin.
@return string | [
"Get",
"the",
"base",
"path",
"to",
"the",
"app",
"webroot",
"or",
"a",
"plugin",
"webroot",
"."
] | 07b3646006d9bbf4f2d6fceeb319373392752b63 | https://github.com/frankfoerster/cakephp-asset/blob/07b3646006d9bbf4f2d6fceeb319373392752b63/src/View/Helper/AssetHelper.php#L136-L143 | train |
frankfoerster/cakephp-asset | src/View/Helper/AssetHelper.php | AssetHelper._renderAttributes | protected function _renderAttributes(array $attributes = [])
{
$attributeStrings = [];
foreach ($attributes as $attribute => $value) {
$attributeStrings[] = $attribute . '="' . htmlentities($value) . '"';
}
if (empty($attributeStrings)) {
return '';
}... | php | protected function _renderAttributes(array $attributes = [])
{
$attributeStrings = [];
foreach ($attributes as $attribute => $value) {
$attributeStrings[] = $attribute . '="' . htmlentities($value) . '"';
}
if (empty($attributeStrings)) {
return '';
}... | [
"protected",
"function",
"_renderAttributes",
"(",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"attributeStrings",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"attribute",
"=>",
"$",
"value",
")",
"{",
"$",
"attributeS... | Render attribute key value pairs as html attributes.
@param array $attributes Key value pairs of html attributes.
@return string | [
"Render",
"attribute",
"key",
"value",
"pairs",
"as",
"html",
"attributes",
"."
] | 07b3646006d9bbf4f2d6fceeb319373392752b63 | https://github.com/frankfoerster/cakephp-asset/blob/07b3646006d9bbf4f2d6fceeb319373392752b63/src/View/Helper/AssetHelper.php#L182-L194 | train |
Wonail/yii2-widget-nestable | Nestable.php | Nestable.renderWidget | public function renderWidget()
{
// BEGIN:nestable-box
echo Html::beginTag('div', ['class' => 'nestable-box']);
foreach ($this->items as $item) {
$this->renderGroup($item);
}
// END:nestable-box
echo Html::endTag('div');
if ($this->hasModel()) {
... | php | public function renderWidget()
{
// BEGIN:nestable-box
echo Html::beginTag('div', ['class' => 'nestable-box']);
foreach ($this->items as $item) {
$this->renderGroup($item);
}
// END:nestable-box
echo Html::endTag('div');
if ($this->hasModel()) {
... | [
"public",
"function",
"renderWidget",
"(",
")",
"{",
"// BEGIN:nestable-box",
"echo",
"Html",
"::",
"beginTag",
"(",
"'div'",
",",
"[",
"'class'",
"=>",
"'nestable-box'",
"]",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"item",
")",
... | Initializes and renders the widget | [
"Initializes",
"and",
"renders",
"the",
"widget"
] | b9e4ccaab15d616e0791cb49a7a96597f4dc3d60 | https://github.com/Wonail/yii2-widget-nestable/blob/b9e4ccaab15d616e0791cb49a7a96597f4dc3d60/Nestable.php#L107-L121 | train |
luoxiaojun1992/lb_framework | controllers/console/SwooleController.php | SwooleController.http | public function http()
{
$this->writeln('Starting swoole http server...');
$server = new HttpServer(
$this->swooleConfig['http']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['http']['port'] ?? self::DEFAULT_SWOOLE_PORT
);
$server->on(
... | php | public function http()
{
$this->writeln('Starting swoole http server...');
$server = new HttpServer(
$this->swooleConfig['http']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['http']['port'] ?? self::DEFAULT_SWOOLE_PORT
);
$server->on(
... | [
"public",
"function",
"http",
"(",
")",
"{",
"$",
"this",
"->",
"writeln",
"(",
"'Starting swoole http server...'",
")",
";",
"$",
"server",
"=",
"new",
"HttpServer",
"(",
"$",
"this",
"->",
"swooleConfig",
"[",
"'http'",
"]",
"[",
"'host'",
"]",
"??",
"... | Swoole Http Server | [
"Swoole",
"Http",
"Server"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/controllers/console/SwooleController.php#L38-L66 | train |
luoxiaojun1992/lb_framework | controllers/console/SwooleController.php | SwooleController.tcp | public function tcp()
{
$this->writeln('Starting swoole tcp server...');
$server = new TcpServer(
$this->swooleConfig['tcp']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['tcp']['port'] ?? self::DEFAULT_SWOOLE_PORT
);
//防止粘包
$server->set(... | php | public function tcp()
{
$this->writeln('Starting swoole tcp server...');
$server = new TcpServer(
$this->swooleConfig['tcp']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['tcp']['port'] ?? self::DEFAULT_SWOOLE_PORT
);
//防止粘包
$server->set(... | [
"public",
"function",
"tcp",
"(",
")",
"{",
"$",
"this",
"->",
"writeln",
"(",
"'Starting swoole tcp server...'",
")",
";",
"$",
"server",
"=",
"new",
"TcpServer",
"(",
"$",
"this",
"->",
"swooleConfig",
"[",
"'tcp'",
"]",
"[",
"'host'",
"]",
"??",
"self... | Swoole Tcp Server | [
"Swoole",
"Tcp",
"Server"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/controllers/console/SwooleController.php#L71-L121 | train |
luoxiaojun1992/lb_framework | controllers/console/SwooleController.php | SwooleController.udp | public function udp()
{
$this->writeln('Starting swoole udp server...');
$udpServer = new TcpServer(
$this->swooleConfig['upd']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['upd']['port'] ?? self::DEFAULT_SWOOLE_PORT,
SWOOLE_PROCESS,
SWOO... | php | public function udp()
{
$this->writeln('Starting swoole udp server...');
$udpServer = new TcpServer(
$this->swooleConfig['upd']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['upd']['port'] ?? self::DEFAULT_SWOOLE_PORT,
SWOOLE_PROCESS,
SWOO... | [
"public",
"function",
"udp",
"(",
")",
"{",
"$",
"this",
"->",
"writeln",
"(",
"'Starting swoole udp server...'",
")",
";",
"$",
"udpServer",
"=",
"new",
"TcpServer",
"(",
"$",
"this",
"->",
"swooleConfig",
"[",
"'upd'",
"]",
"[",
"'host'",
"]",
"??",
"s... | Swoole UDP Server | [
"Swoole",
"UDP",
"Server"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/controllers/console/SwooleController.php#L126-L177 | train |
luoxiaojun1992/lb_framework | controllers/console/SwooleController.php | SwooleController.websocket | public function websocket()
{
$this->writeln('Starting swoole websocket server...');
$ws = new WebsocketServer(
$this->swooleConfig['ws']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['ws']['port'] ?? self::DEFAULT_SWOOLE_PORT
);
$ws->on(
... | php | public function websocket()
{
$this->writeln('Starting swoole websocket server...');
$ws = new WebsocketServer(
$this->swooleConfig['ws']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['ws']['port'] ?? self::DEFAULT_SWOOLE_PORT
);
$ws->on(
... | [
"public",
"function",
"websocket",
"(",
")",
"{",
"$",
"this",
"->",
"writeln",
"(",
"'Starting swoole websocket server...'",
")",
";",
"$",
"ws",
"=",
"new",
"WebsocketServer",
"(",
"$",
"this",
"->",
"swooleConfig",
"[",
"'ws'",
"]",
"[",
"'host'",
"]",
... | Swoole Websocket Server | [
"Swoole",
"Websocket",
"Server"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/controllers/console/SwooleController.php#L182-L230 | train |
luoxiaojun1992/lb_framework | controllers/console/SwooleController.php | SwooleController.mqtt | public function mqtt()
{
$this->writeln('Starting swoole mqtt server...');
$serv = new TcpServer(
$this->swooleConfig['tcp']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['tcp']['port'] ?? self::DEFAULT_SWOOLE_PORT,
SWOOLE_BASE
);
$ser... | php | public function mqtt()
{
$this->writeln('Starting swoole mqtt server...');
$serv = new TcpServer(
$this->swooleConfig['tcp']['host'] ?? self::DEFAULT_SWOOLE_HOST,
$this->swooleConfig['tcp']['port'] ?? self::DEFAULT_SWOOLE_PORT,
SWOOLE_BASE
);
$ser... | [
"public",
"function",
"mqtt",
"(",
")",
"{",
"$",
"this",
"->",
"writeln",
"(",
"'Starting swoole mqtt server...'",
")",
";",
"$",
"serv",
"=",
"new",
"TcpServer",
"(",
"$",
"this",
"->",
"swooleConfig",
"[",
"'tcp'",
"]",
"[",
"'host'",
"]",
"??",
"self... | Swoole Mqtt Server | [
"Swoole",
"Mqtt",
"Server"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/controllers/console/SwooleController.php#L235-L280 | train |
luoxiaojun1992/lb_framework | controllers/console/SwooleController.php | SwooleController.udpClient | public function udpClient()
{
$this->writeln('Starting demo swoole udp client...');
$client = new TcpClient(SWOOLE_SOCK_UDP, SWOOLE_SOCK_ASYNC);
$client->on(
'connect', function ($cli) {
//发送数据中不能包含'\r\n\r\n'
$cli->send(JsonHelper::encode(['handl... | php | public function udpClient()
{
$this->writeln('Starting demo swoole udp client...');
$client = new TcpClient(SWOOLE_SOCK_UDP, SWOOLE_SOCK_ASYNC);
$client->on(
'connect', function ($cli) {
//发送数据中不能包含'\r\n\r\n'
$cli->send(JsonHelper::encode(['handl... | [
"public",
"function",
"udpClient",
"(",
")",
"{",
"$",
"this",
"->",
"writeln",
"(",
"'Starting demo swoole udp client...'",
")",
";",
"$",
"client",
"=",
"new",
"TcpClient",
"(",
"SWOOLE_SOCK_UDP",
",",
"SWOOLE_SOCK_ASYNC",
")",
";",
"$",
"client",
"->",
"on"... | Swoole UDP Client Demo | [
"Swoole",
"UDP",
"Client",
"Demo"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/controllers/console/SwooleController.php#L323-L356 | train |
luoxiaojun1992/lb_framework | controllers/console/SwooleController.php | SwooleController.websocketClient | public function websocketClient()
{
$this->writeln('Starting demo websocket client...');
$client = new Client(
'ws://' .
($this->swooleConfig['ws']['host'] ?? self::DEFAULT_SWOOLE_HOST) . ':' .
($this->swooleConfig['ws']['port'] ?? self::DEFAULT_SWOOLE_PORT)
... | php | public function websocketClient()
{
$this->writeln('Starting demo websocket client...');
$client = new Client(
'ws://' .
($this->swooleConfig['ws']['host'] ?? self::DEFAULT_SWOOLE_HOST) . ':' .
($this->swooleConfig['ws']['port'] ?? self::DEFAULT_SWOOLE_PORT)
... | [
"public",
"function",
"websocketClient",
"(",
")",
"{",
"$",
"this",
"->",
"writeln",
"(",
"'Starting demo websocket client...'",
")",
";",
"$",
"client",
"=",
"new",
"Client",
"(",
"'ws://'",
".",
"(",
"$",
"this",
"->",
"swooleConfig",
"[",
"'ws'",
"]",
... | Websocket Client Demo | [
"Websocket",
"Client",
"Demo"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/controllers/console/SwooleController.php#L361-L373 | train |
wartw98/core | Config/Source/API.php | API.map | final protected function map() {
/** @var array(string => string) $result */ /** @var bool $met */
$result = df_map_0([], $met = $this->isRequirementMet() ? null : $this->requirement());
if ($met) {
try {$result += $this->fetch();}
catch (\Exception $e) {$result = $this->exception($e);}
}
return $result... | php | final protected function map() {
/** @var array(string => string) $result */ /** @var bool $met */
$result = df_map_0([], $met = $this->isRequirementMet() ? null : $this->requirement());
if ($met) {
try {$result += $this->fetch();}
catch (\Exception $e) {$result = $this->exception($e);}
}
return $result... | [
"final",
"protected",
"function",
"map",
"(",
")",
"{",
"/** @var array(string => string) $result */",
"/** @var bool $met */",
"$",
"result",
"=",
"df_map_0",
"(",
"[",
"]",
",",
"$",
"met",
"=",
"$",
"this",
"->",
"isRequirementMet",
"(",
")",
"?",
"null",
"... | 2017-07-02
@override
@see \Df\Config\Source::map()
@used-by \Df\Config\Source::toOptionArray()
@return array(string => string) | [
"2017",
"-",
"07",
"-",
"02"
] | e1f44f6b4798a7b988f6a1cae639ff3745c9cd2a | https://github.com/wartw98/core/blob/e1f44f6b4798a7b988f6a1cae639ff3745c9cd2a/Config/Source/API.php#L56-L64 | train |
xelax90/xelax-admin | src/XelaxAdmin/Router/ListRoute.php | ListRoute.getControllerOptions | public function getControllerOptions(){
if(empty($this->controllerOptions)){
$routePluginManager = $this->getServiceLocator();
if(empty($routePluginManager)){
throw new Exception\RuntimeException('ServiceLocator not set');
}
/* @var $sl ServiceLocatorInterface */
$sl = $routePluginManager->getSer... | php | public function getControllerOptions(){
if(empty($this->controllerOptions)){
$routePluginManager = $this->getServiceLocator();
if(empty($routePluginManager)){
throw new Exception\RuntimeException('ServiceLocator not set');
}
/* @var $sl ServiceLocatorInterface */
$sl = $routePluginManager->getSer... | [
"public",
"function",
"getControllerOptions",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"controllerOptions",
")",
")",
"{",
"$",
"routePluginManager",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"... | Fetches and returns the associated ListControllerOptions for this route
@return ListControllerOptions
@throws Exception\RuntimeException | [
"Fetches",
"and",
"returns",
"the",
"associated",
"ListControllerOptions",
"for",
"this",
"route"
] | eb8133384b74e18f6641689f290c6ba956641b6d | https://github.com/xelax90/xelax-admin/blob/eb8133384b74e18f6641689f290c6ba956641b6d/src/XelaxAdmin/Router/ListRoute.php#L424-L447 | train |
matryoshka-model/matryoshka | library/Criteria/ExtractionTrait.php | ExtractionTrait.extractValue | protected function extractValue(ModelStubInterface $model, $name, $value, $extractName = true)
{
$modelHydrator = $model->getHydrator();
if (!$modelHydrator || !method_exists($modelHydrator, 'extractValue')) {
throw new Exception\RuntimeException(
'Model hydrator must be ... | php | protected function extractValue(ModelStubInterface $model, $name, $value, $extractName = true)
{
$modelHydrator = $model->getHydrator();
if (!$modelHydrator || !method_exists($modelHydrator, 'extractValue')) {
throw new Exception\RuntimeException(
'Model hydrator must be ... | [
"protected",
"function",
"extractValue",
"(",
"ModelStubInterface",
"$",
"model",
",",
"$",
"name",
",",
"$",
"value",
",",
"$",
"extractName",
"=",
"true",
")",
"{",
"$",
"modelHydrator",
"=",
"$",
"model",
"->",
"getHydrator",
"(",
")",
";",
"if",
"(",... | Extract a value in order to be used within datagateway context
If $extractName is false, $name must be in the datagateway context,
otherwise $name will be converted using extractName().
@param ModelStubInterface $model
@param string $name
@param string $value
@param bool $extractName
@throws Exception\RuntimeExceptio... | [
"Extract",
"a",
"value",
"in",
"order",
"to",
"be",
"used",
"within",
"datagateway",
"context"
] | 51792df00d9897f556d5a3c53193eed0974ff09d | https://github.com/matryoshka-model/matryoshka/blob/51792df00d9897f556d5a3c53193eed0974ff09d/library/Criteria/ExtractionTrait.php#L36-L51 | train |
matryoshka-model/matryoshka | library/Criteria/ExtractionTrait.php | ExtractionTrait.extractName | protected function extractName(ModelStubInterface $model, $name)
{
if ($model->getObjectPrototype() instanceof HydratorAwareInterface) {
$objectHydrator = $model->getObjectPrototype()->getHydrator();
if (!$objectHydrator || !method_exists($objectHydrator, 'hydrateName'))... | php | protected function extractName(ModelStubInterface $model, $name)
{
if ($model->getObjectPrototype() instanceof HydratorAwareInterface) {
$objectHydrator = $model->getObjectPrototype()->getHydrator();
if (!$objectHydrator || !method_exists($objectHydrator, 'hydrateName'))... | [
"protected",
"function",
"extractName",
"(",
"ModelStubInterface",
"$",
"model",
",",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"model",
"->",
"getObjectPrototype",
"(",
")",
"instanceof",
"HydratorAwareInterface",
")",
"{",
"$",
"objectHydrator",
"=",
"$",
"mode... | Extract a name in order to be used within datagateway context
If an object's hydrator is avaliable, then $name will be converted to
a model name using the object's hydrator naming strategy.
Finally, $name will be extracted using the model's hydrator naming
strategy.
@param ModelStubInterface $model
@param string $nam... | [
"Extract",
"a",
"name",
"in",
"order",
"to",
"be",
"used",
"within",
"datagateway",
"context"
] | 51792df00d9897f556d5a3c53193eed0974ff09d | https://github.com/matryoshka-model/matryoshka/blob/51792df00d9897f556d5a3c53193eed0974ff09d/library/Criteria/ExtractionTrait.php#L66-L89 | train |
UnionOfRAD/li3_quality | qa/rules/syntax/HasCorrectTabIndention.php | HasCorrectTabIndention._getSpaceAlignmentInArray | protected function _getSpaceAlignmentInArray($lineIndex, $testable) {
if (!$lineIndex) {
return;
}
$tokens = $testable->tokens();
$lines = $testable->lines();
$lineCache = $testable->lineCache();
$prevLine = $lines[$lineIndex - 1];
$previousTokens = $lineCache[$testable->findTokensByLine($lineIndex)]... | php | protected function _getSpaceAlignmentInArray($lineIndex, $testable) {
if (!$lineIndex) {
return;
}
$tokens = $testable->tokens();
$lines = $testable->lines();
$lineCache = $testable->lineCache();
$prevLine = $lines[$lineIndex - 1];
$previousTokens = $lineCache[$testable->findTokensByLine($lineIndex)]... | [
"protected",
"function",
"_getSpaceAlignmentInArray",
"(",
"$",
"lineIndex",
",",
"$",
"testable",
")",
"{",
"if",
"(",
"!",
"$",
"lineIndex",
")",
"{",
"return",
";",
"}",
"$",
"tokens",
"=",
"$",
"testable",
"->",
"tokens",
"(",
")",
";",
"$",
"lines... | Return the minimal space required for a multilined expression in an array definition.
@param int $lineIndex The index the current line is on
@param array $testable The testable object
@return int | [
"Return",
"the",
"minimal",
"space",
"required",
"for",
"a",
"multilined",
"expression",
"in",
"an",
"array",
"definition",
"."
] | acb72a43ae835e6d200bc0eba1a61aee610e36bf | https://github.com/UnionOfRAD/li3_quality/blob/acb72a43ae835e6d200bc0eba1a61aee610e36bf/qa/rules/syntax/HasCorrectTabIndention.php#L167-L194 | train |
UnionOfRAD/li3_quality | qa/rules/syntax/HasCorrectTabIndention.php | HasCorrectTabIndention._getIndent | protected function _getIndent($line) {
$count = $space = $tab = 0;
$end = strlen($line);
while (($count < $end) && ($line[$count] === "\t")) {
$tab++;
$count++;
}
while (($count < $end) && ($line[$count] === ' ')) {
$space++;
$count++;
}
return array(
'space' => $space,
'tab' => $tab
)... | php | protected function _getIndent($line) {
$count = $space = $tab = 0;
$end = strlen($line);
while (($count < $end) && ($line[$count] === "\t")) {
$tab++;
$count++;
}
while (($count < $end) && ($line[$count] === ' ')) {
$space++;
$count++;
}
return array(
'space' => $space,
'tab' => $tab
)... | [
"protected",
"function",
"_getIndent",
"(",
"$",
"line",
")",
"{",
"$",
"count",
"=",
"$",
"space",
"=",
"$",
"tab",
"=",
"0",
";",
"$",
"end",
"=",
"strlen",
"(",
"$",
"line",
")",
";",
"while",
"(",
"(",
"$",
"count",
"<",
"$",
"end",
")",
... | Will determine how many tabs are at the beginning of a line.
@param string $line The current line is on
@return bool | [
"Will",
"determine",
"how",
"many",
"tabs",
"are",
"at",
"the",
"beginning",
"of",
"a",
"line",
"."
] | acb72a43ae835e6d200bc0eba1a61aee610e36bf | https://github.com/UnionOfRAD/li3_quality/blob/acb72a43ae835e6d200bc0eba1a61aee610e36bf/qa/rules/syntax/HasCorrectTabIndention.php#L202-L217 | train |
ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.configure | public function configure($prefix, $resourceName, array $options)
{
$this->prefix = $prefix;
$this->resourceName = $resourceName;
$this->options = $this->getOptionsResolver()->resolve($options);
return $this;
} | php | public function configure($prefix, $resourceName, array $options)
{
$this->prefix = $prefix;
$this->resourceName = $resourceName;
$this->options = $this->getOptionsResolver()->resolve($options);
return $this;
} | [
"public",
"function",
"configure",
"(",
"$",
"prefix",
",",
"$",
"resourceName",
",",
"array",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"prefix",
"=",
"$",
"prefix",
";",
"$",
"this",
"->",
"resourceName",
"=",
"$",
"resourceName",
";",
"$",
"this"... | Configures the pool builder.
@param string $prefix
@param string $resourceName
@param array $options
@return PoolBuilder | [
"Configures",
"the",
"pool",
"builder",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L97-L104 | train |
ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.createEntityClassParameter | private function createEntityClassParameter()
{
$id = $this->getServiceId('class');
if (!$this->container->hasParameter($id)) {
$this->container->setParameter($id, $this->options['entity']);
}
$this->configureInheritanceMapping(
$this->prefix.'.'.$this->resou... | php | private function createEntityClassParameter()
{
$id = $this->getServiceId('class');
if (!$this->container->hasParameter($id)) {
$this->container->setParameter($id, $this->options['entity']);
}
$this->configureInheritanceMapping(
$this->prefix.'.'.$this->resou... | [
"private",
"function",
"createEntityClassParameter",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getServiceId",
"(",
"'class'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"->",
"hasParameter",
"(",
"$",
"id",
")",
")",
"{",
"$",
... | Creates the entity class parameter. | [
"Creates",
"the",
"entity",
"class",
"parameter",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L248-L260 | train |
ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.createConfigurationDefinition | private function createConfigurationDefinition()
{
$id = $this->getServiceId('configuration');
if (!$this->container->has($id)) {
$definition = new Definition(self::CONFIGURATION);
$definition
->setFactory([new Reference('ekyna_admin.pool_factory'), 'createCon... | php | private function createConfigurationDefinition()
{
$id = $this->getServiceId('configuration');
if (!$this->container->has($id)) {
$definition = new Definition(self::CONFIGURATION);
$definition
->setFactory([new Reference('ekyna_admin.pool_factory'), 'createCon... | [
"private",
"function",
"createConfigurationDefinition",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getServiceId",
"(",
"'configuration'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"$",... | Creates the Configuration service definition. | [
"Creates",
"the",
"Configuration",
"service",
"definition",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L265-L288 | train |
ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.buildTemplateList | private function buildTemplateList($templatesConfig)
{
$templateNamespace = self::DEFAULT_TEMPLATES;
if (is_string($templatesConfig)) {
$templateNamespace = $templatesConfig;
}
$templatesList = [];
foreach (self::$templates as $name => $extensions) {
f... | php | private function buildTemplateList($templatesConfig)
{
$templateNamespace = self::DEFAULT_TEMPLATES;
if (is_string($templatesConfig)) {
$templateNamespace = $templatesConfig;
}
$templatesList = [];
foreach (self::$templates as $name => $extensions) {
f... | [
"private",
"function",
"buildTemplateList",
"(",
"$",
"templatesConfig",
")",
"{",
"$",
"templateNamespace",
"=",
"self",
"::",
"DEFAULT_TEMPLATES",
";",
"if",
"(",
"is_string",
"(",
"$",
"templatesConfig",
")",
")",
"{",
"$",
"templateNamespace",
"=",
"$",
"t... | Builds the templates list.
@param mixed $templatesConfig
@return array | [
"Builds",
"the",
"templates",
"list",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L296-L314 | train |
ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.createManagerDefinition | private function createManagerDefinition()
{
$id = $this->getServiceId('manager');
if (!$this->container->has($id)) {
$this->container->setAlias($id, new Alias($this->getManagerServiceId()));
}
} | php | private function createManagerDefinition()
{
$id = $this->getServiceId('manager');
if (!$this->container->has($id)) {
$this->container->setAlias($id, new Alias($this->getManagerServiceId()));
}
} | [
"private",
"function",
"createManagerDefinition",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getServiceId",
"(",
"'manager'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
... | Creates the manager definition. | [
"Creates",
"the",
"manager",
"definition",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L337-L343 | train |
ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.createRepositoryDefinition | private function createRepositoryDefinition()
{
$id = $this->getServiceId('repository');
if (!$this->container->has($id)) {
$definition = new Definition($class = $this->getServiceClass('repository'));
$definition->setArguments([
new Reference($this->getService... | php | private function createRepositoryDefinition()
{
$id = $this->getServiceId('repository');
if (!$this->container->has($id)) {
$definition = new Definition($class = $this->getServiceClass('repository'));
$definition->setArguments([
new Reference($this->getService... | [
"private",
"function",
"createRepositoryDefinition",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getServiceId",
"(",
"'repository'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"$",
"de... | Creates the Repository service definition. | [
"Creates",
"the",
"Repository",
"service",
"definition",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L348-L365 | train |
ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.createOperatorDefinition | private function createOperatorDefinition()
{
$id = $this->getServiceId('operator');
if (!$this->container->has($id)) {
$definition = new Definition($this->getServiceClass('operator'));
$definition->setArguments([
new Reference($this->getManagerServiceId()),
... | php | private function createOperatorDefinition()
{
$id = $this->getServiceId('operator');
if (!$this->container->has($id)) {
$definition = new Definition($this->getServiceClass('operator'));
$definition->setArguments([
new Reference($this->getManagerServiceId()),
... | [
"private",
"function",
"createOperatorDefinition",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getServiceId",
"(",
"'operator'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"$",
"defini... | Creates the operator service definition.
@TODO Swap with ResourceManager when ready. | [
"Creates",
"the",
"operator",
"service",
"definition",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L372-L385 | train |
ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.createControllerDefinition | private function createControllerDefinition()
{
$id = $this->getServiceId('controller');
if (!$this->container->has($id)) {
$definition = new Definition($this->getServiceClass('controller'));
$definition
->addMethodCall('setConfiguration', [new Reference($this... | php | private function createControllerDefinition()
{
$id = $this->getServiceId('controller');
if (!$this->container->has($id)) {
$definition = new Definition($this->getServiceClass('controller'));
$definition
->addMethodCall('setConfiguration', [new Reference($this... | [
"private",
"function",
"createControllerDefinition",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getServiceId",
"(",
"'controller'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"$",
"de... | Creates the Controller service definition. | [
"Creates",
"the",
"Controller",
"service",
"definition",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L390-L401 | train |
ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.configureTranslations | private function configureTranslations()
{
if (null !== array_key_exists('translation', $this->options) && is_array($this->options['translation'])) {
$translatable = $this->options['entity'];
$translation = $this->options['translation']['entity'];
$id = sprintf('%s.%s_tr... | php | private function configureTranslations()
{
if (null !== array_key_exists('translation', $this->options) && is_array($this->options['translation'])) {
$translatable = $this->options['entity'];
$translation = $this->options['translation']['entity'];
$id = sprintf('%s.%s_tr... | [
"private",
"function",
"configureTranslations",
"(",
")",
"{",
"if",
"(",
"null",
"!==",
"array_key_exists",
"(",
"'translation'",
",",
"$",
"this",
"->",
"options",
")",
"&&",
"is_array",
"(",
"$",
"this",
"->",
"options",
"[",
"'translation'",
"]",
")",
... | Configure the translation | [
"Configure",
"the",
"translation"
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L442-L468 | train |
ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.configureInheritanceMapping | private function configureInheritanceMapping($id, $entity, $repository)
{
$entities = [
$id => [
'class' => $entity,
'repository' => $repository,
],
];
if ($this->container->hasParameter('ekyna_core.entities')) {
$enti... | php | private function configureInheritanceMapping($id, $entity, $repository)
{
$entities = [
$id => [
'class' => $entity,
'repository' => $repository,
],
];
if ($this->container->hasParameter('ekyna_core.entities')) {
$enti... | [
"private",
"function",
"configureInheritanceMapping",
"(",
"$",
"id",
",",
"$",
"entity",
",",
"$",
"repository",
")",
"{",
"$",
"entities",
"=",
"[",
"$",
"id",
"=>",
"[",
"'class'",
"=>",
"$",
"entity",
",",
"'repository'",
"=>",
"$",
"repository",
","... | Configures mapping inheritance.
@param string $id
@param string $entity
@param string $repository | [
"Configures",
"mapping",
"inheritance",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L477-L490 | train |
ekyna/AdminBundle | DependencyInjection/PoolBuilder.php | PoolBuilder.getServiceClass | private function getServiceClass($name)
{
$serviceId = $this->getServiceId($name);
$parameterId = $serviceId.'.class';
if ($this->container->hasParameter($parameterId)) {
$class = $this->container->getParameter($parameterId);
} elseif (array_key_exists($name, $this->optio... | php | private function getServiceClass($name)
{
$serviceId = $this->getServiceId($name);
$parameterId = $serviceId.'.class';
if ($this->container->hasParameter($parameterId)) {
$class = $this->container->getParameter($parameterId);
} elseif (array_key_exists($name, $this->optio... | [
"private",
"function",
"getServiceClass",
"(",
"$",
"name",
")",
"{",
"$",
"serviceId",
"=",
"$",
"this",
"->",
"getServiceId",
"(",
"$",
"name",
")",
";",
"$",
"parameterId",
"=",
"$",
"serviceId",
".",
"'.class'",
";",
"if",
"(",
"$",
"this",
"->",
... | Returns the service class for the given name.
@param string $name
@throws \RuntimeException
@return string|null | [
"Returns",
"the",
"service",
"class",
"for",
"the",
"given",
"name",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/DependencyInjection/PoolBuilder.php#L533-L545 | train |
schpill/thin | src/Html/Qwerly/User.php | User.getDescription | public function getDescription()
{
return isset($this->_data[self::PROFILE][self::DESCRIPTION]) ? $this->_data[self::PROFILE][self::DESCRIPTION] : null;
} | php | public function getDescription()
{
return isset($this->_data[self::PROFILE][self::DESCRIPTION]) ? $this->_data[self::PROFILE][self::DESCRIPTION] : null;
} | [
"public",
"function",
"getDescription",
"(",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
"]",
"[",
"self",
"::",
"DESCRIPTION",
"]",
")",
"?",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
"... | Retrieves the user's description.
@return string | [
"Retrieves",
"the",
"user",
"s",
"description",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Qwerly/User.php#L32-L35 | train |
schpill/thin | src/Html/Qwerly/User.php | User.getName | public function getName()
{
return isset($this->_data[self::PROFILE][self::NAME]) ? $this->_data[self::PROFILE][self::NAME] : null;
} | php | public function getName()
{
return isset($this->_data[self::PROFILE][self::NAME]) ? $this->_data[self::PROFILE][self::NAME] : null;
} | [
"public",
"function",
"getName",
"(",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
"]",
"[",
"self",
"::",
"NAME",
"]",
")",
"?",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
"]",
"[",
"... | Retrieves the user's name.
@return string | [
"Retrieves",
"the",
"user",
"s",
"name",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Qwerly/User.php#L42-L45 | train |
schpill/thin | src/Html/Qwerly/User.php | User.getLocation | public function getLocation()
{
return isset($this->_data[self::PROFILE][self::LOCATION]) ? $this->_data[self::PROFILE][self::LOCATION] : null;
} | php | public function getLocation()
{
return isset($this->_data[self::PROFILE][self::LOCATION]) ? $this->_data[self::PROFILE][self::LOCATION] : null;
} | [
"public",
"function",
"getLocation",
"(",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
"]",
"[",
"self",
"::",
"LOCATION",
"]",
")",
"?",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
"]",
... | Retrieves the user's location.
@return string | [
"Retrieves",
"the",
"user",
"s",
"location",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Qwerly/User.php#L53-L56 | train |
schpill/thin | src/Html/Qwerly/User.php | User.getTwitter | public function getTwitter()
{
return isset($this->_data[self::PROFILE][self::TWITTER_USERNAME]) ? $this->_data[self::PROFILE][self::TWITTER_USERNAME] : null;
} | php | public function getTwitter()
{
return isset($this->_data[self::PROFILE][self::TWITTER_USERNAME]) ? $this->_data[self::PROFILE][self::TWITTER_USERNAME] : null;
} | [
"public",
"function",
"getTwitter",
"(",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
"]",
"[",
"self",
"::",
"TWITTER_USERNAME",
"]",
")",
"?",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
... | Retrieves the user's twitter username.
@return string | [
"Retrieves",
"the",
"user",
"s",
"twitter",
"username",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Qwerly/User.php#L63-L66 | train |
schpill/thin | src/Html/Qwerly/User.php | User.getWebsite | public function getWebsite()
{
return isset($this->_data[self::PROFILE][self::WEBSITE]) ? $this->_data[self::PROFILE][self::WEBSITE] : null;
} | php | public function getWebsite()
{
return isset($this->_data[self::PROFILE][self::WEBSITE]) ? $this->_data[self::PROFILE][self::WEBSITE] : null;
} | [
"public",
"function",
"getWebsite",
"(",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
"]",
"[",
"self",
"::",
"WEBSITE",
"]",
")",
"?",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
"]",
"[... | Retrievs the user's website.
@return string | [
"Retrievs",
"the",
"user",
"s",
"website",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Qwerly/User.php#L73-L76 | train |
schpill/thin | src/Html/Qwerly/User.php | User.getServices | public function getServices()
{
return isset($this->_data[self::PROFILE][self::SERVICES]) ? $this->_data[self::PROFILE][self::SERVICES] : null;
} | php | public function getServices()
{
return isset($this->_data[self::PROFILE][self::SERVICES]) ? $this->_data[self::PROFILE][self::SERVICES] : null;
} | [
"public",
"function",
"getServices",
"(",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
"]",
"[",
"self",
"::",
"SERVICES",
"]",
")",
"?",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
"]",
... | Retrieves the user's services.
@return array | [
"Retrieves",
"the",
"user",
"s",
"services",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Qwerly/User.php#L83-L86 | train |
schpill/thin | src/Html/Qwerly/User.php | User.getQwerly | public function getQwerly()
{
return isset($this->_data[self::PROFILE][self::QWERLY]) ? $this->_data[self::PROFILE][self::QWERLY] : null;
} | php | public function getQwerly()
{
return isset($this->_data[self::PROFILE][self::QWERLY]) ? $this->_data[self::PROFILE][self::QWERLY] : null;
} | [
"public",
"function",
"getQwerly",
"(",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
"]",
"[",
"self",
"::",
"QWERLY",
"]",
")",
"?",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
"]",
"[",... | Retrieves the user's qwerly username.
@return string | [
"Retrieves",
"the",
"user",
"s",
"qwerly",
"username",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Qwerly/User.php#L93-L96 | train |
schpill/thin | src/Html/Qwerly/User.php | User.getFacebook | public function getFacebook()
{
return isset($this->_data[self::PROFILE][self::FACEBOOK_ID]) ? $this->_data[self::PROFILE][self::FACEBOOK_ID] : null;
} | php | public function getFacebook()
{
return isset($this->_data[self::PROFILE][self::FACEBOOK_ID]) ? $this->_data[self::PROFILE][self::FACEBOOK_ID] : null;
} | [
"public",
"function",
"getFacebook",
"(",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
"]",
"[",
"self",
"::",
"FACEBOOK_ID",
"]",
")",
"?",
"$",
"this",
"->",
"_data",
"[",
"self",
"::",
"PROFILE",
"]",... | Retrieves the user's facebook id.
@return int | [
"Retrieves",
"the",
"user",
"s",
"facebook",
"id",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Qwerly/User.php#L103-L106 | train |
oliwierptak/Everon1 | src/Everon/Helper/AlphaId.php | AlphaId.alphaId | function alphaId($in, $to_num = false, $pad_up = false, $pass_key = null)
{
$out = '';
$index = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$base = strlen($index);
if ($pass_key !== null) {
// Although this function's purpose is to just make th... | php | function alphaId($in, $to_num = false, $pad_up = false, $pass_key = null)
{
$out = '';
$index = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$base = strlen($index);
if ($pass_key !== null) {
// Although this function's purpose is to just make th... | [
"function",
"alphaId",
"(",
"$",
"in",
",",
"$",
"to_num",
"=",
"false",
",",
"$",
"pad_up",
"=",
"false",
",",
"$",
"pass_key",
"=",
"null",
")",
"{",
"$",
"out",
"=",
"''",
";",
"$",
"index",
"=",
"'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRS... | Translates a number to a short alhanumeric version
Translated any number up to 9007199254740992
to a shorter version in letters e.g.:
9007199254740989 --> PpQXn7COf
specifiying the second argument true, it will
translate back e.g.:
PpQXn7COf --> 9007199254740989
this function is based on any2dec && dec2any by
fragme... | [
"Translates",
"a",
"number",
"to",
"a",
"short",
"alhanumeric",
"version"
] | ac93793d1fa517a8394db5f00062f1925dc218a3 | https://github.com/oliwierptak/Everon1/blob/ac93793d1fa517a8394db5f00062f1925dc218a3/src/Everon/Helper/AlphaId.php#L107-L170 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Cancel.php | EbayEnterprise_Order_Model_Cancel._buildRequest | protected function _buildRequest()
{
$this->_request = $this->_factory
->getNewCancelBuildRequest($this->_api, $this->_order)
->build();
return $this;
} | php | protected function _buildRequest()
{
$this->_request = $this->_factory
->getNewCancelBuildRequest($this->_api, $this->_order)
->build();
return $this;
} | [
"protected",
"function",
"_buildRequest",
"(",
")",
"{",
"$",
"this",
"->",
"_request",
"=",
"$",
"this",
"->",
"_factory",
"->",
"getNewCancelBuildRequest",
"(",
"$",
"this",
"->",
"_api",
",",
"$",
"this",
"->",
"_order",
")",
"->",
"build",
"(",
")",
... | Build order cancel payload.
@return self | [
"Build",
"order",
"cancel",
"payload",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Cancel.php#L105-L111 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Cancel.php | EbayEnterprise_Order_Model_Cancel._sendRequest | protected function _sendRequest()
{
$this->_response = $this->_factory
->getNewCancelSendRequest($this->_api, $this->_request)
->send();
return $this;
} | php | protected function _sendRequest()
{
$this->_response = $this->_factory
->getNewCancelSendRequest($this->_api, $this->_request)
->send();
return $this;
} | [
"protected",
"function",
"_sendRequest",
"(",
")",
"{",
"$",
"this",
"->",
"_response",
"=",
"$",
"this",
"->",
"_factory",
"->",
"getNewCancelSendRequest",
"(",
"$",
"this",
"->",
"_api",
",",
"$",
"this",
"->",
"_request",
")",
"->",
"send",
"(",
")",
... | Send order cancel payload.
@return self | [
"Send",
"order",
"cancel",
"payload",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Cancel.php#L118-L124 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Cancel.php | EbayEnterprise_Order_Model_Cancel._processResponse | protected function _processResponse()
{
$this->_factory
->getNewCancelProcessResponse($this->_response, $this->_order)
->process();
return $this;
} | php | protected function _processResponse()
{
$this->_factory
->getNewCancelProcessResponse($this->_response, $this->_order)
->process();
return $this;
} | [
"protected",
"function",
"_processResponse",
"(",
")",
"{",
"$",
"this",
"->",
"_factory",
"->",
"getNewCancelProcessResponse",
"(",
"$",
"this",
"->",
"_response",
",",
"$",
"this",
"->",
"_order",
")",
"->",
"process",
"(",
")",
";",
"return",
"$",
"this... | Process order cancel response.
@return self | [
"Process",
"order",
"cancel",
"response",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Cancel.php#L131-L137 | train |
chippyash/Currency | src/Chippyash/Currency/Factory.php | Factory.create | public static function create($code, $value = 0)
{
$cd = strtoupper($code);
list($symbol, $precision, $name) = self::getDefinition($cd);
$crcy = new Currency($value, $cd, $symbol, $precision, $name);
$crcy->setLocale(self::getLocale());
return $crcy;
} | php | public static function create($code, $value = 0)
{
$cd = strtoupper($code);
list($symbol, $precision, $name) = self::getDefinition($cd);
$crcy = new Currency($value, $cd, $symbol, $precision, $name);
$crcy->setLocale(self::getLocale());
return $crcy;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"code",
",",
"$",
"value",
"=",
"0",
")",
"{",
"$",
"cd",
"=",
"strtoupper",
"(",
"$",
"code",
")",
";",
"list",
"(",
"$",
"symbol",
",",
"$",
"precision",
",",
"$",
"name",
")",
"=",
"self",
... | Create a currency
@param string $code Currency 3 letter ISO4217 code
@param int $value initial value for currency
@return Currency
@throws \ErrorException | [
"Create",
"a",
"currency"
] | d2c6a3da2d1443818b98206ec2cb8f34c2a3be84 | https://github.com/chippyash/Currency/blob/d2c6a3da2d1443818b98206ec2cb8f34c2a3be84/src/Chippyash/Currency/Factory.php#L41-L49 | train |
chippyash/Currency | src/Chippyash/Currency/Factory.php | Factory.getDefinition | protected static function getDefinition($code)
{
$currencies = self::getDefinitions();
$nodes = $currencies->xpath("//currency[@code='{$code}']");
if (empty($nodes)) {
throw new \InvalidArgumentException("Unknown currency: {$code}");
}
$cNode = $nodes[0];
... | php | protected static function getDefinition($code)
{
$currencies = self::getDefinitions();
$nodes = $currencies->xpath("//currency[@code='{$code}']");
if (empty($nodes)) {
throw new \InvalidArgumentException("Unknown currency: {$code}");
}
$cNode = $nodes[0];
... | [
"protected",
"static",
"function",
"getDefinition",
"(",
"$",
"code",
")",
"{",
"$",
"currencies",
"=",
"self",
"::",
"getDefinitions",
"(",
")",
";",
"$",
"nodes",
"=",
"$",
"currencies",
"->",
"xpath",
"(",
"\"//currency[@code='{$code}']\"",
")",
";",
"if"... | Get a currency definition
@param string $code ISO4217 currency code
@return array ['symbol','precision', 'name']
@throws \ErrorException | [
"Get",
"a",
"currency",
"definition"
] | d2c6a3da2d1443818b98206ec2cb8f34c2a3be84 | https://github.com/chippyash/Currency/blob/d2c6a3da2d1443818b98206ec2cb8f34c2a3be84/src/Chippyash/Currency/Factory.php#L84-L101 | train |
chippyash/Currency | src/Chippyash/Currency/Factory.php | Factory.getDefinitions | protected static function getDefinitions()
{
if (empty(self::$definitions)) {
self::$definitions = \simplexml_load_file(__DIR__ . '/currencies.xml');
}
return self::$definitions;
} | php | protected static function getDefinitions()
{
if (empty(self::$definitions)) {
self::$definitions = \simplexml_load_file(__DIR__ . '/currencies.xml');
}
return self::$definitions;
} | [
"protected",
"static",
"function",
"getDefinitions",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"self",
"::",
"$",
"definitions",
")",
")",
"{",
"self",
"::",
"$",
"definitions",
"=",
"\\",
"simplexml_load_file",
"(",
"__DIR__",
".",
"'/currencies.xml'",
")",
... | Load currency definitions
@return \SimpleXMLElement | [
"Load",
"currency",
"definitions"
] | d2c6a3da2d1443818b98206ec2cb8f34c2a3be84 | https://github.com/chippyash/Currency/blob/d2c6a3da2d1443818b98206ec2cb8f34c2a3be84/src/Chippyash/Currency/Factory.php#L108-L115 | train |
chippyash/Currency | src/Chippyash/Currency/Factory.php | Factory.createSymbol | protected static function createSymbol(\SimpleXMLElement $sNode, $code)
{
switch((string) $sNode['type']) {
case 'UCS':
$symbol = (string) $sNode['UTF-8'];
break;
case null: //no symbol - use code
default:
$symbol = $code;
... | php | protected static function createSymbol(\SimpleXMLElement $sNode, $code)
{
switch((string) $sNode['type']) {
case 'UCS':
$symbol = (string) $sNode['UTF-8'];
break;
case null: //no symbol - use code
default:
$symbol = $code;
... | [
"protected",
"static",
"function",
"createSymbol",
"(",
"\\",
"SimpleXMLElement",
"$",
"sNode",
",",
"$",
"code",
")",
"{",
"switch",
"(",
"(",
"string",
")",
"$",
"sNode",
"[",
"'type'",
"]",
")",
"{",
"case",
"'UCS'",
":",
"$",
"symbol",
"=",
"(",
... | Create currency symbol from the symbol node
@param \SimpleXMLElement $sNode
@param string $code currency code
@return string | [
"Create",
"currency",
"symbol",
"from",
"the",
"symbol",
"node"
] | d2c6a3da2d1443818b98206ec2cb8f34c2a3be84 | https://github.com/chippyash/Currency/blob/d2c6a3da2d1443818b98206ec2cb8f34c2a3be84/src/Chippyash/Currency/Factory.php#L125-L138 | train |
chippyash/Currency | src/Chippyash/Currency/Factory.php | Factory.createName | protected static function createName(\SimpleXMLElement $currency)
{
$locale = self::getLocale();
//first - see if we have an exact locale match
$nodes = $currency->xpath("name[@lang='{$locale}']");
if (count($nodes) > 0) {
return (string) $nodes[0];
}
//n... | php | protected static function createName(\SimpleXMLElement $currency)
{
$locale = self::getLocale();
//first - see if we have an exact locale match
$nodes = $currency->xpath("name[@lang='{$locale}']");
if (count($nodes) > 0) {
return (string) $nodes[0];
}
//n... | [
"protected",
"static",
"function",
"createName",
"(",
"\\",
"SimpleXMLElement",
"$",
"currency",
")",
"{",
"$",
"locale",
"=",
"self",
"::",
"getLocale",
"(",
")",
";",
"//first - see if we have an exact locale match",
"$",
"nodes",
"=",
"$",
"currency",
"->",
"... | Find closest matching name for a currency based on currently set locale.
Default to 'en' entry if none more suitable found
@param \SimpleXMLElement $currency
@return string | [
"Find",
"closest",
"matching",
"name",
"for",
"a",
"currency",
"based",
"on",
"currently",
"set",
"locale",
".",
"Default",
"to",
"en",
"entry",
"if",
"none",
"more",
"suitable",
"found"
] | d2c6a3da2d1443818b98206ec2cb8f34c2a3be84 | https://github.com/chippyash/Currency/blob/d2c6a3da2d1443818b98206ec2cb8f34c2a3be84/src/Chippyash/Currency/Factory.php#L148-L167 | train |
gplcart/file_manager | handlers/commands/Command.php | Command.getTotal | protected function getTotal($directory, array $options = array())
{
$options['count'] = true;
return (int) $this->scanner->scan($directory, $options);
} | php | protected function getTotal($directory, array $options = array())
{
$options['count'] = true;
return (int) $this->scanner->scan($directory, $options);
} | [
"protected",
"function",
"getTotal",
"(",
"$",
"directory",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"options",
"[",
"'count'",
"]",
"=",
"true",
";",
"return",
"(",
"int",
")",
"$",
"this",
"->",
"scanner",
"->",
"scan",
... | Returns a total number of scanned files
@param string $directory
@param array $options
@return integer | [
"Returns",
"a",
"total",
"number",
"of",
"scanned",
"files"
] | 45424e93eafea75d31af6410ac9cf110f08e500a | https://github.com/gplcart/file_manager/blob/45424e93eafea75d31af6410ac9cf110f08e500a/handlers/commands/Command.php#L59-L63 | train |
gplcart/file_manager | handlers/commands/Command.php | Command.getRelativePath | protected function getRelativePath($path = null)
{
if (!isset($path)) {
$path = $this->scanner->getInitialPath(true);
}
return gplcart_path_normalize(gplcart_path_relative($path));
} | php | protected function getRelativePath($path = null)
{
if (!isset($path)) {
$path = $this->scanner->getInitialPath(true);
}
return gplcart_path_normalize(gplcart_path_relative($path));
} | [
"protected",
"function",
"getRelativePath",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"path",
")",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"scanner",
"->",
"getInitialPath",
"(",
"true",
")",
";",
"}",
"retu... | Returns a relative file path or initial directory
@param null|string $path
@return string | [
"Returns",
"a",
"relative",
"file",
"path",
"or",
"initial",
"directory"
] | 45424e93eafea75d31af6410ac9cf110f08e500a | https://github.com/gplcart/file_manager/blob/45424e93eafea75d31af6410ac9cf110f08e500a/handlers/commands/Command.php#L91-L98 | train |
gplcart/file_manager | handlers/commands/Command.php | Command.move | protected function move($src, $dest, &$errors = 0, &$success = 0)
{
$this->copy($src, $dest, $errors, $success);
if (empty($errors)) {
gplcart_file_delete_recursive($src, $errors);
}
return empty($errors);
} | php | protected function move($src, $dest, &$errors = 0, &$success = 0)
{
$this->copy($src, $dest, $errors, $success);
if (empty($errors)) {
gplcart_file_delete_recursive($src, $errors);
}
return empty($errors);
} | [
"protected",
"function",
"move",
"(",
"$",
"src",
",",
"$",
"dest",
",",
"&",
"$",
"errors",
"=",
"0",
",",
"&",
"$",
"success",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"copy",
"(",
"$",
"src",
",",
"$",
"dest",
",",
"$",
"errors",
",",
"$",
... | Moves a file to a new destination
@param string $src
@param string $dest
@param int $errors
@param int $success
@return bool | [
"Moves",
"a",
"file",
"to",
"a",
"new",
"destination"
] | 45424e93eafea75d31af6410ac9cf110f08e500a | https://github.com/gplcart/file_manager/blob/45424e93eafea75d31af6410ac9cf110f08e500a/handlers/commands/Command.php#L118-L127 | train |
gplcart/file_manager | handlers/commands/Command.php | Command.isInitialPath | protected function isInitialPath($file)
{
$current_path = gplcart_path_normalize($file->getRealPath());
$initial_path = gplcart_path_normalize($this->scanner->getInitialPath(true));
return $current_path === $initial_path;
} | php | protected function isInitialPath($file)
{
$current_path = gplcart_path_normalize($file->getRealPath());
$initial_path = gplcart_path_normalize($this->scanner->getInitialPath(true));
return $current_path === $initial_path;
} | [
"protected",
"function",
"isInitialPath",
"(",
"$",
"file",
")",
"{",
"$",
"current_path",
"=",
"gplcart_path_normalize",
"(",
"$",
"file",
"->",
"getRealPath",
"(",
")",
")",
";",
"$",
"initial_path",
"=",
"gplcart_path_normalize",
"(",
"$",
"this",
"->",
"... | Whether the current file is the initial file manager path
@param \SplFileInfo $file
@return bool | [
"Whether",
"the",
"current",
"file",
"is",
"the",
"initial",
"file",
"manager",
"path"
] | 45424e93eafea75d31af6410ac9cf110f08e500a | https://github.com/gplcart/file_manager/blob/45424e93eafea75d31af6410ac9cf110f08e500a/handlers/commands/Command.php#L184-L190 | train |
heliopsis/ezforms-bundle | Heliopsis/eZFormsBundle/FormHandler/MultiplexerHandler.php | MultiplexerHandler.setLocation | public function setLocation( Location $location )
{
foreach ( $this->handlers as $handler )
{
if ( $handler instanceof LocationAwareHandlerInterface )
{
$handler->setLocation( $location );
}
}
} | php | public function setLocation( Location $location )
{
foreach ( $this->handlers as $handler )
{
if ( $handler instanceof LocationAwareHandlerInterface )
{
$handler->setLocation( $location );
}
}
} | [
"public",
"function",
"setLocation",
"(",
"Location",
"$",
"location",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"handlers",
"as",
"$",
"handler",
")",
"{",
"if",
"(",
"$",
"handler",
"instanceof",
"LocationAwareHandlerInterface",
")",
"{",
"$",
"handler"... | Passes location to location aware handlers
@param \eZ\Publish\API\Repository\Values\Content\Location $location | [
"Passes",
"location",
"to",
"location",
"aware",
"handlers"
] | ed87feeb76fcdcd4a4e355d4bc60b83077ba90b4 | https://github.com/heliopsis/ezforms-bundle/blob/ed87feeb76fcdcd4a4e355d4bc60b83077ba90b4/Heliopsis/eZFormsBundle/FormHandler/MultiplexerHandler.php#L62-L71 | train |
heliopsis/ezforms-bundle | Heliopsis/eZFormsBundle/FormHandler/MultiplexerHandler.php | MultiplexerHandler.setContent | public function setContent( Content $content )
{
foreach ( $this->handlers as $handler )
{
if ( $handler instanceof ContentAwareHandlerInterface )
{
$handler->setContent( $content );
}
}
} | php | public function setContent( Content $content )
{
foreach ( $this->handlers as $handler )
{
if ( $handler instanceof ContentAwareHandlerInterface )
{
$handler->setContent( $content );
}
}
} | [
"public",
"function",
"setContent",
"(",
"Content",
"$",
"content",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"handlers",
"as",
"$",
"handler",
")",
"{",
"if",
"(",
"$",
"handler",
"instanceof",
"ContentAwareHandlerInterface",
")",
"{",
"$",
"handler",
... | Passes content to content aware handlers
@param \eZ\Publish\API\Repository\Values\Content\Content $content | [
"Passes",
"content",
"to",
"content",
"aware",
"handlers"
] | ed87feeb76fcdcd4a4e355d4bc60b83077ba90b4 | https://github.com/heliopsis/ezforms-bundle/blob/ed87feeb76fcdcd4a4e355d4bc60b83077ba90b4/Heliopsis/eZFormsBundle/FormHandler/MultiplexerHandler.php#L77-L86 | train |
valu-digital/valuso | src/ValuSo/Controller/ServiceController.php | ServiceController.httpAction | public function httpAction()
{
$status = self::STATUS_SUCCESS;
$responses = array();
$exception = null;
$data = null;
$debug = $this->getRouteParam('debug', false);
try {
$service = $this->fetchService();
$operation = $service ? $this->f... | php | public function httpAction()
{
$status = self::STATUS_SUCCESS;
$responses = array();
$exception = null;
$data = null;
$debug = $this->getRouteParam('debug', false);
try {
$service = $this->fetchService();
$operation = $service ? $this->f... | [
"public",
"function",
"httpAction",
"(",
")",
"{",
"$",
"status",
"=",
"self",
"::",
"STATUS_SUCCESS",
";",
"$",
"responses",
"=",
"array",
"(",
")",
";",
"$",
"exception",
"=",
"null",
";",
"$",
"data",
"=",
"null",
";",
"$",
"debug",
"=",
"$",
"t... | Performs service operation matched by HTTP router
@throws \Exception
@return Response | [
"Performs",
"service",
"operation",
"matched",
"by",
"HTTP",
"router"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Controller/ServiceController.php#L184-L250 | train |
valu-digital/valuso | src/ValuSo/Controller/ServiceController.php | ServiceController.consoleAction | public function consoleAction()
{
$request = $this->getRequest();
$service = $this->fetchService();
$operation = $this->fetchOperation();
$query = $this->fetchConsoleQuery();
if (!$request instanceof ConsoleRequest) {
throw new \RuntimeException('You can only use this ac... | php | public function consoleAction()
{
$request = $this->getRequest();
$service = $this->fetchService();
$operation = $this->fetchOperation();
$query = $this->fetchConsoleQuery();
if (!$request instanceof ConsoleRequest) {
throw new \RuntimeException('You can only use this ac... | [
"public",
"function",
"consoleAction",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"$",
"service",
"=",
"$",
"this",
"->",
"fetchService",
"(",
")",
";",
"$",
"operation",
"=",
"$",
"this",
"->",
"fetchOperation"... | Performs service operation routed by console router | [
"Performs",
"service",
"operation",
"routed",
"by",
"console",
"router"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Controller/ServiceController.php#L255-L283 | train |
valu-digital/valuso | src/ValuSo/Controller/ServiceController.php | ServiceController.prepareHttpResponse | protected function prepareHttpResponse($data, $status, $exception = null)
{
$error = $this->getRequest()->getHeader(
self::HEADER_ERRORS,
self::HEADER_ERRORS_DEFAULT);
$forceHtmlContentType = $this->getRequest()->getHeader(
self::HEADER_FORCE_CONTENT_HTML,
... | php | protected function prepareHttpResponse($data, $status, $exception = null)
{
$error = $this->getRequest()->getHeader(
self::HEADER_ERRORS,
self::HEADER_ERRORS_DEFAULT);
$forceHtmlContentType = $this->getRequest()->getHeader(
self::HEADER_FORCE_CONTENT_HTML,
... | [
"protected",
"function",
"prepareHttpResponse",
"(",
"$",
"data",
",",
"$",
"status",
",",
"$",
"exception",
"=",
"null",
")",
"{",
"$",
"error",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getHeader",
"(",
"self",
"::",
"HEADER_ERRORS",
",",
... | Prepares HTTP response
@param mixed $data
@param int $status
@param \Exception|null $exception
@return Response | [
"Prepares",
"HTTP",
"response"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Controller/ServiceController.php#L312-L427 | train |
valu-digital/valuso | src/ValuSo/Controller/ServiceController.php | ServiceController.prepareConsoleResponse | protected function prepareConsoleResponse($data, \Exception $exception = null, $verbose = false, $silent = false)
{
$response = new ConsoleResponse();
try {
if (is_array($data) || is_object($data)) {
$json = JsonEncoder::encode($data, true);
$data = Json::prettyPrint(... | php | protected function prepareConsoleResponse($data, \Exception $exception = null, $verbose = false, $silent = false)
{
$response = new ConsoleResponse();
try {
if (is_array($data) || is_object($data)) {
$json = JsonEncoder::encode($data, true);
$data = Json::prettyPrint(... | [
"protected",
"function",
"prepareConsoleResponse",
"(",
"$",
"data",
",",
"\\",
"Exception",
"$",
"exception",
"=",
"null",
",",
"$",
"verbose",
"=",
"false",
",",
"$",
"silent",
"=",
"false",
")",
"{",
"$",
"response",
"=",
"new",
"ConsoleResponse",
"(",
... | Prepares console response
@param mixed $data
@param \Exception|null $exception
@param boolean $verbose
@param boolean $silent
@return ConsoleResponse | [
"Prepares",
"console",
"response"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Controller/ServiceController.php#L438-L474 | train |
valu-digital/valuso | src/ValuSo/Controller/ServiceController.php | ServiceController.fetchService | protected function fetchService()
{
$service = $this->getRouteParam('service');
$service = $this->parseCanonicalName($service, true);
if (preg_match($this->servicePattern, $service)) {
return $service;
} else {
return false;
}
} | php | protected function fetchService()
{
$service = $this->getRouteParam('service');
$service = $this->parseCanonicalName($service, true);
if (preg_match($this->servicePattern, $service)) {
return $service;
} else {
return false;
}
} | [
"protected",
"function",
"fetchService",
"(",
")",
"{",
"$",
"service",
"=",
"$",
"this",
"->",
"getRouteParam",
"(",
"'service'",
")",
";",
"$",
"service",
"=",
"$",
"this",
"->",
"parseCanonicalName",
"(",
"$",
"service",
",",
"true",
")",
";",
"if",
... | Parse service name from request
@return string|boolean | [
"Parse",
"service",
"name",
"from",
"request"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Controller/ServiceController.php#L481-L491 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.