id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
18,300
redaigbaria/oauth2
src/Entity/EntityTrait.php
EntityTrait.hydrate
public function hydrate(array $properties) { foreach ($properties as $prop => $val) { if (property_exists($this, $prop)) { $this->{$prop} = $val; } } return $this; }
php
public function hydrate(array $properties) { foreach ($properties as $prop => $val) { if (property_exists($this, $prop)) { $this->{$prop} = $val; } } return $this; }
[ "public", "function", "hydrate", "(", "array", "$", "properties", ")", "{", "foreach", "(", "$", "properties", "as", "$", "prop", "=>", "$", "val", ")", "{", "if", "(", "property_exists", "(", "$", "this", ",", "$", "prop", ")", ")", "{", "$", "this", "->", "{", "$", "prop", "}", "=", "$", "val", ";", "}", "}", "return", "$", "this", ";", "}" ]
Hydrate an entity with properites @param array $properties @return self
[ "Hydrate", "an", "entity", "with", "properites" ]
54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/Entity/EntityTrait.php#L23-L32
18,301
titon/db
src/Titon/Db/Query/Join.php
Join.from
public function from($table, $alias = null) { $this->_table = (string) $table; $this->asAlias($alias); return $this; }
php
public function from($table, $alias = null) { $this->_table = (string) $table; $this->asAlias($alias); return $this; }
[ "public", "function", "from", "(", "$", "table", ",", "$", "alias", "=", "null", ")", "{", "$", "this", "->", "_table", "=", "(", "string", ")", "$", "table", ";", "$", "this", "->", "asAlias", "(", "$", "alias", ")", ";", "return", "$", "this", ";", "}" ]
Set the table to join against. @param string $table @param string $alias @return $this
[ "Set", "the", "table", "to", "join", "against", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Query/Join.php#L91-L96
18,302
titon/db
src/Titon/Db/Query/Join.php
Join.on
public function on($foreignKey, $key = null) { if (is_array($foreignKey)) { $this->_conditions = array_replace($this->_conditions, $foreignKey); } else { $this->_conditions[$foreignKey] = $key; } return $this; }
php
public function on($foreignKey, $key = null) { if (is_array($foreignKey)) { $this->_conditions = array_replace($this->_conditions, $foreignKey); } else { $this->_conditions[$foreignKey] = $key; } return $this; }
[ "public", "function", "on", "(", "$", "foreignKey", ",", "$", "key", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "foreignKey", ")", ")", "{", "$", "this", "->", "_conditions", "=", "array_replace", "(", "$", "this", "->", "_conditions", ",", "$", "foreignKey", ")", ";", "}", "else", "{", "$", "this", "->", "_conditions", "[", "$", "foreignKey", "]", "=", "$", "key", ";", "}", "return", "$", "this", ";", "}" ]
Set the conditions to join on. @param string $foreignKey @param string $key @return $this
[ "Set", "the", "conditions", "to", "join", "on", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Query/Join.php#L141-L149
18,303
Lansoweb/LosReCaptcha
src/ConfigProvider.php
ConfigProvider.getViewHelperConfig
public function getViewHelperConfig() { return [ 'aliases' => [ 'losrecaptcha/recaptcha' => Form\View\Helper\Captcha\ReCaptcha::class, 'losrecaptcha/invisible' => Form\View\Helper\Captcha\Invisible::class, ], 'factories' => [ Form\View\Helper\Captcha\ReCaptcha::class => InvokableFactory::class, Form\View\Helper\Captcha\Invisible::class => InvokableFactory::class, ], ]; }
php
public function getViewHelperConfig() { return [ 'aliases' => [ 'losrecaptcha/recaptcha' => Form\View\Helper\Captcha\ReCaptcha::class, 'losrecaptcha/invisible' => Form\View\Helper\Captcha\Invisible::class, ], 'factories' => [ Form\View\Helper\Captcha\ReCaptcha::class => InvokableFactory::class, Form\View\Helper\Captcha\Invisible::class => InvokableFactory::class, ], ]; }
[ "public", "function", "getViewHelperConfig", "(", ")", "{", "return", "[", "'aliases'", "=>", "[", "'losrecaptcha/recaptcha'", "=>", "Form", "\\", "View", "\\", "Helper", "\\", "Captcha", "\\", "ReCaptcha", "::", "class", ",", "'losrecaptcha/invisible'", "=>", "Form", "\\", "View", "\\", "Helper", "\\", "Captcha", "\\", "Invisible", "::", "class", ",", "]", ",", "'factories'", "=>", "[", "Form", "\\", "View", "\\", "Helper", "\\", "Captcha", "\\", "ReCaptcha", "::", "class", "=>", "InvokableFactory", "::", "class", ",", "Form", "\\", "View", "\\", "Helper", "\\", "Captcha", "\\", "Invisible", "::", "class", "=>", "InvokableFactory", "::", "class", ",", "]", ",", "]", ";", "}" ]
Return zend-view helper configuration. @return array
[ "Return", "zend", "-", "view", "helper", "configuration", "." ]
8df866995501db087c3850f97fd2b6547632e6ed
https://github.com/Lansoweb/LosReCaptcha/blob/8df866995501db087c3850f97fd2b6547632e6ed/src/ConfigProvider.php#L23-L35
18,304
xinix-technology/norm
src/Norm/Filter/Filter.php
Filter.fromSchema
public static function fromSchema($schema, $preFilter = array(), $postFilter = array()) { $rules = array(); foreach ($preFilter as $key => $filter) { $filter = explode('|', $filter); foreach ($filter as $f) { $rules[$key][] = trim($f); } } foreach ($schema as $k => $field) { if (is_null($field)) { continue; } $rules[$k] = array( 'label' => $field['label'], 'filter' => $field->filter(), ); } foreach ($postFilter as $key => $filter) { $filter = explode('|', $filter); foreach ($filter as $f) { $rules[$key]['filter'][] = trim($f); } } return new static($rules); }
php
public static function fromSchema($schema, $preFilter = array(), $postFilter = array()) { $rules = array(); foreach ($preFilter as $key => $filter) { $filter = explode('|', $filter); foreach ($filter as $f) { $rules[$key][] = trim($f); } } foreach ($schema as $k => $field) { if (is_null($field)) { continue; } $rules[$k] = array( 'label' => $field['label'], 'filter' => $field->filter(), ); } foreach ($postFilter as $key => $filter) { $filter = explode('|', $filter); foreach ($filter as $f) { $rules[$key]['filter'][] = trim($f); } } return new static($rules); }
[ "public", "static", "function", "fromSchema", "(", "$", "schema", ",", "$", "preFilter", "=", "array", "(", ")", ",", "$", "postFilter", "=", "array", "(", ")", ")", "{", "$", "rules", "=", "array", "(", ")", ";", "foreach", "(", "$", "preFilter", "as", "$", "key", "=>", "$", "filter", ")", "{", "$", "filter", "=", "explode", "(", "'|'", ",", "$", "filter", ")", ";", "foreach", "(", "$", "filter", "as", "$", "f", ")", "{", "$", "rules", "[", "$", "key", "]", "[", "]", "=", "trim", "(", "$", "f", ")", ";", "}", "}", "foreach", "(", "$", "schema", "as", "$", "k", "=>", "$", "field", ")", "{", "if", "(", "is_null", "(", "$", "field", ")", ")", "{", "continue", ";", "}", "$", "rules", "[", "$", "k", "]", "=", "array", "(", "'label'", "=>", "$", "field", "[", "'label'", "]", ",", "'filter'", "=>", "$", "field", "->", "filter", "(", ")", ",", ")", ";", "}", "foreach", "(", "$", "postFilter", "as", "$", "key", "=>", "$", "filter", ")", "{", "$", "filter", "=", "explode", "(", "'|'", ",", "$", "filter", ")", ";", "foreach", "(", "$", "filter", "as", "$", "f", ")", "{", "$", "rules", "[", "$", "key", "]", "[", "'filter'", "]", "[", "]", "=", "trim", "(", "$", "f", ")", ";", "}", "}", "return", "new", "static", "(", "$", "rules", ")", ";", "}" ]
Static method to create instance of filter from database schema configuration. @param array $schema Database schema configuration @param array $preFilter Filters that will be run before the filter @param array $postFilter Filters that will be run after the filter @return \Norm\Filter\Filter
[ "Static", "method", "to", "create", "instance", "of", "filter", "from", "database", "schema", "configuration", "." ]
c357f7d3a75d05324dd84b8f6a968a094c53d603
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Filter/Filter.php#L51-L83
18,305
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.create
public static function create($modelAlias = null, $criteria = null) { if ($criteria instanceof RemoteHistoryContaoQuery) { return $criteria; } $query = new RemoteHistoryContaoQuery(null, null, $modelAlias); if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; }
php
public static function create($modelAlias = null, $criteria = null) { if ($criteria instanceof RemoteHistoryContaoQuery) { return $criteria; } $query = new RemoteHistoryContaoQuery(null, null, $modelAlias); if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; }
[ "public", "static", "function", "create", "(", "$", "modelAlias", "=", "null", ",", "$", "criteria", "=", "null", ")", "{", "if", "(", "$", "criteria", "instanceof", "RemoteHistoryContaoQuery", ")", "{", "return", "$", "criteria", ";", "}", "$", "query", "=", "new", "RemoteHistoryContaoQuery", "(", "null", ",", "null", ",", "$", "modelAlias", ")", ";", "if", "(", "$", "criteria", "instanceof", "Criteria", ")", "{", "$", "query", "->", "mergeWith", "(", "$", "criteria", ")", ";", "}", "return", "$", "query", ";", "}" ]
Returns a new RemoteHistoryContaoQuery object. @param string $modelAlias The alias of a model in the query @param RemoteHistoryContaoQuery|Criteria $criteria Optional Criteria to build the query from @return RemoteHistoryContaoQuery
[ "Returns", "a", "new", "RemoteHistoryContaoQuery", "object", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L139-L151
18,306
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByRemoteAppId
public function filterByRemoteAppId($remoteAppId = null, $comparison = null) { if (is_array($remoteAppId)) { $useMinMax = false; if (isset($remoteAppId['min'])) { $this->addUsingAlias(RemoteHistoryContaoPeer::REMOTE_APP_ID, $remoteAppId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($remoteAppId['max'])) { $this->addUsingAlias(RemoteHistoryContaoPeer::REMOTE_APP_ID, $remoteAppId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::REMOTE_APP_ID, $remoteAppId, $comparison); }
php
public function filterByRemoteAppId($remoteAppId = null, $comparison = null) { if (is_array($remoteAppId)) { $useMinMax = false; if (isset($remoteAppId['min'])) { $this->addUsingAlias(RemoteHistoryContaoPeer::REMOTE_APP_ID, $remoteAppId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($remoteAppId['max'])) { $this->addUsingAlias(RemoteHistoryContaoPeer::REMOTE_APP_ID, $remoteAppId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::REMOTE_APP_ID, $remoteAppId, $comparison); }
[ "public", "function", "filterByRemoteAppId", "(", "$", "remoteAppId", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "remoteAppId", ")", ")", "{", "$", "useMinMax", "=", "false", ";", "if", "(", "isset", "(", "$", "remoteAppId", "[", "'min'", "]", ")", ")", "{", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "REMOTE_APP_ID", ",", "$", "remoteAppId", "[", "'min'", "]", ",", "Criteria", "::", "GREATER_EQUAL", ")", ";", "$", "useMinMax", "=", "true", ";", "}", "if", "(", "isset", "(", "$", "remoteAppId", "[", "'max'", "]", ")", ")", "{", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "REMOTE_APP_ID", ",", "$", "remoteAppId", "[", "'max'", "]", ",", "Criteria", "::", "LESS_EQUAL", ")", ";", "$", "useMinMax", "=", "true", ";", "}", "if", "(", "$", "useMinMax", ")", "{", "return", "$", "this", ";", "}", "if", "(", "null", "===", "$", "comparison", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "REMOTE_APP_ID", ",", "$", "remoteAppId", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the remote_app_id column Example usage: <code> $query->filterByRemoteAppId(1234); // WHERE remote_app_id = 1234 $query->filterByRemoteAppId(array(12, 34)); // WHERE remote_app_id IN (12, 34) $query->filterByRemoteAppId(array('min' => 12)); // WHERE remote_app_id >= 12 $query->filterByRemoteAppId(array('max' => 12)); // WHERE remote_app_id <= 12 </code> @see filterByRemoteApp() @param mixed $remoteAppId The value to use as filter. Use scalar values for equality. Use array values for in_array() equivalent. Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "remote_app_id", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L367-L388
18,307
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByApiversion
public function filterByApiversion($apiversion = null, $comparison = null) { if (null === $comparison) { if (is_array($apiversion)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $apiversion)) { $apiversion = str_replace('*', '%', $apiversion); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::APIVERSION, $apiversion, $comparison); }
php
public function filterByApiversion($apiversion = null, $comparison = null) { if (null === $comparison) { if (is_array($apiversion)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $apiversion)) { $apiversion = str_replace('*', '%', $apiversion); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::APIVERSION, $apiversion, $comparison); }
[ "public", "function", "filterByApiversion", "(", "$", "apiversion", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "apiversion", ")", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "elseif", "(", "preg_match", "(", "'/[\\%\\*]/'", ",", "$", "apiversion", ")", ")", "{", "$", "apiversion", "=", "str_replace", "(", "'*'", ",", "'%'", ",", "$", "apiversion", ")", ";", "$", "comparison", "=", "Criteria", "::", "LIKE", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "APIVERSION", ",", "$", "apiversion", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the apiVersion column Example usage: <code> $query->filterByApiversion('fooValue'); // WHERE apiVersion = 'fooValue' $query->filterByApiversion('%fooValue%'); // WHERE apiVersion LIKE '%fooValue%' </code> @param string $apiversion The value to use as filter. Accepts wildcards (* and % trigger a LIKE) @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "apiVersion", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L405-L417
18,308
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByConfigDisplayerrors
public function filterByConfigDisplayerrors($configDisplayerrors = null, $comparison = null) { if (null === $comparison) { if (is_array($configDisplayerrors)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configDisplayerrors)) { $configDisplayerrors = str_replace('*', '%', $configDisplayerrors); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_DISPLAYERRORS, $configDisplayerrors, $comparison); }
php
public function filterByConfigDisplayerrors($configDisplayerrors = null, $comparison = null) { if (null === $comparison) { if (is_array($configDisplayerrors)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configDisplayerrors)) { $configDisplayerrors = str_replace('*', '%', $configDisplayerrors); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_DISPLAYERRORS, $configDisplayerrors, $comparison); }
[ "public", "function", "filterByConfigDisplayerrors", "(", "$", "configDisplayerrors", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "configDisplayerrors", ")", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "elseif", "(", "preg_match", "(", "'/[\\%\\*]/'", ",", "$", "configDisplayerrors", ")", ")", "{", "$", "configDisplayerrors", "=", "str_replace", "(", "'*'", ",", "'%'", ",", "$", "configDisplayerrors", ")", ";", "$", "comparison", "=", "Criteria", "::", "LIKE", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_DISPLAYERRORS", ",", "$", "configDisplayerrors", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the config_displayErrors column Example usage: <code> $query->filterByConfigDisplayerrors('fooValue'); // WHERE config_displayErrors = 'fooValue' $query->filterByConfigDisplayerrors('%fooValue%'); // WHERE config_displayErrors LIKE '%fooValue%' </code> @param string $configDisplayerrors The value to use as filter. Accepts wildcards (* and % trigger a LIKE) @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "config_displayErrors", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L492-L504
18,309
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByConfigBypasscache
public function filterByConfigBypasscache($configBypasscache = null, $comparison = null) { if (null === $comparison) { if (is_array($configBypasscache)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configBypasscache)) { $configBypasscache = str_replace('*', '%', $configBypasscache); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_BYPASSCACHE, $configBypasscache, $comparison); }
php
public function filterByConfigBypasscache($configBypasscache = null, $comparison = null) { if (null === $comparison) { if (is_array($configBypasscache)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configBypasscache)) { $configBypasscache = str_replace('*', '%', $configBypasscache); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_BYPASSCACHE, $configBypasscache, $comparison); }
[ "public", "function", "filterByConfigBypasscache", "(", "$", "configBypasscache", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "configBypasscache", ")", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "elseif", "(", "preg_match", "(", "'/[\\%\\*]/'", ",", "$", "configBypasscache", ")", ")", "{", "$", "configBypasscache", "=", "str_replace", "(", "'*'", ",", "'%'", ",", "$", "configBypasscache", ")", ";", "$", "comparison", "=", "Criteria", "::", "LIKE", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_BYPASSCACHE", ",", "$", "configBypasscache", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the config_bypassCache column Example usage: <code> $query->filterByConfigBypasscache('fooValue'); // WHERE config_bypassCache = 'fooValue' $query->filterByConfigBypasscache('%fooValue%'); // WHERE config_bypassCache LIKE '%fooValue%' </code> @param string $configBypasscache The value to use as filter. Accepts wildcards (* and % trigger a LIKE) @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "config_bypassCache", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L521-L533
18,310
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByConfigMinifymarkup
public function filterByConfigMinifymarkup($configMinifymarkup = null, $comparison = null) { if (null === $comparison) { if (is_array($configMinifymarkup)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configMinifymarkup)) { $configMinifymarkup = str_replace('*', '%', $configMinifymarkup); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_MINIFYMARKUP, $configMinifymarkup, $comparison); }
php
public function filterByConfigMinifymarkup($configMinifymarkup = null, $comparison = null) { if (null === $comparison) { if (is_array($configMinifymarkup)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configMinifymarkup)) { $configMinifymarkup = str_replace('*', '%', $configMinifymarkup); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_MINIFYMARKUP, $configMinifymarkup, $comparison); }
[ "public", "function", "filterByConfigMinifymarkup", "(", "$", "configMinifymarkup", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "configMinifymarkup", ")", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "elseif", "(", "preg_match", "(", "'/[\\%\\*]/'", ",", "$", "configMinifymarkup", ")", ")", "{", "$", "configMinifymarkup", "=", "str_replace", "(", "'*'", ",", "'%'", ",", "$", "configMinifymarkup", ")", ";", "$", "comparison", "=", "Criteria", "::", "LIKE", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_MINIFYMARKUP", ",", "$", "configMinifymarkup", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the config_minifyMarkup column Example usage: <code> $query->filterByConfigMinifymarkup('fooValue'); // WHERE config_minifyMarkup = 'fooValue' $query->filterByConfigMinifymarkup('%fooValue%'); // WHERE config_minifyMarkup LIKE '%fooValue%' </code> @param string $configMinifymarkup The value to use as filter. Accepts wildcards (* and % trigger a LIKE) @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "config_minifyMarkup", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L550-L562
18,311
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByConfigDebugmode
public function filterByConfigDebugmode($configDebugmode = null, $comparison = null) { if (null === $comparison) { if (is_array($configDebugmode)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configDebugmode)) { $configDebugmode = str_replace('*', '%', $configDebugmode); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_DEBUGMODE, $configDebugmode, $comparison); }
php
public function filterByConfigDebugmode($configDebugmode = null, $comparison = null) { if (null === $comparison) { if (is_array($configDebugmode)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configDebugmode)) { $configDebugmode = str_replace('*', '%', $configDebugmode); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_DEBUGMODE, $configDebugmode, $comparison); }
[ "public", "function", "filterByConfigDebugmode", "(", "$", "configDebugmode", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "configDebugmode", ")", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "elseif", "(", "preg_match", "(", "'/[\\%\\*]/'", ",", "$", "configDebugmode", ")", ")", "{", "$", "configDebugmode", "=", "str_replace", "(", "'*'", ",", "'%'", ",", "$", "configDebugmode", ")", ";", "$", "comparison", "=", "Criteria", "::", "LIKE", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_DEBUGMODE", ",", "$", "configDebugmode", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the config_debugMode column Example usage: <code> $query->filterByConfigDebugmode('fooValue'); // WHERE config_debugMode = 'fooValue' $query->filterByConfigDebugmode('%fooValue%'); // WHERE config_debugMode LIKE '%fooValue%' </code> @param string $configDebugmode The value to use as filter. Accepts wildcards (* and % trigger a LIKE) @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "config_debugMode", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L579-L591
18,312
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByConfigMaintenancemode
public function filterByConfigMaintenancemode($configMaintenancemode = null, $comparison = null) { if (null === $comparison) { if (is_array($configMaintenancemode)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configMaintenancemode)) { $configMaintenancemode = str_replace('*', '%', $configMaintenancemode); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_MAINTENANCEMODE, $configMaintenancemode, $comparison); }
php
public function filterByConfigMaintenancemode($configMaintenancemode = null, $comparison = null) { if (null === $comparison) { if (is_array($configMaintenancemode)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configMaintenancemode)) { $configMaintenancemode = str_replace('*', '%', $configMaintenancemode); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_MAINTENANCEMODE, $configMaintenancemode, $comparison); }
[ "public", "function", "filterByConfigMaintenancemode", "(", "$", "configMaintenancemode", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "configMaintenancemode", ")", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "elseif", "(", "preg_match", "(", "'/[\\%\\*]/'", ",", "$", "configMaintenancemode", ")", ")", "{", "$", "configMaintenancemode", "=", "str_replace", "(", "'*'", ",", "'%'", ",", "$", "configMaintenancemode", ")", ";", "$", "comparison", "=", "Criteria", "::", "LIKE", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_MAINTENANCEMODE", ",", "$", "configMaintenancemode", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the config_maintenanceMode column Example usage: <code> $query->filterByConfigMaintenancemode('fooValue'); // WHERE config_maintenanceMode = 'fooValue' $query->filterByConfigMaintenancemode('%fooValue%'); // WHERE config_maintenanceMode LIKE '%fooValue%' </code> @param string $configMaintenancemode The value to use as filter. Accepts wildcards (* and % trigger a LIKE) @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "config_maintenanceMode", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L608-L620
18,313
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByConfigGzipscripts
public function filterByConfigGzipscripts($configGzipscripts = null, $comparison = null) { if (null === $comparison) { if (is_array($configGzipscripts)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configGzipscripts)) { $configGzipscripts = str_replace('*', '%', $configGzipscripts); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_GZIPSCRIPTS, $configGzipscripts, $comparison); }
php
public function filterByConfigGzipscripts($configGzipscripts = null, $comparison = null) { if (null === $comparison) { if (is_array($configGzipscripts)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configGzipscripts)) { $configGzipscripts = str_replace('*', '%', $configGzipscripts); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_GZIPSCRIPTS, $configGzipscripts, $comparison); }
[ "public", "function", "filterByConfigGzipscripts", "(", "$", "configGzipscripts", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "configGzipscripts", ")", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "elseif", "(", "preg_match", "(", "'/[\\%\\*]/'", ",", "$", "configGzipscripts", ")", ")", "{", "$", "configGzipscripts", "=", "str_replace", "(", "'*'", ",", "'%'", ",", "$", "configGzipscripts", ")", ";", "$", "comparison", "=", "Criteria", "::", "LIKE", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_GZIPSCRIPTS", ",", "$", "configGzipscripts", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the config_gzipScripts column Example usage: <code> $query->filterByConfigGzipscripts('fooValue'); // WHERE config_gzipScripts = 'fooValue' $query->filterByConfigGzipscripts('%fooValue%'); // WHERE config_gzipScripts LIKE '%fooValue%' </code> @param string $configGzipscripts The value to use as filter. Accepts wildcards (* and % trigger a LIKE) @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "config_gzipScripts", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L637-L649
18,314
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByConfigRewriteurl
public function filterByConfigRewriteurl($configRewriteurl = null, $comparison = null) { if (null === $comparison) { if (is_array($configRewriteurl)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configRewriteurl)) { $configRewriteurl = str_replace('*', '%', $configRewriteurl); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_REWRITEURL, $configRewriteurl, $comparison); }
php
public function filterByConfigRewriteurl($configRewriteurl = null, $comparison = null) { if (null === $comparison) { if (is_array($configRewriteurl)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configRewriteurl)) { $configRewriteurl = str_replace('*', '%', $configRewriteurl); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_REWRITEURL, $configRewriteurl, $comparison); }
[ "public", "function", "filterByConfigRewriteurl", "(", "$", "configRewriteurl", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "configRewriteurl", ")", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "elseif", "(", "preg_match", "(", "'/[\\%\\*]/'", ",", "$", "configRewriteurl", ")", ")", "{", "$", "configRewriteurl", "=", "str_replace", "(", "'*'", ",", "'%'", ",", "$", "configRewriteurl", ")", ";", "$", "comparison", "=", "Criteria", "::", "LIKE", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_REWRITEURL", ",", "$", "configRewriteurl", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the config_rewriteURL column Example usage: <code> $query->filterByConfigRewriteurl('fooValue'); // WHERE config_rewriteURL = 'fooValue' $query->filterByConfigRewriteurl('%fooValue%'); // WHERE config_rewriteURL LIKE '%fooValue%' </code> @param string $configRewriteurl The value to use as filter. Accepts wildcards (* and % trigger a LIKE) @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "config_rewriteURL", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L666-L678
18,315
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByConfigAdminemail
public function filterByConfigAdminemail($configAdminemail = null, $comparison = null) { if (null === $comparison) { if (is_array($configAdminemail)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configAdminemail)) { $configAdminemail = str_replace('*', '%', $configAdminemail); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_ADMINEMAIL, $configAdminemail, $comparison); }
php
public function filterByConfigAdminemail($configAdminemail = null, $comparison = null) { if (null === $comparison) { if (is_array($configAdminemail)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configAdminemail)) { $configAdminemail = str_replace('*', '%', $configAdminemail); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_ADMINEMAIL, $configAdminemail, $comparison); }
[ "public", "function", "filterByConfigAdminemail", "(", "$", "configAdminemail", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "configAdminemail", ")", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "elseif", "(", "preg_match", "(", "'/[\\%\\*]/'", ",", "$", "configAdminemail", ")", ")", "{", "$", "configAdminemail", "=", "str_replace", "(", "'*'", ",", "'%'", ",", "$", "configAdminemail", ")", ";", "$", "comparison", "=", "Criteria", "::", "LIKE", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_ADMINEMAIL", ",", "$", "configAdminemail", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the config_adminEmail column Example usage: <code> $query->filterByConfigAdminemail('fooValue'); // WHERE config_adminEmail = 'fooValue' $query->filterByConfigAdminemail('%fooValue%'); // WHERE config_adminEmail LIKE '%fooValue%' </code> @param string $configAdminemail The value to use as filter. Accepts wildcards (* and % trigger a LIKE) @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "config_adminEmail", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L695-L707
18,316
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByConfigCachemode
public function filterByConfigCachemode($configCachemode = null, $comparison = null) { if (null === $comparison) { if (is_array($configCachemode)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configCachemode)) { $configCachemode = str_replace('*', '%', $configCachemode); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_CACHEMODE, $configCachemode, $comparison); }
php
public function filterByConfigCachemode($configCachemode = null, $comparison = null) { if (null === $comparison) { if (is_array($configCachemode)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $configCachemode)) { $configCachemode = str_replace('*', '%', $configCachemode); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::CONFIG_CACHEMODE, $configCachemode, $comparison); }
[ "public", "function", "filterByConfigCachemode", "(", "$", "configCachemode", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "configCachemode", ")", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "elseif", "(", "preg_match", "(", "'/[\\%\\*]/'", ",", "$", "configCachemode", ")", ")", "{", "$", "configCachemode", "=", "str_replace", "(", "'*'", ",", "'%'", ",", "$", "configCachemode", ")", ";", "$", "comparison", "=", "Criteria", "::", "LIKE", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "CONFIG_CACHEMODE", ",", "$", "configCachemode", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the config_cacheMode column Example usage: <code> $query->filterByConfigCachemode('fooValue'); // WHERE config_cacheMode = 'fooValue' $query->filterByConfigCachemode('%fooValue%'); // WHERE config_cacheMode LIKE '%fooValue%' </code> @param string $configCachemode The value to use as filter. Accepts wildcards (* and % trigger a LIKE) @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "config_cacheMode", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L724-L736
18,317
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByStatuscode
public function filterByStatuscode($statuscode = null, $comparison = null) { if (is_array($statuscode)) { $useMinMax = false; if (isset($statuscode['min'])) { $this->addUsingAlias(RemoteHistoryContaoPeer::STATUSCODE, $statuscode['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($statuscode['max'])) { $this->addUsingAlias(RemoteHistoryContaoPeer::STATUSCODE, $statuscode['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::STATUSCODE, $statuscode, $comparison); }
php
public function filterByStatuscode($statuscode = null, $comparison = null) { if (is_array($statuscode)) { $useMinMax = false; if (isset($statuscode['min'])) { $this->addUsingAlias(RemoteHistoryContaoPeer::STATUSCODE, $statuscode['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($statuscode['max'])) { $this->addUsingAlias(RemoteHistoryContaoPeer::STATUSCODE, $statuscode['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(RemoteHistoryContaoPeer::STATUSCODE, $statuscode, $comparison); }
[ "public", "function", "filterByStatuscode", "(", "$", "statuscode", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "statuscode", ")", ")", "{", "$", "useMinMax", "=", "false", ";", "if", "(", "isset", "(", "$", "statuscode", "[", "'min'", "]", ")", ")", "{", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "STATUSCODE", ",", "$", "statuscode", "[", "'min'", "]", ",", "Criteria", "::", "GREATER_EQUAL", ")", ";", "$", "useMinMax", "=", "true", ";", "}", "if", "(", "isset", "(", "$", "statuscode", "[", "'max'", "]", ")", ")", "{", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "STATUSCODE", ",", "$", "statuscode", "[", "'max'", "]", ",", "Criteria", "::", "LESS_EQUAL", ")", ";", "$", "useMinMax", "=", "true", ";", "}", "if", "(", "$", "useMinMax", ")", "{", "return", "$", "this", ";", "}", "if", "(", "null", "===", "$", "comparison", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "STATUSCODE", ",", "$", "statuscode", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the statuscode column Example usage: <code> $query->filterByStatuscode(1234); // WHERE statuscode = 1234 $query->filterByStatuscode(array(12, 34)); // WHERE statuscode IN (12, 34) $query->filterByStatuscode(array('min' => 12)); // WHERE statuscode >= 12 $query->filterByStatuscode(array('max' => 12)); // WHERE statuscode <= 12 </code> @param mixed $statuscode The value to use as filter. Use scalar values for equality. Use array values for in_array() equivalent. Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "statuscode", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L757-L778
18,318
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByExtensions
public function filterByExtensions($extensions = null, $comparison = null) { if (is_object($extensions)) { $extensions = serialize($extensions); } return $this->addUsingAlias(RemoteHistoryContaoPeer::EXTENSIONS, $extensions, $comparison); }
php
public function filterByExtensions($extensions = null, $comparison = null) { if (is_object($extensions)) { $extensions = serialize($extensions); } return $this->addUsingAlias(RemoteHistoryContaoPeer::EXTENSIONS, $extensions, $comparison); }
[ "public", "function", "filterByExtensions", "(", "$", "extensions", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_object", "(", "$", "extensions", ")", ")", "{", "$", "extensions", "=", "serialize", "(", "$", "extensions", ")", ";", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "EXTENSIONS", ",", "$", "extensions", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the extensions column @param mixed $extensions The value to use as filter @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "extensions", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L788-L795
18,319
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByLog
public function filterByLog($log = null, $comparison = null) { if (is_object($log)) { $log = serialize($log); } return $this->addUsingAlias(RemoteHistoryContaoPeer::LOG, $log, $comparison); }
php
public function filterByLog($log = null, $comparison = null) { if (is_object($log)) { $log = serialize($log); } return $this->addUsingAlias(RemoteHistoryContaoPeer::LOG, $log, $comparison); }
[ "public", "function", "filterByLog", "(", "$", "log", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_object", "(", "$", "log", ")", ")", "{", "$", "log", "=", "serialize", "(", "$", "log", ")", ";", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "LOG", ",", "$", "log", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the log column @param mixed $log The value to use as filter @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "log", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L805-L812
18,320
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByPHP
public function filterByPHP($pHP = null, $comparison = null) { if (is_object($pHP)) { $pHP = serialize($pHP); } return $this->addUsingAlias(RemoteHistoryContaoPeer::PHP, $pHP, $comparison); }
php
public function filterByPHP($pHP = null, $comparison = null) { if (is_object($pHP)) { $pHP = serialize($pHP); } return $this->addUsingAlias(RemoteHistoryContaoPeer::PHP, $pHP, $comparison); }
[ "public", "function", "filterByPHP", "(", "$", "pHP", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_object", "(", "$", "pHP", ")", ")", "{", "$", "pHP", "=", "serialize", "(", "$", "pHP", ")", ";", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "PHP", ",", "$", "pHP", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the php column @param mixed $pHP The value to use as filter @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "php", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L822-L829
18,321
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.filterByMySQL
public function filterByMySQL($mySQL = null, $comparison = null) { if (is_object($mySQL)) { $mySQL = serialize($mySQL); } return $this->addUsingAlias(RemoteHistoryContaoPeer::MYSQL, $mySQL, $comparison); }
php
public function filterByMySQL($mySQL = null, $comparison = null) { if (is_object($mySQL)) { $mySQL = serialize($mySQL); } return $this->addUsingAlias(RemoteHistoryContaoPeer::MYSQL, $mySQL, $comparison); }
[ "public", "function", "filterByMySQL", "(", "$", "mySQL", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_object", "(", "$", "mySQL", ")", ")", "{", "$", "mySQL", "=", "serialize", "(", "$", "mySQL", ")", ";", "}", "return", "$", "this", "->", "addUsingAlias", "(", "RemoteHistoryContaoPeer", "::", "MYSQL", ",", "$", "mySQL", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the mysql column @param mixed $mySQL The value to use as filter @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return RemoteHistoryContaoQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "mysql", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L839-L846
18,322
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php
BaseRemoteHistoryContaoQuery.useRemoteAppQuery
public function useRemoteAppQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinRemoteApp($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'RemoteApp', '\Slashworks\AppBundle\Model\RemoteAppQuery'); }
php
public function useRemoteAppQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinRemoteApp($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'RemoteApp', '\Slashworks\AppBundle\Model\RemoteAppQuery'); }
[ "public", "function", "useRemoteAppQuery", "(", "$", "relationAlias", "=", "null", ",", "$", "joinType", "=", "Criteria", "::", "INNER_JOIN", ")", "{", "return", "$", "this", "->", "joinRemoteApp", "(", "$", "relationAlias", ",", "$", "joinType", ")", "->", "useQuery", "(", "$", "relationAlias", "?", "$", "relationAlias", ":", "'RemoteApp'", ",", "'\\Slashworks\\AppBundle\\Model\\RemoteAppQuery'", ")", ";", "}" ]
Use the RemoteApp relation RemoteApp object @see useQuery() @param string $relationAlias optional alias for the relation, to be used as main alias in the secondary query @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' @return \Slashworks\AppBundle\Model\RemoteAppQuery A secondary query class using the current class as primary query
[ "Use", "the", "RemoteApp", "relation", "RemoteApp", "object" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteHistoryContaoQuery.php#L917-L922
18,323
xinix-technology/norm
src/Norm/Type/Collection.php
Collection.compare
public function compare($another) { if ($another instanceof Collection) { $another = $another->toArray(); } $me = $this->toArray(); if ($me == $another) { return 0; } else { return 1; } }
php
public function compare($another) { if ($another instanceof Collection) { $another = $another->toArray(); } $me = $this->toArray(); if ($me == $another) { return 0; } else { return 1; } }
[ "public", "function", "compare", "(", "$", "another", ")", "{", "if", "(", "$", "another", "instanceof", "Collection", ")", "{", "$", "another", "=", "$", "another", "->", "toArray", "(", ")", ";", "}", "$", "me", "=", "$", "this", "->", "toArray", "(", ")", ";", "if", "(", "$", "me", "==", "$", "another", ")", "{", "return", "0", ";", "}", "else", "{", "return", "1", ";", "}", "}" ]
Perform comparison between this implementation and another implementation of `\Norm\Type\Collection` or an array. @param mixed $another @return int
[ "Perform", "comparison", "between", "this", "implementation", "and", "another", "implementation", "of", "\\", "Norm", "\\", "Type", "\\", "Collection", "or", "an", "array", "." ]
c357f7d3a75d05324dd84b8f6a968a094c53d603
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Type/Collection.php#L186-L199
18,324
qcubed/orm
src/Query/Condition/ConditionBase.php
ConditionBase.getWhereClause
public function getWhereClause(Builder $objBuilder, $blnProcessOnce = false) { if ($blnProcessOnce && $this->blnProcessed) { return null; } $this->blnProcessed = true; try { $objConditionBuilder = new PartialBuilder($objBuilder); $this->updateQueryBuilder($objConditionBuilder); return $objConditionBuilder->getWhereStatement(); } catch (Caller $objExc) { $objExc->incrementOffset(); $objExc->incrementOffset(); throw $objExc; } }
php
public function getWhereClause(Builder $objBuilder, $blnProcessOnce = false) { if ($blnProcessOnce && $this->blnProcessed) { return null; } $this->blnProcessed = true; try { $objConditionBuilder = new PartialBuilder($objBuilder); $this->updateQueryBuilder($objConditionBuilder); return $objConditionBuilder->getWhereStatement(); } catch (Caller $objExc) { $objExc->incrementOffset(); $objExc->incrementOffset(); throw $objExc; } }
[ "public", "function", "getWhereClause", "(", "Builder", "$", "objBuilder", ",", "$", "blnProcessOnce", "=", "false", ")", "{", "if", "(", "$", "blnProcessOnce", "&&", "$", "this", "->", "blnProcessed", ")", "{", "return", "null", ";", "}", "$", "this", "->", "blnProcessed", "=", "true", ";", "try", "{", "$", "objConditionBuilder", "=", "new", "PartialBuilder", "(", "$", "objBuilder", ")", ";", "$", "this", "->", "updateQueryBuilder", "(", "$", "objConditionBuilder", ")", ";", "return", "$", "objConditionBuilder", "->", "getWhereStatement", "(", ")", ";", "}", "catch", "(", "Caller", "$", "objExc", ")", "{", "$", "objExc", "->", "incrementOffset", "(", ")", ";", "$", "objExc", "->", "incrementOffset", "(", ")", ";", "throw", "$", "objExc", ";", "}", "}" ]
Used internally by QCubed Query to get an individual where clause for a given condition Mostly used for conditional joins. @param Builder $objBuilder @param bool|false $blnProcessOnce @return null|string @throws \Exception @throws Caller
[ "Used", "internally", "by", "QCubed", "Query", "to", "get", "an", "individual", "where", "clause", "for", "a", "given", "condition", "Mostly", "used", "for", "conditional", "joins", "." ]
f320eba671f20874b1f3809c5293f8c02d5b1204
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/Condition/ConditionBase.php#L46-L63
18,325
Chill-project/Main
Form/Type/CenterType.php
CenterType.buildForm
public function buildForm(FormBuilderInterface $builder, array $options) { if ($this->getParent() === 'hidden') { $builder->addModelTransformer($this->transformer); } }
php
public function buildForm(FormBuilderInterface $builder, array $options) { if ($this->getParent() === 'hidden') { $builder->addModelTransformer($this->transformer); } }
[ "public", "function", "buildForm", "(", "FormBuilderInterface", "$", "builder", ",", "array", "$", "options", ")", "{", "if", "(", "$", "this", "->", "getParent", "(", ")", "===", "'hidden'", ")", "{", "$", "builder", "->", "addModelTransformer", "(", "$", "this", "->", "transformer", ")", ";", "}", "}" ]
add a data transformer if user can reach only one center @param FormBuilderInterface $builder @param array $options
[ "add", "a", "data", "transformer", "if", "user", "can", "reach", "only", "one", "center" ]
384cb6c793072a4f1047dc5cafc2157ee2419f60
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Form/Type/CenterType.php#L111-L116
18,326
Chill-project/Main
Form/Type/CenterType.php
CenterType.prepareReachableCenterByUser
private function prepareReachableCenterByUser() { $groupCenters = $this->user->getGroupCenters(); foreach ($groupCenters as $groupCenter) { $center = $groupCenter->getCenter(); if (!array_key_exists($center->getId(), $this->reachableCenters)) { $this->reachableCenters[$center->getId()] = $center; } } }
php
private function prepareReachableCenterByUser() { $groupCenters = $this->user->getGroupCenters(); foreach ($groupCenters as $groupCenter) { $center = $groupCenter->getCenter(); if (!array_key_exists($center->getId(), $this->reachableCenters)) { $this->reachableCenters[$center->getId()] = $center; } } }
[ "private", "function", "prepareReachableCenterByUser", "(", ")", "{", "$", "groupCenters", "=", "$", "this", "->", "user", "->", "getGroupCenters", "(", ")", ";", "foreach", "(", "$", "groupCenters", "as", "$", "groupCenter", ")", "{", "$", "center", "=", "$", "groupCenter", "->", "getCenter", "(", ")", ";", "if", "(", "!", "array_key_exists", "(", "$", "center", "->", "getId", "(", ")", ",", "$", "this", "->", "reachableCenters", ")", ")", "{", "$", "this", "->", "reachableCenters", "[", "$", "center", "->", "getId", "(", ")", "]", "=", "$", "center", ";", "}", "}", "}" ]
populate reachableCenters as an associative array where keys are center.id and value are center entities.
[ "populate", "reachableCenters", "as", "an", "associative", "array", "where", "keys", "are", "center", ".", "id", "and", "value", "are", "center", "entities", "." ]
384cb6c793072a4f1047dc5cafc2157ee2419f60
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Form/Type/CenterType.php#L123-L136
18,327
webforge-labs/psc-cms
lib/Psc/System/SimpleRarArchive.php
SimpleRarArchive.extractTo
public function extractTo(WebforgeDir $dir = NULL) { if (!isset($dir)) $dir = $this->rar->getDirectory(); else $dir->create(); $this->exec('x', array('y'), (string) $dir); return $this; }
php
public function extractTo(WebforgeDir $dir = NULL) { if (!isset($dir)) $dir = $this->rar->getDirectory(); else $dir->create(); $this->exec('x', array('y'), (string) $dir); return $this; }
[ "public", "function", "extractTo", "(", "WebforgeDir", "$", "dir", "=", "NULL", ")", "{", "if", "(", "!", "isset", "(", "$", "dir", ")", ")", "$", "dir", "=", "$", "this", "->", "rar", "->", "getDirectory", "(", ")", ";", "else", "$", "dir", "->", "create", "(", ")", ";", "$", "this", "->", "exec", "(", "'x'", ",", "array", "(", "'y'", ")", ",", "(", "string", ")", "$", "dir", ")", ";", "return", "$", "this", ";", "}" ]
Entpackt alle Dateien des Archives in ein Verzeichnis wird das Verzeichnis nicht angegeben, so wird das Verzeichnis genommen in dem sich das Archiv befindet existiert das Verzeichnis nicht, wird es angelegt
[ "Entpackt", "alle", "Dateien", "des", "Archives", "in", "ein", "Verzeichnis" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/System/SimpleRarArchive.php#L38-L46
18,328
jfusion/org.jfusion.framework
src/Installer/Plugin.php
Plugin.copy
function copy($name, $new_name, $update = false) { //replace not-allowed characters with _ $new_name = preg_replace('/([^a-zA-Z0-9_])/', '_', $new_name); //initialise response element $result = array(); $result['status'] = false; if ($name && $new_name) { //check to see if an integration was selected $db = Factory::getDBO(); $query = $db->getQuery(true) ->select('count(*)') ->from('#__jfusion') ->where('original_name IS NULL') ->where('name LIKE ' . $db->quote($name)); $db->setQuery($query); $record = $db->loadResult(); $query = $db->getQuery(true) ->select('id') ->from('#__jfusion') ->where('name = ' . $db->quote($new_name)); $db->setQuery($query); $exsist = $db->loadResult(); if ($exsist) { throw new RuntimeException($new_name . ' ' . Text::_('ALREADY_IN_USE')); } else if ($record) { $JFusionPlugin = Factory::getAdmin($name); if ($JFusionPlugin->multiInstance()) { $db = Factory::getDBO(); if (!$update) { //add the new entry in the JFusion plugin table $query = $db->getQuery(true) ->select('*') ->from('#__jfusion') ->where('name = ' . $db->quote($name)); $db->setQuery($query); $plugin_entry = $db->loadObject(); $plugin_entry->name = $new_name; $plugin_entry->id = null; //only change the original name if this is not a copy itself if (empty($plugin_entry->original_name)) { $plugin_entry->original_name = $name; } $db->insertObject('#__jfusion', $plugin_entry, 'id'); } $result['message'] = $new_name . ': ' . Text::_('PLUGIN') . ' ' . $name . ' ' . Text::_('COPY') . ' ' . Text::_('SUCCESS'); $result['status'] = true; } else { throw new RuntimeException(Text::_('CANT_COPY')); } } else { throw new RuntimeException(Text::_('INVALID_SELECTED')); } } else { throw new RuntimeException(Text::_('NONE_SELECTED')); } return $result; }
php
function copy($name, $new_name, $update = false) { //replace not-allowed characters with _ $new_name = preg_replace('/([^a-zA-Z0-9_])/', '_', $new_name); //initialise response element $result = array(); $result['status'] = false; if ($name && $new_name) { //check to see if an integration was selected $db = Factory::getDBO(); $query = $db->getQuery(true) ->select('count(*)') ->from('#__jfusion') ->where('original_name IS NULL') ->where('name LIKE ' . $db->quote($name)); $db->setQuery($query); $record = $db->loadResult(); $query = $db->getQuery(true) ->select('id') ->from('#__jfusion') ->where('name = ' . $db->quote($new_name)); $db->setQuery($query); $exsist = $db->loadResult(); if ($exsist) { throw new RuntimeException($new_name . ' ' . Text::_('ALREADY_IN_USE')); } else if ($record) { $JFusionPlugin = Factory::getAdmin($name); if ($JFusionPlugin->multiInstance()) { $db = Factory::getDBO(); if (!$update) { //add the new entry in the JFusion plugin table $query = $db->getQuery(true) ->select('*') ->from('#__jfusion') ->where('name = ' . $db->quote($name)); $db->setQuery($query); $plugin_entry = $db->loadObject(); $plugin_entry->name = $new_name; $plugin_entry->id = null; //only change the original name if this is not a copy itself if (empty($plugin_entry->original_name)) { $plugin_entry->original_name = $name; } $db->insertObject('#__jfusion', $plugin_entry, 'id'); } $result['message'] = $new_name . ': ' . Text::_('PLUGIN') . ' ' . $name . ' ' . Text::_('COPY') . ' ' . Text::_('SUCCESS'); $result['status'] = true; } else { throw new RuntimeException(Text::_('CANT_COPY')); } } else { throw new RuntimeException(Text::_('INVALID_SELECTED')); } } else { throw new RuntimeException(Text::_('NONE_SELECTED')); } return $result; }
[ "function", "copy", "(", "$", "name", ",", "$", "new_name", ",", "$", "update", "=", "false", ")", "{", "//replace not-allowed characters with _", "$", "new_name", "=", "preg_replace", "(", "'/([^a-zA-Z0-9_])/'", ",", "'_'", ",", "$", "new_name", ")", ";", "//initialise response element", "$", "result", "=", "array", "(", ")", ";", "$", "result", "[", "'status'", "]", "=", "false", ";", "if", "(", "$", "name", "&&", "$", "new_name", ")", "{", "//check to see if an integration was selected", "$", "db", "=", "Factory", "::", "getDBO", "(", ")", ";", "$", "query", "=", "$", "db", "->", "getQuery", "(", "true", ")", "->", "select", "(", "'count(*)'", ")", "->", "from", "(", "'#__jfusion'", ")", "->", "where", "(", "'original_name IS NULL'", ")", "->", "where", "(", "'name LIKE '", ".", "$", "db", "->", "quote", "(", "$", "name", ")", ")", ";", "$", "db", "->", "setQuery", "(", "$", "query", ")", ";", "$", "record", "=", "$", "db", "->", "loadResult", "(", ")", ";", "$", "query", "=", "$", "db", "->", "getQuery", "(", "true", ")", "->", "select", "(", "'id'", ")", "->", "from", "(", "'#__jfusion'", ")", "->", "where", "(", "'name = '", ".", "$", "db", "->", "quote", "(", "$", "new_name", ")", ")", ";", "$", "db", "->", "setQuery", "(", "$", "query", ")", ";", "$", "exsist", "=", "$", "db", "->", "loadResult", "(", ")", ";", "if", "(", "$", "exsist", ")", "{", "throw", "new", "RuntimeException", "(", "$", "new_name", ".", "' '", ".", "Text", "::", "_", "(", "'ALREADY_IN_USE'", ")", ")", ";", "}", "else", "if", "(", "$", "record", ")", "{", "$", "JFusionPlugin", "=", "Factory", "::", "getAdmin", "(", "$", "name", ")", ";", "if", "(", "$", "JFusionPlugin", "->", "multiInstance", "(", ")", ")", "{", "$", "db", "=", "Factory", "::", "getDBO", "(", ")", ";", "if", "(", "!", "$", "update", ")", "{", "//add the new entry in the JFusion plugin table", "$", "query", "=", "$", "db", "->", "getQuery", "(", "true", ")", "->", "select", "(", "'*'", ")", "->", "from", "(", "'#__jfusion'", ")", "->", "where", "(", "'name = '", ".", "$", "db", "->", "quote", "(", "$", "name", ")", ")", ";", "$", "db", "->", "setQuery", "(", "$", "query", ")", ";", "$", "plugin_entry", "=", "$", "db", "->", "loadObject", "(", ")", ";", "$", "plugin_entry", "->", "name", "=", "$", "new_name", ";", "$", "plugin_entry", "->", "id", "=", "null", ";", "//only change the original name if this is not a copy itself", "if", "(", "empty", "(", "$", "plugin_entry", "->", "original_name", ")", ")", "{", "$", "plugin_entry", "->", "original_name", "=", "$", "name", ";", "}", "$", "db", "->", "insertObject", "(", "'#__jfusion'", ",", "$", "plugin_entry", ",", "'id'", ")", ";", "}", "$", "result", "[", "'message'", "]", "=", "$", "new_name", ".", "': '", ".", "Text", "::", "_", "(", "'PLUGIN'", ")", ".", "' '", ".", "$", "name", ".", "' '", ".", "Text", "::", "_", "(", "'COPY'", ")", ".", "' '", ".", "Text", "::", "_", "(", "'SUCCESS'", ")", ";", "$", "result", "[", "'status'", "]", "=", "true", ";", "}", "else", "{", "throw", "new", "RuntimeException", "(", "Text", "::", "_", "(", "'CANT_COPY'", ")", ")", ";", "}", "}", "else", "{", "throw", "new", "RuntimeException", "(", "Text", "::", "_", "(", "'INVALID_SELECTED'", ")", ")", ";", "}", "}", "else", "{", "throw", "new", "RuntimeException", "(", "Text", "::", "_", "(", "'NONE_SELECTED'", ")", ")", ";", "}", "return", "$", "result", ";", "}" ]
handles copying JFusion plugins @param string $name name of the JFusion plugin used @param string $new_name name of the copied plugin @param boolean $update mark if we updating a copied plugin @throws RuntimeException @return boolean
[ "handles", "copying", "JFusion", "plugins" ]
65771963f23ccabcf1f867eb17c9452299cfe683
https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Installer/Plugin.php#L332-L396
18,329
jfusion/org.jfusion.framework
src/Installer/Plugin.php
Plugin.getManifest
function getManifest($dir) { $file = $dir . '/jfusion.xml'; $this->installer->setPath('manifest', $file); // If we cannot load the xml file return null $xml = JFusionFramework::getXml($file); if (!($xml instanceof SimpleXMLElement) || ($xml->getName() != 'extension')) { // Free up xml parser memory and return null unset($xml); $xml = null; } else { /** * Check that the plugin is an actual JFusion plugin */ $type = $this->getAttribute($xml, 'type'); if ($type !== 'jfusion') { //Free up xml parser memory and return null unset ($xml); $xml = null; } } // Valid manifest file return the object return $xml; }
php
function getManifest($dir) { $file = $dir . '/jfusion.xml'; $this->installer->setPath('manifest', $file); // If we cannot load the xml file return null $xml = JFusionFramework::getXml($file); if (!($xml instanceof SimpleXMLElement) || ($xml->getName() != 'extension')) { // Free up xml parser memory and return null unset($xml); $xml = null; } else { /** * Check that the plugin is an actual JFusion plugin */ $type = $this->getAttribute($xml, 'type'); if ($type !== 'jfusion') { //Free up xml parser memory and return null unset ($xml); $xml = null; } } // Valid manifest file return the object return $xml; }
[ "function", "getManifest", "(", "$", "dir", ")", "{", "$", "file", "=", "$", "dir", ".", "'/jfusion.xml'", ";", "$", "this", "->", "installer", "->", "setPath", "(", "'manifest'", ",", "$", "file", ")", ";", "// If we cannot load the xml file return null", "$", "xml", "=", "JFusionFramework", "::", "getXml", "(", "$", "file", ")", ";", "if", "(", "!", "(", "$", "xml", "instanceof", "SimpleXMLElement", ")", "||", "(", "$", "xml", "->", "getName", "(", ")", "!=", "'extension'", ")", ")", "{", "// Free up xml parser memory and return null", "unset", "(", "$", "xml", ")", ";", "$", "xml", "=", "null", ";", "}", "else", "{", "/**\n * Check that the plugin is an actual JFusion plugin\n */", "$", "type", "=", "$", "this", "->", "getAttribute", "(", "$", "xml", ",", "'type'", ")", ";", "if", "(", "$", "type", "!==", "'jfusion'", ")", "{", "//Free up xml parser memory and return null", "unset", "(", "$", "xml", ")", ";", "$", "xml", "=", "null", ";", "}", "}", "// Valid manifest file return the object", "return", "$", "xml", ";", "}" ]
load manifest file with installation information @param string $dir Directory @return SimpleXMLElement object (or null)
[ "load", "manifest", "file", "with", "installation", "information" ]
65771963f23ccabcf1f867eb17c9452299cfe683
https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Installer/Plugin.php#L405-L432
18,330
jfusion/org.jfusion.framework
src/Installer/Plugin.php
Plugin.getFiles
function getFiles($folder, $name) { $filesArray = array(); $files = Folder::files($folder, null, false, true); $path = JFusionFramework::getPluginPath($name); foreach ($files as $file) { $file = str_replace($path . '/', '', $file); $file = str_replace($path . '\\', '', $file); $data = file_get_contents($file); $filesArray[] = array('name' => $file, 'data' => $data); } $folders = Folder::folders($folder, null, false, true); if (!empty($folders)) { foreach ($folders as $f) { $filesArray = array_merge($filesArray, $this->getFiles($f, $name)); } } return $filesArray; }
php
function getFiles($folder, $name) { $filesArray = array(); $files = Folder::files($folder, null, false, true); $path = JFusionFramework::getPluginPath($name); foreach ($files as $file) { $file = str_replace($path . '/', '', $file); $file = str_replace($path . '\\', '', $file); $data = file_get_contents($file); $filesArray[] = array('name' => $file, 'data' => $data); } $folders = Folder::folders($folder, null, false, true); if (!empty($folders)) { foreach ($folders as $f) { $filesArray = array_merge($filesArray, $this->getFiles($f, $name)); } } return $filesArray; }
[ "function", "getFiles", "(", "$", "folder", ",", "$", "name", ")", "{", "$", "filesArray", "=", "array", "(", ")", ";", "$", "files", "=", "Folder", "::", "files", "(", "$", "folder", ",", "null", ",", "false", ",", "true", ")", ";", "$", "path", "=", "JFusionFramework", "::", "getPluginPath", "(", "$", "name", ")", ";", "foreach", "(", "$", "files", "as", "$", "file", ")", "{", "$", "file", "=", "str_replace", "(", "$", "path", ".", "'/'", ",", "''", ",", "$", "file", ")", ";", "$", "file", "=", "str_replace", "(", "$", "path", ".", "'\\\\'", ",", "''", ",", "$", "file", ")", ";", "$", "data", "=", "file_get_contents", "(", "$", "file", ")", ";", "$", "filesArray", "[", "]", "=", "array", "(", "'name'", "=>", "$", "file", ",", "'data'", "=>", "$", "data", ")", ";", "}", "$", "folders", "=", "Folder", "::", "folders", "(", "$", "folder", ",", "null", ",", "false", ",", "true", ")", ";", "if", "(", "!", "empty", "(", "$", "folders", ")", ")", "{", "foreach", "(", "$", "folders", "as", "$", "f", ")", "{", "$", "filesArray", "=", "array_merge", "(", "$", "filesArray", ",", "$", "this", "->", "getFiles", "(", "$", "f", ",", "$", "name", ")", ")", ";", "}", "}", "return", "$", "filesArray", ";", "}" ]
get files function @param string $folder folder name @param string $name name @return array files
[ "get", "files", "function" ]
65771963f23ccabcf1f867eb17c9452299cfe683
https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Installer/Plugin.php#L442-L462
18,331
phug-php/formatter
src/Phug/Formatter/Element/AbstractAssignmentContainerElement.php
AbstractAssignmentContainerElement.addAssignment
public function addAssignment(AssignmentElement $element) { $element->setContainer($this); $this->getAssignments()->attach($element); return $this; }
php
public function addAssignment(AssignmentElement $element) { $element->setContainer($this); $this->getAssignments()->attach($element); return $this; }
[ "public", "function", "addAssignment", "(", "AssignmentElement", "$", "element", ")", "{", "$", "element", "->", "setContainer", "(", "$", "this", ")", ";", "$", "this", "->", "getAssignments", "(", ")", "->", "attach", "(", "$", "element", ")", ";", "return", "$", "this", ";", "}" ]
Add assignment to the markup. @param AssignmentElement $element @return $this
[ "Add", "assignment", "to", "the", "markup", "." ]
3f9286a169a0d45b8b8acc1fae64e880ebdb567e
https://github.com/phug-php/formatter/blob/3f9286a169a0d45b8b8acc1fae64e880ebdb567e/src/Phug/Formatter/Element/AbstractAssignmentContainerElement.php#L20-L26
18,332
phug-php/formatter
src/Phug/Formatter/Element/AbstractAssignmentContainerElement.php
AbstractAssignmentContainerElement.getAssignmentsByName
public function getAssignmentsByName($name) { $result = []; foreach ($this->getAssignments() as $assignment) { /* @var AssignmentElement $assignment */ if ($assignment->getName() === $name) { $result[] = $assignment; } } return $result; }
php
public function getAssignmentsByName($name) { $result = []; foreach ($this->getAssignments() as $assignment) { /* @var AssignmentElement $assignment */ if ($assignment->getName() === $name) { $result[] = $assignment; } } return $result; }
[ "public", "function", "getAssignmentsByName", "(", "$", "name", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getAssignments", "(", ")", "as", "$", "assignment", ")", "{", "/* @var AssignmentElement $assignment */", "if", "(", "$", "assignment", "->", "getName", "(", ")", "===", "$", "name", ")", "{", "$", "result", "[", "]", "=", "$", "assignment", ";", "}", "}", "return", "$", "result", ";", "}" ]
Return markup assignments list of a specific name. @param $name @return AssignmentElement[]
[ "Return", "markup", "assignments", "list", "of", "a", "specific", "name", "." ]
3f9286a169a0d45b8b8acc1fae64e880ebdb567e
https://github.com/phug-php/formatter/blob/3f9286a169a0d45b8b8acc1fae64e880ebdb567e/src/Phug/Formatter/Element/AbstractAssignmentContainerElement.php#L63-L75
18,333
qcubed/orm
src/Codegen/TypeTable.php
TypeTable.literal
public static function literal($mixColValue) { if (is_null($mixColValue)) { return 'null'; } elseif (is_integer($mixColValue)) { return $mixColValue; } elseif (is_bool($mixColValue)) { return ($mixColValue ? 'true' : 'false'); } elseif (is_float($mixColValue)) { return "(float)$mixColValue"; } elseif (is_object($mixColValue)) { return "t('" . $mixColValue->_toString() . "')"; } // whatever is suitable for the constructor of the object else { return "t('" . str_replace("'", "\\'", $mixColValue) . "')"; } }
php
public static function literal($mixColValue) { if (is_null($mixColValue)) { return 'null'; } elseif (is_integer($mixColValue)) { return $mixColValue; } elseif (is_bool($mixColValue)) { return ($mixColValue ? 'true' : 'false'); } elseif (is_float($mixColValue)) { return "(float)$mixColValue"; } elseif (is_object($mixColValue)) { return "t('" . $mixColValue->_toString() . "')"; } // whatever is suitable for the constructor of the object else { return "t('" . str_replace("'", "\\'", $mixColValue) . "')"; } }
[ "public", "static", "function", "literal", "(", "$", "mixColValue", ")", "{", "if", "(", "is_null", "(", "$", "mixColValue", ")", ")", "{", "return", "'null'", ";", "}", "elseif", "(", "is_integer", "(", "$", "mixColValue", ")", ")", "{", "return", "$", "mixColValue", ";", "}", "elseif", "(", "is_bool", "(", "$", "mixColValue", ")", ")", "{", "return", "(", "$", "mixColValue", "?", "'true'", ":", "'false'", ")", ";", "}", "elseif", "(", "is_float", "(", "$", "mixColValue", ")", ")", "{", "return", "\"(float)$mixColValue\"", ";", "}", "elseif", "(", "is_object", "(", "$", "mixColValue", ")", ")", "{", "return", "\"t('\"", ".", "$", "mixColValue", "->", "_toString", "(", ")", ".", "\"')\"", ";", "}", "// whatever is suitable for the constructor of the object", "else", "{", "return", "\"t('\"", ".", "str_replace", "(", "\"'\"", ",", "\"\\\\'\"", ",", "$", "mixColValue", ")", ".", "\"')\"", ";", "}", "}" ]
Returns the string that will be used to represent the literal value given when codegenning a type table @param mixed $mixColValue @return string
[ "Returns", "the", "string", "that", "will", "be", "used", "to", "represent", "the", "literal", "value", "given", "when", "codegenning", "a", "type", "table" ]
f320eba671f20874b1f3809c5293f8c02d5b1204
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Codegen/TypeTable.php#L99-L115
18,334
dunkelfrosch/phpcoverfish
src/PHPCoverFish/Common/CoverFishOutput.php
CoverFishOutput.writeFinalCheckResults
private function writeFinalCheckResults(CoverFishResult $coverFishResult) { if (false === $this->scanFailure) { $this->writeFileResult(self::FILE_PASS, null); } else { $this->writeFileResult(self::FILE_FAILURE, $coverFishResult->getFailureStream()); } $this->jsonResults[] = $this->jsonResult; }
php
private function writeFinalCheckResults(CoverFishResult $coverFishResult) { if (false === $this->scanFailure) { $this->writeFileResult(self::FILE_PASS, null); } else { $this->writeFileResult(self::FILE_FAILURE, $coverFishResult->getFailureStream()); } $this->jsonResults[] = $this->jsonResult; }
[ "private", "function", "writeFinalCheckResults", "(", "CoverFishResult", "$", "coverFishResult", ")", "{", "if", "(", "false", "===", "$", "this", "->", "scanFailure", ")", "{", "$", "this", "->", "writeFileResult", "(", "self", "::", "FILE_PASS", ",", "null", ")", ";", "}", "else", "{", "$", "this", "->", "writeFileResult", "(", "self", "::", "FILE_FAILURE", ",", "$", "coverFishResult", "->", "getFailureStream", "(", ")", ")", ";", "}", "$", "this", "->", "jsonResults", "[", "]", "=", "$", "this", "->", "jsonResult", ";", "}" ]
write single file check result @param CoverFishResult $coverFishResult
[ "write", "single", "file", "check", "result" ]
779bd399ec8f4cadb3b7854200695c5eb3f5a8ad
https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Common/CoverFishOutput.php#L217-L226
18,335
dunkelfrosch/phpcoverfish
src/PHPCoverFish/Common/CoverFishOutput.php
CoverFishOutput.writeJsonFailureStream
private function writeJsonFailureStream( CoverFishResult $coverFishResult, CoverFishPHPUnitTest $unitTest, CoverFishMessageError $mappingError, $coverLine ) { $this->jsonResult['errorCount'] = $coverFishResult->getFailureCount(); $this->jsonResult['errorMessage'] = $mappingError->getMessageTitle(); $this->jsonResult['errorCode'] = $mappingError->getMessageCode(); $this->jsonResult['cover'] = $coverLine; $this->jsonResult['method'] = $unitTest->getSignature(); $this->jsonResult['line'] = $unitTest->getLine(); $this->jsonResult['file'] = $unitTest->getFile(); }
php
private function writeJsonFailureStream( CoverFishResult $coverFishResult, CoverFishPHPUnitTest $unitTest, CoverFishMessageError $mappingError, $coverLine ) { $this->jsonResult['errorCount'] = $coverFishResult->getFailureCount(); $this->jsonResult['errorMessage'] = $mappingError->getMessageTitle(); $this->jsonResult['errorCode'] = $mappingError->getMessageCode(); $this->jsonResult['cover'] = $coverLine; $this->jsonResult['method'] = $unitTest->getSignature(); $this->jsonResult['line'] = $unitTest->getLine(); $this->jsonResult['file'] = $unitTest->getFile(); }
[ "private", "function", "writeJsonFailureStream", "(", "CoverFishResult", "$", "coverFishResult", ",", "CoverFishPHPUnitTest", "$", "unitTest", ",", "CoverFishMessageError", "$", "mappingError", ",", "$", "coverLine", ")", "{", "$", "this", "->", "jsonResult", "[", "'errorCount'", "]", "=", "$", "coverFishResult", "->", "getFailureCount", "(", ")", ";", "$", "this", "->", "jsonResult", "[", "'errorMessage'", "]", "=", "$", "mappingError", "->", "getMessageTitle", "(", ")", ";", "$", "this", "->", "jsonResult", "[", "'errorCode'", "]", "=", "$", "mappingError", "->", "getMessageCode", "(", ")", ";", "$", "this", "->", "jsonResult", "[", "'cover'", "]", "=", "$", "coverLine", ";", "$", "this", "->", "jsonResult", "[", "'method'", "]", "=", "$", "unitTest", "->", "getSignature", "(", ")", ";", "$", "this", "->", "jsonResult", "[", "'line'", "]", "=", "$", "unitTest", "->", "getLine", "(", ")", ";", "$", "this", "->", "jsonResult", "[", "'file'", "]", "=", "$", "unitTest", "->", "getFile", "(", ")", ";", "}" ]
write single json error line @param CoverFishResult $coverFishResult @param CoverFishPHPUnitTest $unitTest @param CoverFishMessageError $mappingError @param $coverLine
[ "write", "single", "json", "error", "line" ]
779bd399ec8f4cadb3b7854200695c5eb3f5a8ad
https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Common/CoverFishOutput.php#L236-L249
18,336
dunkelfrosch/phpcoverfish
src/PHPCoverFish/Common/CoverFishOutput.php
CoverFishOutput.getMacroLineInfo
protected function getMacroLineInfo($failureCount, CoverFishPHPUnitTest $unitTest) { $lineInfoMacro = '%sError #%s in method "%s" (L:~%s)'; if ($this->outputLevel > 1) { $lineInfoMacro = '%sError #%s in method "%s", Line ~%s'; } return sprintf($lineInfoMacro, $this->setIndent(self::MACRO_CONFIG_DETAIL_LINE_INDENT), (false === $this->preventAnsiColors) ? Color::tplWhiteColor($failureCount) : $failureCount, (false === $this->preventAnsiColors) ? Color::tplWhiteColor($unitTest->getSignature()) : $unitTest->getSignature(), (false === $this->preventAnsiColors) ? Color::tplWhiteColor($unitTest->getLine()) : $unitTest->getLine(), PHP_EOL ); }
php
protected function getMacroLineInfo($failureCount, CoverFishPHPUnitTest $unitTest) { $lineInfoMacro = '%sError #%s in method "%s" (L:~%s)'; if ($this->outputLevel > 1) { $lineInfoMacro = '%sError #%s in method "%s", Line ~%s'; } return sprintf($lineInfoMacro, $this->setIndent(self::MACRO_CONFIG_DETAIL_LINE_INDENT), (false === $this->preventAnsiColors) ? Color::tplWhiteColor($failureCount) : $failureCount, (false === $this->preventAnsiColors) ? Color::tplWhiteColor($unitTest->getSignature()) : $unitTest->getSignature(), (false === $this->preventAnsiColors) ? Color::tplWhiteColor($unitTest->getLine()) : $unitTest->getLine(), PHP_EOL ); }
[ "protected", "function", "getMacroLineInfo", "(", "$", "failureCount", ",", "CoverFishPHPUnitTest", "$", "unitTest", ")", "{", "$", "lineInfoMacro", "=", "'%sError #%s in method \"%s\" (L:~%s)'", ";", "if", "(", "$", "this", "->", "outputLevel", ">", "1", ")", "{", "$", "lineInfoMacro", "=", "'%sError #%s in method \"%s\", Line ~%s'", ";", "}", "return", "sprintf", "(", "$", "lineInfoMacro", ",", "$", "this", "->", "setIndent", "(", "self", "::", "MACRO_CONFIG_DETAIL_LINE_INDENT", ")", ",", "(", "false", "===", "$", "this", "->", "preventAnsiColors", ")", "?", "Color", "::", "tplWhiteColor", "(", "$", "failureCount", ")", ":", "$", "failureCount", ",", "(", "false", "===", "$", "this", "->", "preventAnsiColors", ")", "?", "Color", "::", "tplWhiteColor", "(", "$", "unitTest", "->", "getSignature", "(", ")", ")", ":", "$", "unitTest", "->", "getSignature", "(", ")", ",", "(", "false", "===", "$", "this", "->", "preventAnsiColors", ")", "?", "Color", "::", "tplWhiteColor", "(", "$", "unitTest", "->", "getLine", "(", ")", ")", ":", "$", "unitTest", "->", "getLine", "(", ")", ",", "PHP_EOL", ")", ";", "}" ]
message block macro, line 01, message title @param int $failureCount @param CoverFishPHPUnitTest $unitTest @return string
[ "message", "block", "macro", "line", "01", "message", "title" ]
779bd399ec8f4cadb3b7854200695c5eb3f5a8ad
https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Common/CoverFishOutput.php#L269-L289
18,337
dunkelfrosch/phpcoverfish
src/PHPCoverFish/Common/CoverFishOutput.php
CoverFishOutput.getMacroCoverErrorMessage
protected function getMacroCoverErrorMessage(CoverFishMessageError $mappingError) { $lineMessageMacro = '%s%s: %s '; if ($this->outputLevel > 1) { $lineMessageMacro = '%s%s: %s (ErrorCode: %s)'; } return sprintf($lineMessageMacro, $this->setIndent(self::MACRO_CONFIG_DETAIL_LINE_INDENT), (false === $this->preventAnsiColors) ? Color::tplDarkGrayColor('Message') : 'Message', $mappingError->getMessageTitle(), $mappingError->getMessageCode() ); }
php
protected function getMacroCoverErrorMessage(CoverFishMessageError $mappingError) { $lineMessageMacro = '%s%s: %s '; if ($this->outputLevel > 1) { $lineMessageMacro = '%s%s: %s (ErrorCode: %s)'; } return sprintf($lineMessageMacro, $this->setIndent(self::MACRO_CONFIG_DETAIL_LINE_INDENT), (false === $this->preventAnsiColors) ? Color::tplDarkGrayColor('Message') : 'Message', $mappingError->getMessageTitle(), $mappingError->getMessageCode() ); }
[ "protected", "function", "getMacroCoverErrorMessage", "(", "CoverFishMessageError", "$", "mappingError", ")", "{", "$", "lineMessageMacro", "=", "'%s%s: %s '", ";", "if", "(", "$", "this", "->", "outputLevel", ">", "1", ")", "{", "$", "lineMessageMacro", "=", "'%s%s: %s (ErrorCode: %s)'", ";", "}", "return", "sprintf", "(", "$", "lineMessageMacro", ",", "$", "this", "->", "setIndent", "(", "self", "::", "MACRO_CONFIG_DETAIL_LINE_INDENT", ")", ",", "(", "false", "===", "$", "this", "->", "preventAnsiColors", ")", "?", "Color", "::", "tplDarkGrayColor", "(", "'Message'", ")", ":", "'Message'", ",", "$", "mappingError", "->", "getMessageTitle", "(", ")", ",", "$", "mappingError", "->", "getMessageCode", "(", ")", ")", ";", "}" ]
message block macro, line 04, error message @param CoverFishMessageError $mappingError @return string
[ "message", "block", "macro", "line", "04", "error", "message" ]
779bd399ec8f4cadb3b7854200695c5eb3f5a8ad
https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Common/CoverFishOutput.php#L340-L356
18,338
webforge-labs/psc-cms
lib/Psc/JS/Helper.php
Helper.convertHashMap
public static function convertHashMap(\stdClass $object, $quote = self::QUOTE_SINGLE) { $hash = '{'; $vars = get_object_vars($object); if (count($vars) > 0) { foreach ($vars as $key =>$value) { $hash .= sprintf('"%s": %s,', $key, self::convertValue($value,$quote)); // json encode kanns auch wenn wir statt single quotes double quotes für die keys nehmen } $hash = mb_substr($hash,0,-1); // letzte komma } $hash .= '}'; return $hash; }
php
public static function convertHashMap(\stdClass $object, $quote = self::QUOTE_SINGLE) { $hash = '{'; $vars = get_object_vars($object); if (count($vars) > 0) { foreach ($vars as $key =>$value) { $hash .= sprintf('"%s": %s,', $key, self::convertValue($value,$quote)); // json encode kanns auch wenn wir statt single quotes double quotes für die keys nehmen } $hash = mb_substr($hash,0,-1); // letzte komma } $hash .= '}'; return $hash; }
[ "public", "static", "function", "convertHashMap", "(", "\\", "stdClass", "$", "object", ",", "$", "quote", "=", "self", "::", "QUOTE_SINGLE", ")", "{", "$", "hash", "=", "'{'", ";", "$", "vars", "=", "get_object_vars", "(", "$", "object", ")", ";", "if", "(", "count", "(", "$", "vars", ")", ">", "0", ")", "{", "foreach", "(", "$", "vars", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "hash", ".=", "sprintf", "(", "'\"%s\": %s,'", ",", "$", "key", ",", "self", "::", "convertValue", "(", "$", "value", ",", "$", "quote", ")", ")", ";", "// json encode kanns auch wenn wir statt single quotes double quotes für die keys nehmen", "}", "$", "hash", "=", "mb_substr", "(", "$", "hash", ",", "0", ",", "-", "1", ")", ";", "// letzte komma", "}", "$", "hash", ".=", "'}'", ";", "return", "$", "hash", ";", "}" ]
Wandelt ein Object in ein Javascript Object-Literal um @return string
[ "Wandelt", "ein", "Object", "in", "ein", "Javascript", "Object", "-", "Literal", "um" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/JS/Helper.php#L91-L104
18,339
webforge-labs/psc-cms
lib/Psc/JS/Helper.php
Helper.requireLoad
public static function requireLoad(Array $requirements, Array $alias, $jsCode) { return sprintf( "requireLoad([%s], function (main%s) { // main is unshifted automatically\n %s\n});", self::buildRequirements($requirements), count($alias) > 0 ? ', '.implode(', ', $alias) : '', self::convertJSCode($jsCode) ); }
php
public static function requireLoad(Array $requirements, Array $alias, $jsCode) { return sprintf( "requireLoad([%s], function (main%s) { // main is unshifted automatically\n %s\n});", self::buildRequirements($requirements), count($alias) > 0 ? ', '.implode(', ', $alias) : '', self::convertJSCode($jsCode) ); }
[ "public", "static", "function", "requireLoad", "(", "Array", "$", "requirements", ",", "Array", "$", "alias", ",", "$", "jsCode", ")", "{", "return", "sprintf", "(", "\"requireLoad([%s], function (main%s) { // main is unshifted automatically\\n %s\\n});\"", ",", "self", "::", "buildRequirements", "(", "$", "requirements", ")", ",", "count", "(", "$", "alias", ")", ">", "0", "?", "', '", ".", "implode", "(", "', '", ",", "$", "alias", ")", ":", "''", ",", "self", "::", "convertJSCode", "(", "$", "jsCode", ")", ")", ";", "}" ]
This function loads inline script in blocking mode the application has to inject window.requireLoad this is a blocking way to load, because there is the requireLoad() function which is directly called, which concatenates the job to the boot.getLoader() the jobs can then be loaded with boot.getLoader().finished()
[ "This", "function", "loads", "inline", "script", "in", "blocking", "mode" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/JS/Helper.php#L157-L164
18,340
webforge-labs/psc-cms
lib/Psc/JS/Helper.php
Helper.bootLoad
public static function bootLoad(Array $requirements, $alias = array(), $jsCode) { return self::requirejs('boot', 'boot', sprintf( "boot.getLoader().onRequire([%s], function (%s) {\n %s\n });", self::buildRequirements($requirements), implode(', ', $alias), self::convertJSCode($jsCode) )); }
php
public static function bootLoad(Array $requirements, $alias = array(), $jsCode) { return self::requirejs('boot', 'boot', sprintf( "boot.getLoader().onRequire([%s], function (%s) {\n %s\n });", self::buildRequirements($requirements), implode(', ', $alias), self::convertJSCode($jsCode) )); }
[ "public", "static", "function", "bootLoad", "(", "Array", "$", "requirements", ",", "$", "alias", "=", "array", "(", ")", ",", "$", "jsCode", ")", "{", "return", "self", "::", "requirejs", "(", "'boot'", ",", "'boot'", ",", "sprintf", "(", "\"boot.getLoader().onRequire([%s], function (%s) {\\n %s\\n });\"", ",", "self", "::", "buildRequirements", "(", "$", "requirements", ")", ",", "implode", "(", "', '", ",", "$", "alias", ")", ",", "self", "::", "convertJSCode", "(", "$", "jsCode", ")", ")", ")", ";", "}" ]
This function loads inline script in an HTML-page this is NON blocking way to load, because there the require is nested here use it in inline scripts which are directly loaded from the HTML on the index page (and only there) boot is required boot should have .getLoader() to attach the requirements and loading callback to @return string
[ "This", "function", "loads", "inline", "script", "in", "an", "HTML", "-", "page" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/JS/Helper.php#L176-L183
18,341
Chill-project/Main
Form/Type/AppendScopeChoiceTypeTrait.php
AppendScopeChoiceTypeTrait.appendScopeChoices
protected function appendScopeChoices(FormBuilderInterface $builder, Role $role, Center $center, User $user, AuthorizationHelper $authorizationHelper, TranslatableStringHelper $translatableStringHelper, ObjectManager $om, $name = 'scope') { $reachableScopes = $authorizationHelper ->getReachableScopes($user, $role, $center); $choices = array(); foreach($reachableScopes as $scope) { $choices[$scope->getId()] = $translatableStringHelper ->localize($scope->getName()); } $dataTransformer = new ScopeTransformer($om); $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($choices, $name, $dataTransformer, $builder) { $form = $event->getForm(); $form->add( $builder ->create($name, 'choice', array( 'choices' => $choices, 'auto_initialize' => false ) ) ->addModelTransformer($dataTransformer) ->getForm() ); }); }
php
protected function appendScopeChoices(FormBuilderInterface $builder, Role $role, Center $center, User $user, AuthorizationHelper $authorizationHelper, TranslatableStringHelper $translatableStringHelper, ObjectManager $om, $name = 'scope') { $reachableScopes = $authorizationHelper ->getReachableScopes($user, $role, $center); $choices = array(); foreach($reachableScopes as $scope) { $choices[$scope->getId()] = $translatableStringHelper ->localize($scope->getName()); } $dataTransformer = new ScopeTransformer($om); $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($choices, $name, $dataTransformer, $builder) { $form = $event->getForm(); $form->add( $builder ->create($name, 'choice', array( 'choices' => $choices, 'auto_initialize' => false ) ) ->addModelTransformer($dataTransformer) ->getForm() ); }); }
[ "protected", "function", "appendScopeChoices", "(", "FormBuilderInterface", "$", "builder", ",", "Role", "$", "role", ",", "Center", "$", "center", ",", "User", "$", "user", ",", "AuthorizationHelper", "$", "authorizationHelper", ",", "TranslatableStringHelper", "$", "translatableStringHelper", ",", "ObjectManager", "$", "om", ",", "$", "name", "=", "'scope'", ")", "{", "$", "reachableScopes", "=", "$", "authorizationHelper", "->", "getReachableScopes", "(", "$", "user", ",", "$", "role", ",", "$", "center", ")", ";", "$", "choices", "=", "array", "(", ")", ";", "foreach", "(", "$", "reachableScopes", "as", "$", "scope", ")", "{", "$", "choices", "[", "$", "scope", "->", "getId", "(", ")", "]", "=", "$", "translatableStringHelper", "->", "localize", "(", "$", "scope", "->", "getName", "(", ")", ")", ";", "}", "$", "dataTransformer", "=", "new", "ScopeTransformer", "(", "$", "om", ")", ";", "$", "builder", "->", "addEventListener", "(", "FormEvents", "::", "PRE_SET_DATA", ",", "function", "(", "FormEvent", "$", "event", ")", "use", "(", "$", "choices", ",", "$", "name", ",", "$", "dataTransformer", ",", "$", "builder", ")", "{", "$", "form", "=", "$", "event", "->", "getForm", "(", ")", ";", "$", "form", "->", "add", "(", "$", "builder", "->", "create", "(", "$", "name", ",", "'choice'", ",", "array", "(", "'choices'", "=>", "$", "choices", ",", "'auto_initialize'", "=>", "false", ")", ")", "->", "addModelTransformer", "(", "$", "dataTransformer", ")", "->", "getForm", "(", ")", ")", ";", "}", ")", ";", "}" ]
Append a scope choice field, with the scopes reachable by given user for the given role and center. The field is added on event FormEvents::PRE_SET_DATA @param FormBuilderInterface $builder @param Role $role @param Center $center @param User $user @param AuthorizationHelper $authorizationHelper @param TranslatableStringHelper $translatableStringHelper @param string $name
[ "Append", "a", "scope", "choice", "field", "with", "the", "scopes", "reachable", "by", "given", "user", "for", "the", "given", "role", "and", "center", "." ]
384cb6c793072a4f1047dc5cafc2157ee2419f60
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Form/Type/AppendScopeChoiceTypeTrait.php#L100-L131
18,342
laraning/surveyor
src/Traits/UsesProfiles.php
UsesProfiles.hasProfile
public function hasProfile($profiles) : bool { $profiles = (array) $profiles; return count(array_intersect($this->profiles->pluck('code')->toArray(), $profiles)) > 0; }
php
public function hasProfile($profiles) : bool { $profiles = (array) $profiles; return count(array_intersect($this->profiles->pluck('code')->toArray(), $profiles)) > 0; }
[ "public", "function", "hasProfile", "(", "$", "profiles", ")", ":", "bool", "{", "$", "profiles", "=", "(", "array", ")", "$", "profiles", ";", "return", "count", "(", "array_intersect", "(", "$", "this", "->", "profiles", "->", "pluck", "(", "'code'", ")", "->", "toArray", "(", ")", ",", "$", "profiles", ")", ")", ">", "0", ";", "}" ]
Matches at least one user profile. @param array $profiles The user profile string array. @return bool True in case it finds at least one.
[ "Matches", "at", "least", "one", "user", "profile", "." ]
d845b74d20f9a4a307991019502c1b14b1730e86
https://github.com/laraning/surveyor/blob/d845b74d20f9a4a307991019502c1b14b1730e86/src/Traits/UsesProfiles.php#L23-L28
18,343
laraning/surveyor
src/Traits/UsesProfiles.php
UsesProfiles.hasAllProfiles
public function hasAllProfiles($profiles) : bool { $profiles = (array) $profiles; return count(array_intersect($this->profiles->pluck('code')->toArray(), $profiles)) == count($profiles); }
php
public function hasAllProfiles($profiles) : bool { $profiles = (array) $profiles; return count(array_intersect($this->profiles->pluck('code')->toArray(), $profiles)) == count($profiles); }
[ "public", "function", "hasAllProfiles", "(", "$", "profiles", ")", ":", "bool", "{", "$", "profiles", "=", "(", "array", ")", "$", "profiles", ";", "return", "count", "(", "array_intersect", "(", "$", "this", "->", "profiles", "->", "pluck", "(", "'code'", ")", "->", "toArray", "(", ")", ",", "$", "profiles", ")", ")", "==", "count", "(", "$", "profiles", ")", ";", "}" ]
Matches ALL user profiles. @param array $profiles The user profile string array. @return bool True in case it finds ALL of them.
[ "Matches", "ALL", "user", "profiles", "." ]
d845b74d20f9a4a307991019502c1b14b1730e86
https://github.com/laraning/surveyor/blob/d845b74d20f9a4a307991019502c1b14b1730e86/src/Traits/UsesProfiles.php#L37-L42
18,344
laraning/surveyor
src/Traits/UsesProfiles.php
UsesProfiles.assignProfiles
public function assignProfiles($profiles) : void { $profiles = (array) $profiles; foreach ($profiles as $profile) { $electedProfile = Profile::where('code', $profile)->first(); // Profile exists and not assigned to user? if (!is_null($electedProfile) && !$this->hasProfile($profile)) { // Assign both role and permissions defined for this user profile. // Into the Spatie Permissions. $this->assignRole(Role::find([$electedProfile->role_id])->first()->name); $this->givePermissionTo(Permission::find([$electedProfile->permission_id])->first()->name); // Assign user profile into the profiles table. $this->profiles()->save($electedProfile); } } }
php
public function assignProfiles($profiles) : void { $profiles = (array) $profiles; foreach ($profiles as $profile) { $electedProfile = Profile::where('code', $profile)->first(); // Profile exists and not assigned to user? if (!is_null($electedProfile) && !$this->hasProfile($profile)) { // Assign both role and permissions defined for this user profile. // Into the Spatie Permissions. $this->assignRole(Role::find([$electedProfile->role_id])->first()->name); $this->givePermissionTo(Permission::find([$electedProfile->permission_id])->first()->name); // Assign user profile into the profiles table. $this->profiles()->save($electedProfile); } } }
[ "public", "function", "assignProfiles", "(", "$", "profiles", ")", ":", "void", "{", "$", "profiles", "=", "(", "array", ")", "$", "profiles", ";", "foreach", "(", "$", "profiles", "as", "$", "profile", ")", "{", "$", "electedProfile", "=", "Profile", "::", "where", "(", "'code'", ",", "$", "profile", ")", "->", "first", "(", ")", ";", "// Profile exists and not assigned to user?", "if", "(", "!", "is_null", "(", "$", "electedProfile", ")", "&&", "!", "$", "this", "->", "hasProfile", "(", "$", "profile", ")", ")", "{", "// Assign both role and permissions defined for this user profile.", "// Into the Spatie Permissions.", "$", "this", "->", "assignRole", "(", "Role", "::", "find", "(", "[", "$", "electedProfile", "->", "role_id", "]", ")", "->", "first", "(", ")", "->", "name", ")", ";", "$", "this", "->", "givePermissionTo", "(", "Permission", "::", "find", "(", "[", "$", "electedProfile", "->", "permission_id", "]", ")", "->", "first", "(", ")", "->", "name", ")", ";", "// Assign user profile into the profiles table.", "$", "this", "->", "profiles", "(", ")", "->", "save", "(", "$", "electedProfile", ")", ";", "}", "}", "}" ]
Assigns profiles to the current model. @param string|array $profiles The profile name(s) from the profiles table. @return void
[ "Assigns", "profiles", "to", "the", "current", "model", "." ]
d845b74d20f9a4a307991019502c1b14b1730e86
https://github.com/laraning/surveyor/blob/d845b74d20f9a4a307991019502c1b14b1730e86/src/Traits/UsesProfiles.php#L51-L68
18,345
RobinDumontChaponet/TransitiveCore
src/simple/Front.php
Front.getContent
public function getContent(string $contentType = null): string { /* if(null == $contentType) $contentType = $this->contentType; */ switch($contentType) { case 'application/vnd.transitive.document+json': return $this->route->getDocument(); break; case 'application/vnd.transitive.document+xml': return $this->route->getDocument()->asXML('document'); break; case 'application/vnd.transitive.document+yaml': return $this->route->getDocument()->asYAML(); break; case 'application/vnd.transitive.head+json': return $this->route->getHead()->asJson(); break; case 'application/vnd.transitive.head+xml': return $this->route->getHead()->asXML('head'); break; case 'application/vnd.transitive.head+yaml': return $this->route->getHead()->asYAML(); break; case 'application/vnd.transitive.content+xhtml': case 'application/vnd.transitive.content+html': return $this->route->getContent(); break; case 'application/vnd.transitive.content+json': return $this->route->getContent()->asJson(); break; case 'application/vnd.transitive.content+xml': return $this->route->getContent()->asXML('content'); break; case 'application/vnd.transitive.content+yaml': return $this->route->getContent()->asYAML(); break; case 'text/plain': return $this->layout->getContent()->asString(); break; case 'application/json': if($this->route->hasContent('application/json')) return $this->route->getContentByType('application/json')->asJson(); elseif(404 != http_response_code()) { http_response_code(404); $_SERVER['REDIRECT_STATUS'] = 404; return ''; } break; case 'application/xml': if($this->route->hasContent('application/xml')) return $this->route->getContentByType('application/xml')->asJson(); elseif(404 != http_response_code()) { http_response_code(404); $_SERVER['REDIRECT_STATUS'] = 404; return ''; } break; default: return $this->layout->getView(); } }
php
public function getContent(string $contentType = null): string { /* if(null == $contentType) $contentType = $this->contentType; */ switch($contentType) { case 'application/vnd.transitive.document+json': return $this->route->getDocument(); break; case 'application/vnd.transitive.document+xml': return $this->route->getDocument()->asXML('document'); break; case 'application/vnd.transitive.document+yaml': return $this->route->getDocument()->asYAML(); break; case 'application/vnd.transitive.head+json': return $this->route->getHead()->asJson(); break; case 'application/vnd.transitive.head+xml': return $this->route->getHead()->asXML('head'); break; case 'application/vnd.transitive.head+yaml': return $this->route->getHead()->asYAML(); break; case 'application/vnd.transitive.content+xhtml': case 'application/vnd.transitive.content+html': return $this->route->getContent(); break; case 'application/vnd.transitive.content+json': return $this->route->getContent()->asJson(); break; case 'application/vnd.transitive.content+xml': return $this->route->getContent()->asXML('content'); break; case 'application/vnd.transitive.content+yaml': return $this->route->getContent()->asYAML(); break; case 'text/plain': return $this->layout->getContent()->asString(); break; case 'application/json': if($this->route->hasContent('application/json')) return $this->route->getContentByType('application/json')->asJson(); elseif(404 != http_response_code()) { http_response_code(404); $_SERVER['REDIRECT_STATUS'] = 404; return ''; } break; case 'application/xml': if($this->route->hasContent('application/xml')) return $this->route->getContentByType('application/xml')->asJson(); elseif(404 != http_response_code()) { http_response_code(404); $_SERVER['REDIRECT_STATUS'] = 404; return ''; } break; default: return $this->layout->getView(); } }
[ "public", "function", "getContent", "(", "string", "$", "contentType", "=", "null", ")", ":", "string", "{", "/*\n if(null == $contentType)\n $contentType = $this->contentType;\n*/", "switch", "(", "$", "contentType", ")", "{", "case", "'application/vnd.transitive.document+json'", ":", "return", "$", "this", "->", "route", "->", "getDocument", "(", ")", ";", "break", ";", "case", "'application/vnd.transitive.document+xml'", ":", "return", "$", "this", "->", "route", "->", "getDocument", "(", ")", "->", "asXML", "(", "'document'", ")", ";", "break", ";", "case", "'application/vnd.transitive.document+yaml'", ":", "return", "$", "this", "->", "route", "->", "getDocument", "(", ")", "->", "asYAML", "(", ")", ";", "break", ";", "case", "'application/vnd.transitive.head+json'", ":", "return", "$", "this", "->", "route", "->", "getHead", "(", ")", "->", "asJson", "(", ")", ";", "break", ";", "case", "'application/vnd.transitive.head+xml'", ":", "return", "$", "this", "->", "route", "->", "getHead", "(", ")", "->", "asXML", "(", "'head'", ")", ";", "break", ";", "case", "'application/vnd.transitive.head+yaml'", ":", "return", "$", "this", "->", "route", "->", "getHead", "(", ")", "->", "asYAML", "(", ")", ";", "break", ";", "case", "'application/vnd.transitive.content+xhtml'", ":", "case", "'application/vnd.transitive.content+html'", ":", "return", "$", "this", "->", "route", "->", "getContent", "(", ")", ";", "break", ";", "case", "'application/vnd.transitive.content+json'", ":", "return", "$", "this", "->", "route", "->", "getContent", "(", ")", "->", "asJson", "(", ")", ";", "break", ";", "case", "'application/vnd.transitive.content+xml'", ":", "return", "$", "this", "->", "route", "->", "getContent", "(", ")", "->", "asXML", "(", "'content'", ")", ";", "break", ";", "case", "'application/vnd.transitive.content+yaml'", ":", "return", "$", "this", "->", "route", "->", "getContent", "(", ")", "->", "asYAML", "(", ")", ";", "break", ";", "case", "'text/plain'", ":", "return", "$", "this", "->", "layout", "->", "getContent", "(", ")", "->", "asString", "(", ")", ";", "break", ";", "case", "'application/json'", ":", "if", "(", "$", "this", "->", "route", "->", "hasContent", "(", "'application/json'", ")", ")", "return", "$", "this", "->", "route", "->", "getContentByType", "(", "'application/json'", ")", "->", "asJson", "(", ")", ";", "elseif", "(", "404", "!=", "http_response_code", "(", ")", ")", "{", "http_response_code", "(", "404", ")", ";", "$", "_SERVER", "[", "'REDIRECT_STATUS'", "]", "=", "404", ";", "return", "''", ";", "}", "break", ";", "case", "'application/xml'", ":", "if", "(", "$", "this", "->", "route", "->", "hasContent", "(", "'application/xml'", ")", ")", "return", "$", "this", "->", "route", "->", "getContentByType", "(", "'application/xml'", ")", "->", "asJson", "(", ")", ";", "elseif", "(", "404", "!=", "http_response_code", "(", ")", ")", "{", "http_response_code", "(", "404", ")", ";", "$", "_SERVER", "[", "'REDIRECT_STATUS'", "]", "=", "404", ";", "return", "''", ";", "}", "break", ";", "default", ":", "return", "$", "this", "->", "layout", "->", "getView", "(", ")", ";", "}", "}" ]
Return processed content from current route. @return string @param string $contentType = null
[ "Return", "processed", "content", "from", "current", "route", "." ]
b83dd6fe0e49b8773de0f60861e5a5c306e2a38d
https://github.com/RobinDumontChaponet/TransitiveCore/blob/b83dd6fe0e49b8773de0f60861e5a5c306e2a38d/src/simple/Front.php#L182-L249
18,346
alphayax/phpdoc_md
src/models/ClassMd.php
ClassMd.computeType
protected function computeType(){ if( interface_exists( $this->class, false)){ $this->type = 'Interface'; return; } if( trait_exists( $this->class, false)){ $this->type = 'Trait'; return; } $this->type = 'Class'; }
php
protected function computeType(){ if( interface_exists( $this->class, false)){ $this->type = 'Interface'; return; } if( trait_exists( $this->class, false)){ $this->type = 'Trait'; return; } $this->type = 'Class'; }
[ "protected", "function", "computeType", "(", ")", "{", "if", "(", "interface_exists", "(", "$", "this", "->", "class", ",", "false", ")", ")", "{", "$", "this", "->", "type", "=", "'Interface'", ";", "return", ";", "}", "if", "(", "trait_exists", "(", "$", "this", "->", "class", ",", "false", ")", ")", "{", "$", "this", "->", "type", "=", "'Trait'", ";", "return", ";", "}", "$", "this", "->", "type", "=", "'Class'", ";", "}" ]
Determine the type of class
[ "Determine", "the", "type", "of", "class" ]
326da10b837161591a32ab4f36f9b2f4feabbe65
https://github.com/alphayax/phpdoc_md/blob/326da10b837161591a32ab4f36f9b2f4feabbe65/src/models/ClassMd.php#L53-L63
18,347
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseApiLogPeer.php
BaseApiLogPeer.doSelectOne
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) { $critcopy = clone $criteria; $critcopy->setLimit(1); $objects = ApiLogPeer::doSelect($critcopy, $con); if ($objects) { return $objects[0]; } return null; }
php
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) { $critcopy = clone $criteria; $critcopy->setLimit(1); $objects = ApiLogPeer::doSelect($critcopy, $con); if ($objects) { return $objects[0]; } return null; }
[ "public", "static", "function", "doSelectOne", "(", "Criteria", "$", "criteria", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "$", "critcopy", "=", "clone", "$", "criteria", ";", "$", "critcopy", "->", "setLimit", "(", "1", ")", ";", "$", "objects", "=", "ApiLogPeer", "::", "doSelect", "(", "$", "critcopy", ",", "$", "con", ")", ";", "if", "(", "$", "objects", ")", "{", "return", "$", "objects", "[", "0", "]", ";", "}", "return", "null", ";", "}" ]
Selects one object from the DB. @param Criteria $criteria object used to create the SELECT statement. @param PropelPDO $con @return ApiLog @throws PropelException Any exceptions caught during processing will be rethrown wrapped into a PropelException.
[ "Selects", "one", "object", "from", "the", "DB", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseApiLogPeer.php#L236-L246
18,348
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseApiLogPeer.php
BaseApiLogPeer.doSelect
public static function doSelect(Criteria $criteria, PropelPDO $con = null) { return ApiLogPeer::populateObjects(ApiLogPeer::doSelectStmt($criteria, $con)); }
php
public static function doSelect(Criteria $criteria, PropelPDO $con = null) { return ApiLogPeer::populateObjects(ApiLogPeer::doSelectStmt($criteria, $con)); }
[ "public", "static", "function", "doSelect", "(", "Criteria", "$", "criteria", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "return", "ApiLogPeer", "::", "populateObjects", "(", "ApiLogPeer", "::", "doSelectStmt", "(", "$", "criteria", ",", "$", "con", ")", ")", ";", "}" ]
Selects several row from the DB. @param Criteria $criteria The Criteria object used to build the SELECT statement. @param PropelPDO $con @return array Array of selected Objects @throws PropelException Any exceptions caught during processing will be rethrown wrapped into a PropelException.
[ "Selects", "several", "row", "from", "the", "DB", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseApiLogPeer.php#L256-L259
18,349
aedart/laravel-helpers
src/Traits/Auth/PasswordTrait.php
PasswordTrait.getDefaultPassword
public function getDefaultPassword(): ?PasswordBroker { // By default, the Password Facade does not return the // any actual password broker, but rather an // instance of \Illuminate\Auth\Passwords\PasswordBrokerManager. // Therefore, we make sure only to obtain its // "default broker", to make sure that its only the guard // instance that we obtain. $manager = Password::getFacadeRoot(); if (isset($manager)) { return $manager->broker(); } return $manager; }
php
public function getDefaultPassword(): ?PasswordBroker { // By default, the Password Facade does not return the // any actual password broker, but rather an // instance of \Illuminate\Auth\Passwords\PasswordBrokerManager. // Therefore, we make sure only to obtain its // "default broker", to make sure that its only the guard // instance that we obtain. $manager = Password::getFacadeRoot(); if (isset($manager)) { return $manager->broker(); } return $manager; }
[ "public", "function", "getDefaultPassword", "(", ")", ":", "?", "PasswordBroker", "{", "// By default, the Password Facade does not return the", "// any actual password broker, but rather an", "// instance of \\Illuminate\\Auth\\Passwords\\PasswordBrokerManager.", "// Therefore, we make sure only to obtain its", "// \"default broker\", to make sure that its only the guard", "// instance that we obtain.", "$", "manager", "=", "Password", "::", "getFacadeRoot", "(", ")", ";", "if", "(", "isset", "(", "$", "manager", ")", ")", "{", "return", "$", "manager", "->", "broker", "(", ")", ";", "}", "return", "$", "manager", ";", "}" ]
Get a default password value, if any is available @return PasswordBroker|null A default password value or Null if no default value is available
[ "Get", "a", "default", "password", "value", "if", "any", "is", "available" ]
8b81a2d6658f3f8cb62b6be2c34773aaa2df219a
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Auth/PasswordTrait.php#L76-L89
18,350
webforge-labs/psc-cms
lib/Psc/UI/FormInputSet.php
FormInputSet.html
public function html() { if (!$this->isMorphed()) $this->morph(); $html = NULL; foreach ($this->elements as $el) { $html .= $el->html()."\n"; } return $html; }
php
public function html() { if (!$this->isMorphed()) $this->morph(); $html = NULL; foreach ($this->elements as $el) { $html .= $el->html()."\n"; } return $html; }
[ "public", "function", "html", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isMorphed", "(", ")", ")", "$", "this", "->", "morph", "(", ")", ";", "$", "html", "=", "NULL", ";", "foreach", "(", "$", "this", "->", "elements", "as", "$", "el", ")", "{", "$", "html", ".=", "$", "el", "->", "html", "(", ")", ".", "\"\\n\"", ";", "}", "return", "$", "html", ";", "}" ]
Wenn noch nicht gemorphed, wird das getan
[ "Wenn", "noch", "nicht", "gemorphed", "wird", "das", "getan" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/FormInputSet.php#L77-L87
18,351
factorio-item-browser/export-data
src/Registry/ModRegistry.php
ModRegistry.set
public function set(Mod $mod): void { $this->loadMods(); $this->mods[$mod->getName()] = $mod; }
php
public function set(Mod $mod): void { $this->loadMods(); $this->mods[$mod->getName()] = $mod; }
[ "public", "function", "set", "(", "Mod", "$", "mod", ")", ":", "void", "{", "$", "this", "->", "loadMods", "(", ")", ";", "$", "this", "->", "mods", "[", "$", "mod", "->", "getName", "(", ")", "]", "=", "$", "mod", ";", "}" ]
Sets a mod into the registry. @param Mod $mod
[ "Sets", "a", "mod", "into", "the", "registry", "." ]
1413b2eed0fbfed0521457ac7ef0d668ac30c212
https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Registry/ModRegistry.php#L54-L58
18,352
factorio-item-browser/export-data
src/Registry/ModRegistry.php
ModRegistry.get
public function get(string $modName): ?Mod { $this->loadMods(); return $this->mods[$modName] ?? null; }
php
public function get(string $modName): ?Mod { $this->loadMods(); return $this->mods[$modName] ?? null; }
[ "public", "function", "get", "(", "string", "$", "modName", ")", ":", "?", "Mod", "{", "$", "this", "->", "loadMods", "(", ")", ";", "return", "$", "this", "->", "mods", "[", "$", "modName", "]", "??", "null", ";", "}" ]
Returns a mod from the registry. @param string $modName @return Mod|null
[ "Returns", "a", "mod", "from", "the", "registry", "." ]
1413b2eed0fbfed0521457ac7ef0d668ac30c212
https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Registry/ModRegistry.php#L65-L69
18,353
factorio-item-browser/export-data
src/Registry/ModRegistry.php
ModRegistry.saveMods
public function saveMods(): void { $mods = []; foreach ($this->mods as $mod) { $mods[] = $mod->writeData(); } $this->saveContent(self::HASH_FILE_MODS, $this->encodeContent($mods)); }
php
public function saveMods(): void { $mods = []; foreach ($this->mods as $mod) { $mods[] = $mod->writeData(); } $this->saveContent(self::HASH_FILE_MODS, $this->encodeContent($mods)); }
[ "public", "function", "saveMods", "(", ")", ":", "void", "{", "$", "mods", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "mods", "as", "$", "mod", ")", "{", "$", "mods", "[", "]", "=", "$", "mod", "->", "writeData", "(", ")", ";", "}", "$", "this", "->", "saveContent", "(", "self", "::", "HASH_FILE_MODS", ",", "$", "this", "->", "encodeContent", "(", "$", "mods", ")", ")", ";", "}" ]
Saves the currently known mod to the adapter.
[ "Saves", "the", "currently", "known", "mod", "to", "the", "adapter", "." ]
1413b2eed0fbfed0521457ac7ef0d668ac30c212
https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Registry/ModRegistry.php#L84-L91
18,354
factorio-item-browser/export-data
src/Registry/ModRegistry.php
ModRegistry.loadMods
protected function loadMods(): void { if (!$this->isLoaded) { $this->mods = []; foreach ($this->decodeContent((string) $this->loadContent(self::HASH_FILE_MODS)) as $modData) { if (is_array($modData)) { $mod = new Mod(); $mod->readData(new DataContainer($modData)); $this->mods[$mod->getName()] = $mod; } } $this->isLoaded = true; } }
php
protected function loadMods(): void { if (!$this->isLoaded) { $this->mods = []; foreach ($this->decodeContent((string) $this->loadContent(self::HASH_FILE_MODS)) as $modData) { if (is_array($modData)) { $mod = new Mod(); $mod->readData(new DataContainer($modData)); $this->mods[$mod->getName()] = $mod; } } $this->isLoaded = true; } }
[ "protected", "function", "loadMods", "(", ")", ":", "void", "{", "if", "(", "!", "$", "this", "->", "isLoaded", ")", "{", "$", "this", "->", "mods", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "decodeContent", "(", "(", "string", ")", "$", "this", "->", "loadContent", "(", "self", "::", "HASH_FILE_MODS", ")", ")", "as", "$", "modData", ")", "{", "if", "(", "is_array", "(", "$", "modData", ")", ")", "{", "$", "mod", "=", "new", "Mod", "(", ")", ";", "$", "mod", "->", "readData", "(", "new", "DataContainer", "(", "$", "modData", ")", ")", ";", "$", "this", "->", "mods", "[", "$", "mod", "->", "getName", "(", ")", "]", "=", "$", "mod", ";", "}", "}", "$", "this", "->", "isLoaded", "=", "true", ";", "}", "}" ]
Loads the mods from the file.
[ "Loads", "the", "mods", "from", "the", "file", "." ]
1413b2eed0fbfed0521457ac7ef0d668ac30c212
https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Registry/ModRegistry.php#L96-L109
18,355
webforge-labs/psc-cms
lib/Psc/Code/Numbers.php
Numbers.toRoman
public static function toRoman($num) { $conv = array( 10 => array('X', 'C', 'M'), 5 => array('V', 'L', 'D'), 1 => array('I', 'X', 'C')); $roman = ''; if ($num < 0) { return ''; } $num = (int) $num; $digit = (int) ($num / 1000); $num -= $digit * 1000; while ($digit > 0) { $roman .= 'M'; $digit--; } for ($i = 2; $i >= 0; $i--) { $power = pow(10, $i); $digit = (int) ($num / $power); $num -= $digit * $power; if (($digit == 9) || ($digit == 4)) { $roman .= $conv[1][$i] . $conv[$digit+1][$i]; } else { if ($digit >= 5) { $roman .= $conv[5][$i]; $digit -= 5; } while ($digit > 0) { $roman .= $conv[1][$i]; $digit--; } } } return $roman; }
php
public static function toRoman($num) { $conv = array( 10 => array('X', 'C', 'M'), 5 => array('V', 'L', 'D'), 1 => array('I', 'X', 'C')); $roman = ''; if ($num < 0) { return ''; } $num = (int) $num; $digit = (int) ($num / 1000); $num -= $digit * 1000; while ($digit > 0) { $roman .= 'M'; $digit--; } for ($i = 2; $i >= 0; $i--) { $power = pow(10, $i); $digit = (int) ($num / $power); $num -= $digit * $power; if (($digit == 9) || ($digit == 4)) { $roman .= $conv[1][$i] . $conv[$digit+1][$i]; } else { if ($digit >= 5) { $roman .= $conv[5][$i]; $digit -= 5; } while ($digit > 0) { $roman .= $conv[1][$i]; $digit--; } } } return $roman; }
[ "public", "static", "function", "toRoman", "(", "$", "num", ")", "{", "$", "conv", "=", "array", "(", "10", "=>", "array", "(", "'X'", ",", "'C'", ",", "'M'", ")", ",", "5", "=>", "array", "(", "'V'", ",", "'L'", ",", "'D'", ")", ",", "1", "=>", "array", "(", "'I'", ",", "'X'", ",", "'C'", ")", ")", ";", "$", "roman", "=", "''", ";", "if", "(", "$", "num", "<", "0", ")", "{", "return", "''", ";", "}", "$", "num", "=", "(", "int", ")", "$", "num", ";", "$", "digit", "=", "(", "int", ")", "(", "$", "num", "/", "1000", ")", ";", "$", "num", "-=", "$", "digit", "*", "1000", ";", "while", "(", "$", "digit", ">", "0", ")", "{", "$", "roman", ".=", "'M'", ";", "$", "digit", "--", ";", "}", "for", "(", "$", "i", "=", "2", ";", "$", "i", ">=", "0", ";", "$", "i", "--", ")", "{", "$", "power", "=", "pow", "(", "10", ",", "$", "i", ")", ";", "$", "digit", "=", "(", "int", ")", "(", "$", "num", "/", "$", "power", ")", ";", "$", "num", "-=", "$", "digit", "*", "$", "power", ";", "if", "(", "(", "$", "digit", "==", "9", ")", "||", "(", "$", "digit", "==", "4", ")", ")", "{", "$", "roman", ".=", "$", "conv", "[", "1", "]", "[", "$", "i", "]", ".", "$", "conv", "[", "$", "digit", "+", "1", "]", "[", "$", "i", "]", ";", "}", "else", "{", "if", "(", "$", "digit", ">=", "5", ")", "{", "$", "roman", ".=", "$", "conv", "[", "5", "]", "[", "$", "i", "]", ";", "$", "digit", "-=", "5", ";", "}", "while", "(", "$", "digit", ">", "0", ")", "{", "$", "roman", ".=", "$", "conv", "[", "1", "]", "[", "$", "i", "]", ";", "$", "digit", "--", ";", "}", "}", "}", "return", "$", "roman", ";", "}" ]
Converts a number to its roman numeral representation @param integer $num An integer between 0 and 3999 inclusive that should be converted to a roman numeral integers higher than 3999 are supported from version 0.1.2 Note: For an accurate result the integer shouldn't be higher than 5 999 999. Higher integers are still converted but they do not reflect an historically correct Roman Numeral. @param bool $uppercase Uppercase output: default true @param bool $html Enable html overscore required for integers over 3999. default true @return string $roman The corresponding roman numeral @author David Costa <[email protected]> @author Sterling Hughes <[email protected]>
[ "Converts", "a", "number", "to", "its", "roman", "numeral", "representation" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Numbers.php#L63-L103
18,356
askupasoftware/amarkal
Extensions/WordPress/Options/OptionsPage.php
OptionsPage.register
public function register() { // This is the initial activation, save the defaults to the db if(!$this->options->exists()) { $this->reset(); } // Only preprocess if this is the currently viewed page if( $this->page->get_slug() == filter_input(INPUT_GET, 'page') ) { $this->preprocess(); } $this->page->register(); $this->set_global_variable(); $this->do_action('afw_options_init'); }
php
public function register() { // This is the initial activation, save the defaults to the db if(!$this->options->exists()) { $this->reset(); } // Only preprocess if this is the currently viewed page if( $this->page->get_slug() == filter_input(INPUT_GET, 'page') ) { $this->preprocess(); } $this->page->register(); $this->set_global_variable(); $this->do_action('afw_options_init'); }
[ "public", "function", "register", "(", ")", "{", "// This is the initial activation, save the defaults to the db", "if", "(", "!", "$", "this", "->", "options", "->", "exists", "(", ")", ")", "{", "$", "this", "->", "reset", "(", ")", ";", "}", "// Only preprocess if this is the currently viewed page", "if", "(", "$", "this", "->", "page", "->", "get_slug", "(", ")", "==", "filter_input", "(", "INPUT_GET", ",", "'page'", ")", ")", "{", "$", "this", "->", "preprocess", "(", ")", ";", "}", "$", "this", "->", "page", "->", "register", "(", ")", ";", "$", "this", "->", "set_global_variable", "(", ")", ";", "$", "this", "->", "do_action", "(", "'afw_options_init'", ")", ";", "}" ]
Register the options page.
[ "Register", "the", "options", "page", "." ]
fe8283e2d6847ef697abec832da7ee741a85058c
https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Extensions/WordPress/Options/OptionsPage.php#L85-L102
18,357
askupasoftware/amarkal
Extensions/WordPress/Options/OptionsPage.php
OptionsPage.create_page
private function create_page() { $self = $this; $page = new \Amarkal\Extensions\WordPress\Admin\AdminPage(array( 'title' => $this->config->sidebar_title, 'icon' => $this->config->sidebar_icon, 'class' => $this->config->sidebar_icon_class, 'style' => $this->config->sidebar_icon_style )); foreach( $this->config->sections as $section ) { $page->add_page(array( 'title' => $section->title, 'capability' => 'manage_options', 'content' => function() use ( $self ) { $self->render(); } )); } return $page; }
php
private function create_page() { $self = $this; $page = new \Amarkal\Extensions\WordPress\Admin\AdminPage(array( 'title' => $this->config->sidebar_title, 'icon' => $this->config->sidebar_icon, 'class' => $this->config->sidebar_icon_class, 'style' => $this->config->sidebar_icon_style )); foreach( $this->config->sections as $section ) { $page->add_page(array( 'title' => $section->title, 'capability' => 'manage_options', 'content' => function() use ( $self ) { $self->render(); } )); } return $page; }
[ "private", "function", "create_page", "(", ")", "{", "$", "self", "=", "$", "this", ";", "$", "page", "=", "new", "\\", "Amarkal", "\\", "Extensions", "\\", "WordPress", "\\", "Admin", "\\", "AdminPage", "(", "array", "(", "'title'", "=>", "$", "this", "->", "config", "->", "sidebar_title", ",", "'icon'", "=>", "$", "this", "->", "config", "->", "sidebar_icon", ",", "'class'", "=>", "$", "this", "->", "config", "->", "sidebar_icon_class", ",", "'style'", "=>", "$", "this", "->", "config", "->", "sidebar_icon_style", ")", ")", ";", "foreach", "(", "$", "this", "->", "config", "->", "sections", "as", "$", "section", ")", "{", "$", "page", "->", "add_page", "(", "array", "(", "'title'", "=>", "$", "section", "->", "title", ",", "'capability'", "=>", "'manage_options'", ",", "'content'", "=>", "function", "(", ")", "use", "(", "$", "self", ")", "{", "$", "self", "->", "render", "(", ")", ";", "}", ")", ")", ";", "}", "return", "$", "page", ";", "}" ]
Create a new AdminPage. @return \Amarkal\Extensions\WordPress\Admin\AdminPage
[ "Create", "a", "new", "AdminPage", "." ]
fe8283e2d6847ef697abec832da7ee741a85058c
https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Extensions/WordPress/Options/OptionsPage.php#L109-L127
18,358
askupasoftware/amarkal
Extensions/WordPress/Options/OptionsPage.php
OptionsPage.render
private function render() { $this->do_action('afw_options_pre_render'); $layout = new Layout\Layout( $this->config ); $layout->render(true); add_filter('admin_footer_text', array( __CLASS__, 'footer_credits' ) ); $this->do_action('afw_options_post_render'); }
php
private function render() { $this->do_action('afw_options_pre_render'); $layout = new Layout\Layout( $this->config ); $layout->render(true); add_filter('admin_footer_text', array( __CLASS__, 'footer_credits' ) ); $this->do_action('afw_options_post_render'); }
[ "private", "function", "render", "(", ")", "{", "$", "this", "->", "do_action", "(", "'afw_options_pre_render'", ")", ";", "$", "layout", "=", "new", "Layout", "\\", "Layout", "(", "$", "this", "->", "config", ")", ";", "$", "layout", "->", "render", "(", "true", ")", ";", "add_filter", "(", "'admin_footer_text'", ",", "array", "(", "__CLASS__", ",", "'footer_credits'", ")", ")", ";", "$", "this", "->", "do_action", "(", "'afw_options_post_render'", ")", ";", "}" ]
Internally used to render the page. Called by AdminPage to generate the admin page's content.
[ "Internally", "used", "to", "render", "the", "page", ".", "Called", "by", "AdminPage", "to", "generate", "the", "admin", "page", "s", "content", "." ]
fe8283e2d6847ef697abec832da7ee741a85058c
https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Extensions/WordPress/Options/OptionsPage.php#L133-L140
18,359
askupasoftware/amarkal
Extensions/WordPress/Options/OptionsPage.php
OptionsPage.preprocess
private function preprocess() { $this->do_action('afw_options_pre_process'); Notifier::reset(); State::set('errors', array()); $this->update(); $this->do_action('afw_options_post_process'); }
php
private function preprocess() { $this->do_action('afw_options_pre_process'); Notifier::reset(); State::set('errors', array()); $this->update(); $this->do_action('afw_options_post_process'); }
[ "private", "function", "preprocess", "(", ")", "{", "$", "this", "->", "do_action", "(", "'afw_options_pre_process'", ")", ";", "Notifier", "::", "reset", "(", ")", ";", "State", "::", "set", "(", "'errors'", ",", "array", "(", ")", ")", ";", "$", "this", "->", "update", "(", ")", ";", "$", "this", "->", "do_action", "(", "'afw_options_post_process'", ")", ";", "}" ]
Internally used to update the options page's components.
[ "Internally", "used", "to", "update", "the", "options", "page", "s", "components", "." ]
fe8283e2d6847ef697abec832da7ee741a85058c
https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Extensions/WordPress/Options/OptionsPage.php#L145-L152
18,360
askupasoftware/amarkal
Extensions/WordPress/Options/OptionsPage.php
OptionsPage.set_errors
private function set_errors( $errors ) { if( count( $errors ) == 0 ) { return; } $errors_array = array(); foreach( $this->config->get_sections() as $section ) { foreach( $section->get_fields() as $component ) { if( $component instanceof \Amarkal\UI\ValidatableComponentInterface && $errors[$component->get_name()] ) { $errors_array[] = array( 'section'=> $section->get_slug(), 'message'=> $errors[$component->get_name()] ); } } } State::set('errors', $errors_array); }
php
private function set_errors( $errors ) { if( count( $errors ) == 0 ) { return; } $errors_array = array(); foreach( $this->config->get_sections() as $section ) { foreach( $section->get_fields() as $component ) { if( $component instanceof \Amarkal\UI\ValidatableComponentInterface && $errors[$component->get_name()] ) { $errors_array[] = array( 'section'=> $section->get_slug(), 'message'=> $errors[$component->get_name()] ); } } } State::set('errors', $errors_array); }
[ "private", "function", "set_errors", "(", "$", "errors", ")", "{", "if", "(", "count", "(", "$", "errors", ")", "==", "0", ")", "{", "return", ";", "}", "$", "errors_array", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "config", "->", "get_sections", "(", ")", "as", "$", "section", ")", "{", "foreach", "(", "$", "section", "->", "get_fields", "(", ")", "as", "$", "component", ")", "{", "if", "(", "$", "component", "instanceof", "\\", "Amarkal", "\\", "UI", "\\", "ValidatableComponentInterface", "&&", "$", "errors", "[", "$", "component", "->", "get_name", "(", ")", "]", ")", "{", "$", "errors_array", "[", "]", "=", "array", "(", "'section'", "=>", "$", "section", "->", "get_slug", "(", ")", ",", "'message'", "=>", "$", "errors", "[", "$", "component", "->", "get_name", "(", ")", "]", ")", ";", "}", "}", "}", "State", "::", "set", "(", "'errors'", ",", "$", "errors_array", ")", ";", "}" ]
Set the state with the given errors. @param array $errors
[ "Set", "the", "state", "with", "the", "given", "errors", "." ]
fe8283e2d6847ef697abec832da7ee741a85058c
https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Extensions/WordPress/Options/OptionsPage.php#L188-L210
18,361
askupasoftware/amarkal
Extensions/WordPress/Options/OptionsPage.php
OptionsPage.set_global_variable
private function set_global_variable() { $var_name = ""; if( null != $this->config->global_variable ) { $var_name = $this->config->global_variable; } else { $var_name = $this->page->get_slug().'_options'; } $GLOBALS[$var_name] = $this->options->get(); }
php
private function set_global_variable() { $var_name = ""; if( null != $this->config->global_variable ) { $var_name = $this->config->global_variable; } else { $var_name = $this->page->get_slug().'_options'; } $GLOBALS[$var_name] = $this->options->get(); }
[ "private", "function", "set_global_variable", "(", ")", "{", "$", "var_name", "=", "\"\"", ";", "if", "(", "null", "!=", "$", "this", "->", "config", "->", "global_variable", ")", "{", "$", "var_name", "=", "$", "this", "->", "config", "->", "global_variable", ";", "}", "else", "{", "$", "var_name", "=", "$", "this", "->", "page", "->", "get_slug", "(", ")", ".", "'_options'", ";", "}", "$", "GLOBALS", "[", "$", "var_name", "]", "=", "$", "this", "->", "options", "->", "get", "(", ")", ";", "}" ]
Set a global variable containing the option values to be used throughout the program.
[ "Set", "a", "global", "variable", "containing", "the", "option", "values", "to", "be", "used", "throughout", "the", "program", "." ]
fe8283e2d6847ef697abec832da7ee741a85058c
https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Extensions/WordPress/Options/OptionsPage.php#L255-L269
18,362
titon/db
src/Titon/Db/Behavior/FilterBehavior.php
FilterBehavior.filter
public function filter($field, $filter, array $options = []) { if (!in_array($filter, [self::HTML, self::NEWLINES, self::WHITESPACE, self::XSS])) { throw new InvalidArgumentException(sprintf('Filter %s does not exist', $filter)); } $this->_filters[$field][$filter] = $options; return $this; }
php
public function filter($field, $filter, array $options = []) { if (!in_array($filter, [self::HTML, self::NEWLINES, self::WHITESPACE, self::XSS])) { throw new InvalidArgumentException(sprintf('Filter %s does not exist', $filter)); } $this->_filters[$field][$filter] = $options; return $this; }
[ "public", "function", "filter", "(", "$", "field", ",", "$", "filter", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "in_array", "(", "$", "filter", ",", "[", "self", "::", "HTML", ",", "self", "::", "NEWLINES", ",", "self", "::", "WHITESPACE", ",", "self", "::", "XSS", "]", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", "(", "'Filter %s does not exist'", ",", "$", "filter", ")", ")", ";", "}", "$", "this", "->", "_filters", "[", "$", "field", "]", "[", "$", "filter", "]", "=", "$", "options", ";", "return", "$", "this", ";", "}" ]
Define a filter for a specific field. @param string $field @param string $filter @param array $options @return $this @throws \Titon\Db\Exception\InvalidArgumentException
[ "Define", "a", "filter", "for", "a", "specific", "field", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/FilterBehavior.php#L44-L52
18,363
tbreuss/pvc
src/Config.php
Config.get
public function get(string $name, $default = null) { $path = explode('.', $name); $current = $this->data; foreach ($path as $field) { if (isset($current) && isset($current[$field])) { $current = $current[$field]; } elseif (is_array($current) && isset($current[$field])) { $current = $current[$field]; } else { return $default; } } return $current; }
php
public function get(string $name, $default = null) { $path = explode('.', $name); $current = $this->data; foreach ($path as $field) { if (isset($current) && isset($current[$field])) { $current = $current[$field]; } elseif (is_array($current) && isset($current[$field])) { $current = $current[$field]; } else { return $default; } } return $current; }
[ "public", "function", "get", "(", "string", "$", "name", ",", "$", "default", "=", "null", ")", "{", "$", "path", "=", "explode", "(", "'.'", ",", "$", "name", ")", ";", "$", "current", "=", "$", "this", "->", "data", ";", "foreach", "(", "$", "path", "as", "$", "field", ")", "{", "if", "(", "isset", "(", "$", "current", ")", "&&", "isset", "(", "$", "current", "[", "$", "field", "]", ")", ")", "{", "$", "current", "=", "$", "current", "[", "$", "field", "]", ";", "}", "elseif", "(", "is_array", "(", "$", "current", ")", "&&", "isset", "(", "$", "current", "[", "$", "field", "]", ")", ")", "{", "$", "current", "=", "$", "current", "[", "$", "field", "]", ";", "}", "else", "{", "return", "$", "default", ";", "}", "}", "return", "$", "current", ";", "}" ]
Get value by using dot notation for nested arrays. @example $value = $this->get('foo.bar.baz'); @param string $name @param mixed $default @return mixed
[ "Get", "value", "by", "using", "dot", "notation", "for", "nested", "arrays", "." ]
ae100351010a8c9f645ccb918f70a26e167de7a7
https://github.com/tbreuss/pvc/blob/ae100351010a8c9f645ccb918f70a26e167de7a7/src/Config.php#L32-L46
18,364
arsengoian/viper-framework
src/Viper/Core/Routing/Router.php
Router.registerCustomRouteClass
public static function registerCustomRouteClass(string $routeKey, string $routeClass) { self::checkRegisterAvailability(); if (!class_exists($routeClass)) throw new AppLogicException('Class '.$routeClass.' does not exist'); self::$customRouteClasses[$routeKey] = $routeClass; }
php
public static function registerCustomRouteClass(string $routeKey, string $routeClass) { self::checkRegisterAvailability(); if (!class_exists($routeClass)) throw new AppLogicException('Class '.$routeClass.' does not exist'); self::$customRouteClasses[$routeKey] = $routeClass; }
[ "public", "static", "function", "registerCustomRouteClass", "(", "string", "$", "routeKey", ",", "string", "$", "routeClass", ")", "{", "self", "::", "checkRegisterAvailability", "(", ")", ";", "if", "(", "!", "class_exists", "(", "$", "routeClass", ")", ")", "throw", "new", "AppLogicException", "(", "'Class '", ".", "$", "routeClass", ".", "' does not exist'", ")", ";", "self", "::", "$", "customRouteClasses", "[", "$", "routeKey", "]", "=", "$", "routeClass", ";", "}" ]
Can't set custom actions. Only parsable from URL
[ "Can", "t", "set", "custom", "actions", ".", "Only", "parsable", "from", "URL" ]
22796c5cc219cae3ca0b4af370a347ba2acab0f2
https://github.com/arsengoian/viper-framework/blob/22796c5cc219cae3ca0b4af370a347ba2acab0f2/src/Viper/Core/Routing/Router.php#L59-L64
18,365
EvanDotPro/EdpGithub
src/EdpGithub/Http/Client.php
Client.getHttpClient
public function getHttpClient($path) { $this->httpClient = new Http\Client(); $this->httpClient->setAdapter($this->getHttpAdapter()); $this->httpClient->setUri($this->options['base_url'] . $path); return $this->httpClient; }
php
public function getHttpClient($path) { $this->httpClient = new Http\Client(); $this->httpClient->setAdapter($this->getHttpAdapter()); $this->httpClient->setUri($this->options['base_url'] . $path); return $this->httpClient; }
[ "public", "function", "getHttpClient", "(", "$", "path", ")", "{", "$", "this", "->", "httpClient", "=", "new", "Http", "\\", "Client", "(", ")", ";", "$", "this", "->", "httpClient", "->", "setAdapter", "(", "$", "this", "->", "getHttpAdapter", "(", ")", ")", ";", "$", "this", "->", "httpClient", "->", "setUri", "(", "$", "this", "->", "options", "[", "'base_url'", "]", ".", "$", "path", ")", ";", "return", "$", "this", "->", "httpClient", ";", "}" ]
Get Http Client @param string $path @return Http\Client
[ "Get", "Http", "Client" ]
51f3e33e02edbef011103e3c2c1629d46af011a3
https://github.com/EvanDotPro/EdpGithub/blob/51f3e33e02edbef011103e3c2c1629d46af011a3/src/EdpGithub/Http/Client.php#L151-L158
18,366
EvanDotPro/EdpGithub
src/EdpGithub/Http/Client.php
Client.getHttpAdapter
public function getHttpAdapter() { if (null === $this->httpAdapter) { $this->httpAdapter = new Http\Client\Adapter\Curl(); $this->httpAdapter->setOptions(array( 'curloptions' => array( CURLOPT_SSL_VERIFYPEER => false, ), )); } return $this->httpAdapter; }
php
public function getHttpAdapter() { if (null === $this->httpAdapter) { $this->httpAdapter = new Http\Client\Adapter\Curl(); $this->httpAdapter->setOptions(array( 'curloptions' => array( CURLOPT_SSL_VERIFYPEER => false, ), )); } return $this->httpAdapter; }
[ "public", "function", "getHttpAdapter", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "httpAdapter", ")", "{", "$", "this", "->", "httpAdapter", "=", "new", "Http", "\\", "Client", "\\", "Adapter", "\\", "Curl", "(", ")", ";", "$", "this", "->", "httpAdapter", "->", "setOptions", "(", "array", "(", "'curloptions'", "=>", "array", "(", "CURLOPT_SSL_VERIFYPEER", "=>", "false", ",", ")", ",", ")", ")", ";", "}", "return", "$", "this", "->", "httpAdapter", ";", "}" ]
Get Http Adapter @return Http\Client\Adapter\Curl
[ "Get", "Http", "Adapter" ]
51f3e33e02edbef011103e3c2c1629d46af011a3
https://github.com/EvanDotPro/EdpGithub/blob/51f3e33e02edbef011103e3c2c1629d46af011a3/src/EdpGithub/Http/Client.php#L164-L176
18,367
netgen/ngopengraph
classes/ngopengraphbase.php
ngOpenGraphBase.getInstance
static function getInstance( eZContentObjectAttribute $objectAttribute ) { $datatypeString = $objectAttribute->attribute( 'data_type_string' ); $dataTypeHandlers = self::$ogIni->variable( 'OpenGraph', 'DataTypeHandlers' ); if ( array_key_exists( $datatypeString, $dataTypeHandlers ) ) { if ( class_exists( $dataTypeHandlers[$datatypeString] ) ) { return new $dataTypeHandlers[$datatypeString]( $objectAttribute ); } } return new ngOpenGraphBase( $objectAttribute ); }
php
static function getInstance( eZContentObjectAttribute $objectAttribute ) { $datatypeString = $objectAttribute->attribute( 'data_type_string' ); $dataTypeHandlers = self::$ogIni->variable( 'OpenGraph', 'DataTypeHandlers' ); if ( array_key_exists( $datatypeString, $dataTypeHandlers ) ) { if ( class_exists( $dataTypeHandlers[$datatypeString] ) ) { return new $dataTypeHandlers[$datatypeString]( $objectAttribute ); } } return new ngOpenGraphBase( $objectAttribute ); }
[ "static", "function", "getInstance", "(", "eZContentObjectAttribute", "$", "objectAttribute", ")", "{", "$", "datatypeString", "=", "$", "objectAttribute", "->", "attribute", "(", "'data_type_string'", ")", ";", "$", "dataTypeHandlers", "=", "self", "::", "$", "ogIni", "->", "variable", "(", "'OpenGraph'", ",", "'DataTypeHandlers'", ")", ";", "if", "(", "array_key_exists", "(", "$", "datatypeString", ",", "$", "dataTypeHandlers", ")", ")", "{", "if", "(", "class_exists", "(", "$", "dataTypeHandlers", "[", "$", "datatypeString", "]", ")", ")", "{", "return", "new", "$", "dataTypeHandlers", "[", "$", "datatypeString", "]", "(", "$", "objectAttribute", ")", ";", "}", "}", "return", "new", "ngOpenGraphBase", "(", "$", "objectAttribute", ")", ";", "}" ]
Gets the instance of Open Graph attribute handler for the attribute @param eZContentObjectAttribute $objectAttribute @return ngOpenGraphBase
[ "Gets", "the", "instance", "of", "Open", "Graph", "attribute", "handler", "for", "the", "attribute" ]
68a99862f240ee74174ea9b888a9a33743142e27
https://github.com/netgen/ngopengraph/blob/68a99862f240ee74174ea9b888a9a33743142e27/classes/ngopengraphbase.php#L22-L36
18,368
rayrutjes/domain-foundation
src/Domain/AggregateRoot/EventSourcedAggregateRoot.php
EventSourcedAggregateRoot.commitChanges
final public function commitChanges() { if (null !== $this->changes) { $this->lastCommittedEventSequenceNumber = $this->changes->lastSequenceNumber(); $this->changes->commit(); } }
php
final public function commitChanges() { if (null !== $this->changes) { $this->lastCommittedEventSequenceNumber = $this->changes->lastSequenceNumber(); $this->changes->commit(); } }
[ "final", "public", "function", "commitChanges", "(", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "changes", ")", "{", "$", "this", "->", "lastCommittedEventSequenceNumber", "=", "$", "this", "->", "changes", "->", "lastSequenceNumber", "(", ")", ";", "$", "this", "->", "changes", "->", "commit", "(", ")", ";", "}", "}" ]
Clears all recorded events.
[ "Clears", "all", "recorded", "events", "." ]
2bce7cd6a6612f718e70e3176589c1abf39d1a3e
https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/Domain/AggregateRoot/EventSourcedAggregateRoot.php#L78-L84
18,369
rayrutjes/domain-foundation
src/Domain/AggregateRoot/EventSourcedAggregateRoot.php
EventSourcedAggregateRoot.applyChange
final protected function applyChange(Serializable $payload) { $this->apply($payload); $this->changes()->addEventFromPayload($payload); }
php
final protected function applyChange(Serializable $payload) { $this->apply($payload); $this->changes()->addEventFromPayload($payload); }
[ "final", "protected", "function", "applyChange", "(", "Serializable", "$", "payload", ")", "{", "$", "this", "->", "apply", "(", "$", "payload", ")", ";", "$", "this", "->", "changes", "(", ")", "->", "addEventFromPayload", "(", "$", "payload", ")", ";", "}" ]
Mutate the state of the aggregate by applying a domain event. Keep track of the change until it has been successfully committed. @param Serializable $payload
[ "Mutate", "the", "state", "of", "the", "aggregate", "by", "applying", "a", "domain", "event", ".", "Keep", "track", "of", "the", "change", "until", "it", "has", "been", "successfully", "committed", "." ]
2bce7cd6a6612f718e70e3176589c1abf39d1a3e
https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/Domain/AggregateRoot/EventSourcedAggregateRoot.php#L92-L96
18,370
rayrutjes/domain-foundation
src/Domain/AggregateRoot/EventSourcedAggregateRoot.php
EventSourcedAggregateRoot.replayChange
final private function replayChange(Event $event) { $this->apply($event->payload()); $this->lastCommittedEventSequenceNumber = $event->sequenceNumber(); }
php
final private function replayChange(Event $event) { $this->apply($event->payload()); $this->lastCommittedEventSequenceNumber = $event->sequenceNumber(); }
[ "final", "private", "function", "replayChange", "(", "Event", "$", "event", ")", "{", "$", "this", "->", "apply", "(", "$", "event", "->", "payload", "(", ")", ")", ";", "$", "this", "->", "lastCommittedEventSequenceNumber", "=", "$", "event", "->", "sequenceNumber", "(", ")", ";", "}" ]
Mutate the state of the aggregate by applying the domain event contained into the message. Synchronize the aggregate version with the one provided by the message. @param Event $event
[ "Mutate", "the", "state", "of", "the", "aggregate", "by", "applying", "the", "domain", "event", "contained", "into", "the", "message", ".", "Synchronize", "the", "aggregate", "version", "with", "the", "one", "provided", "by", "the", "message", "." ]
2bce7cd6a6612f718e70e3176589c1abf39d1a3e
https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/Domain/AggregateRoot/EventSourcedAggregateRoot.php#L104-L108
18,371
rayrutjes/domain-foundation
src/Domain/AggregateRoot/EventSourcedAggregateRoot.php
EventSourcedAggregateRoot.apply
final private function apply(Serializable $payload) { $method = $this->applyMethod($payload); $this->$method($payload); }
php
final private function apply(Serializable $payload) { $method = $this->applyMethod($payload); $this->$method($payload); }
[ "final", "private", "function", "apply", "(", "Serializable", "$", "payload", ")", "{", "$", "method", "=", "$", "this", "->", "applyMethod", "(", "$", "payload", ")", ";", "$", "this", "->", "$", "method", "(", "$", "payload", ")", ";", "}" ]
Mutate the state of the aggregate by applying a domain event. @param Serializable $payload
[ "Mutate", "the", "state", "of", "the", "aggregate", "by", "applying", "a", "domain", "event", "." ]
2bce7cd6a6612f718e70e3176589c1abf39d1a3e
https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/Domain/AggregateRoot/EventSourcedAggregateRoot.php#L115-L119
18,372
rayrutjes/domain-foundation
src/Domain/AggregateRoot/EventSourcedAggregateRoot.php
EventSourcedAggregateRoot.applyMethod
protected function applyMethod(Serializable $payload) { $className = get_class($payload); return 'apply'.substr($className, strrpos($className, '\\') + 1); }
php
protected function applyMethod(Serializable $payload) { $className = get_class($payload); return 'apply'.substr($className, strrpos($className, '\\') + 1); }
[ "protected", "function", "applyMethod", "(", "Serializable", "$", "payload", ")", "{", "$", "className", "=", "get_class", "(", "$", "payload", ")", ";", "return", "'apply'", ".", "substr", "(", "$", "className", ",", "strrpos", "(", "$", "className", ",", "'\\\\'", ")", "+", "1", ")", ";", "}" ]
Returns method to call for applying a given domain event to the aggregate. This can be overridden to suit your custom naming convention. @param Serializable $payload @return string
[ "Returns", "method", "to", "call", "for", "applying", "a", "given", "domain", "event", "to", "the", "aggregate", ".", "This", "can", "be", "overridden", "to", "suit", "your", "custom", "naming", "convention", "." ]
2bce7cd6a6612f718e70e3176589c1abf39d1a3e
https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/Domain/AggregateRoot/EventSourcedAggregateRoot.php#L129-L134
18,373
rayrutjes/domain-foundation
src/Domain/AggregateRoot/EventSourcedAggregateRoot.php
EventSourcedAggregateRoot.changes
final private function changes() { if (null === $this->changes) { $lastCommittedEventSequenceNumber = $this->lastCommittedEventSequenceNumber(); $this->changes = new DefaultEventContainer($this->identifier(), $lastCommittedEventSequenceNumber); } return $this->changes; }
php
final private function changes() { if (null === $this->changes) { $lastCommittedEventSequenceNumber = $this->lastCommittedEventSequenceNumber(); $this->changes = new DefaultEventContainer($this->identifier(), $lastCommittedEventSequenceNumber); } return $this->changes; }
[ "final", "private", "function", "changes", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "changes", ")", "{", "$", "lastCommittedEventSequenceNumber", "=", "$", "this", "->", "lastCommittedEventSequenceNumber", "(", ")", ";", "$", "this", "->", "changes", "=", "new", "DefaultEventContainer", "(", "$", "this", "->", "identifier", "(", ")", ",", "$", "lastCommittedEventSequenceNumber", ")", ";", "}", "return", "$", "this", "->", "changes", ";", "}" ]
Return the event container containing the uncommitted changes. If there are no pending changes to be committed, a new event container will be initialized. @return EventContainer
[ "Return", "the", "event", "container", "containing", "the", "uncommitted", "changes", ".", "If", "there", "are", "no", "pending", "changes", "to", "be", "committed", "a", "new", "event", "container", "will", "be", "initialized", "." ]
2bce7cd6a6612f718e70e3176589c1abf39d1a3e
https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/Domain/AggregateRoot/EventSourcedAggregateRoot.php#L143-L152
18,374
rayrutjes/domain-foundation
src/Domain/AggregateRoot/EventSourcedAggregateRoot.php
EventSourcedAggregateRoot.loadFromHistory
final public static function loadFromHistory(EventStream $eventStream) { $aggregate = new static(); while ($eventStream->hasNext()) { $aggregate->replayChange($eventStream->next()); } return $aggregate; }
php
final public static function loadFromHistory(EventStream $eventStream) { $aggregate = new static(); while ($eventStream->hasNext()) { $aggregate->replayChange($eventStream->next()); } return $aggregate; }
[ "final", "public", "static", "function", "loadFromHistory", "(", "EventStream", "$", "eventStream", ")", "{", "$", "aggregate", "=", "new", "static", "(", ")", ";", "while", "(", "$", "eventStream", "->", "hasNext", "(", ")", ")", "{", "$", "aggregate", "->", "replayChange", "(", "$", "eventStream", "->", "next", "(", ")", ")", ";", "}", "return", "$", "aggregate", ";", "}" ]
Roll-out all events to reconstitute the state of the aggregate. @param EventStream $eventStream @return static
[ "Roll", "-", "out", "all", "events", "to", "reconstitute", "the", "state", "of", "the", "aggregate", "." ]
2bce7cd6a6612f718e70e3176589c1abf39d1a3e
https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/Domain/AggregateRoot/EventSourcedAggregateRoot.php#L161-L170
18,375
webforge-labs/psc-cms
lib/Psc/Doctrine/EntityRelation.php
EntityRelation.setRelationType
public function setRelationType($type, $direction = 'bidirectional', $whoIsOwningSide = 'source') { // zuerst setzen wir die direction, denn wenn type nicht gesetzt ist, macht die nichts $this->setDirection($direction); // dann setzen wir den type, dies setzt dann bei one to many und many to one die inverse side und owning side schon korrekt // weil ja direction schon unidirectional oder bidirectional ist $this->setType($type); // fails silently bei oneToMany and ManyToOne (oder halt mal nicht, falls sich das ändert) if (isset($whoIsOwningSide)) $this->setOwningSide($whoIsOwningSide); return $this; }
php
public function setRelationType($type, $direction = 'bidirectional', $whoIsOwningSide = 'source') { // zuerst setzen wir die direction, denn wenn type nicht gesetzt ist, macht die nichts $this->setDirection($direction); // dann setzen wir den type, dies setzt dann bei one to many und many to one die inverse side und owning side schon korrekt // weil ja direction schon unidirectional oder bidirectional ist $this->setType($type); // fails silently bei oneToMany and ManyToOne (oder halt mal nicht, falls sich das ändert) if (isset($whoIsOwningSide)) $this->setOwningSide($whoIsOwningSide); return $this; }
[ "public", "function", "setRelationType", "(", "$", "type", ",", "$", "direction", "=", "'bidirectional'", ",", "$", "whoIsOwningSide", "=", "'source'", ")", "{", "// zuerst setzen wir die direction, denn wenn type nicht gesetzt ist, macht die nichts", "$", "this", "->", "setDirection", "(", "$", "direction", ")", ";", "// dann setzen wir den type, dies setzt dann bei one to many und many to one die inverse side und owning side schon korrekt", "// weil ja direction schon unidirectional oder bidirectional ist", "$", "this", "->", "setType", "(", "$", "type", ")", ";", "// fails silently bei oneToMany and ManyToOne (oder halt mal nicht, falls sich das ändert)", "if", "(", "isset", "(", "$", "whoIsOwningSide", ")", ")", "$", "this", "->", "setOwningSide", "(", "$", "whoIsOwningSide", ")", ";", "return", "$", "this", ";", "}" ]
Setzt alle Eigenschaften der Relation gleichzeitig $whoIsOwningSide wird bei MANY_TO_ONE und ONE_TO_MANY ignoriert (denn dort ist es immer automatisch die MANY Seite) ist $direction nicht bidirectional wird die inverse side der Relation nicht automatisch gesetzt
[ "Setzt", "alle", "Eigenschaften", "der", "Relation", "gleichzeitig" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/EntityRelation.php#L193-L207
18,376
webforge-labs/psc-cms
lib/Psc/Doctrine/EntityRelation.php
EntityRelation.setJoinColumnNullable
public function setJoinColumnNullable($bool) { $this->nullable = $bool; $this->getJoinColumn()->setNullable($bool); return $this; }
php
public function setJoinColumnNullable($bool) { $this->nullable = $bool; $this->getJoinColumn()->setNullable($bool); return $this; }
[ "public", "function", "setJoinColumnNullable", "(", "$", "bool", ")", "{", "$", "this", "->", "nullable", "=", "$", "bool", ";", "$", "this", "->", "getJoinColumn", "(", ")", "->", "setNullable", "(", "$", "bool", ")", ";", "return", "$", "this", ";", "}" ]
Achtung dies erzeugt die JoinColumn und sollte nur benutzt werdne, wenn die Relation schon korrekt gesetzt ist
[ "Achtung", "dies", "erzeugt", "die", "JoinColumn", "und", "sollte", "nur", "benutzt", "werdne", "wenn", "die", "Relation", "schon", "korrekt", "gesetzt", "ist" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/EntityRelation.php#L536-L540
18,377
ipunkt/laravel-package-manager
src/Providers/Traits/PackagePath.php
PackagePath.packagePath
private function packagePath(string $relativePath): string { $packagePath = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $this->packagePath), DIRECTORY_SEPARATOR); $relativePath = ltrim(str_replace('/', DIRECTORY_SEPARATOR, $relativePath), DIRECTORY_SEPARATOR); return realpath($packagePath . DIRECTORY_SEPARATOR . $relativePath); }
php
private function packagePath(string $relativePath): string { $packagePath = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $this->packagePath), DIRECTORY_SEPARATOR); $relativePath = ltrim(str_replace('/', DIRECTORY_SEPARATOR, $relativePath), DIRECTORY_SEPARATOR); return realpath($packagePath . DIRECTORY_SEPARATOR . $relativePath); }
[ "private", "function", "packagePath", "(", "string", "$", "relativePath", ")", ":", "string", "{", "$", "packagePath", "=", "rtrim", "(", "str_replace", "(", "'/'", ",", "DIRECTORY_SEPARATOR", ",", "$", "this", "->", "packagePath", ")", ",", "DIRECTORY_SEPARATOR", ")", ";", "$", "relativePath", "=", "ltrim", "(", "str_replace", "(", "'/'", ",", "DIRECTORY_SEPARATOR", ",", "$", "relativePath", ")", ",", "DIRECTORY_SEPARATOR", ")", ";", "return", "realpath", "(", "$", "packagePath", ".", "DIRECTORY_SEPARATOR", ".", "$", "relativePath", ")", ";", "}" ]
give relative path from package root and return absolute path @param string $relativePath @return string
[ "give", "relative", "path", "from", "package", "root", "and", "return", "absolute", "path" ]
6ecfc9d933c37927e52c441d5019126be69e5817
https://github.com/ipunkt/laravel-package-manager/blob/6ecfc9d933c37927e52c441d5019126be69e5817/src/Providers/Traits/PackagePath.php#L22-L28
18,378
silverbusters/silverstripe-simplelistfield
model/fieldtypes/SimpleListFieldDB.php
SimpleListFieldDB.getList
public function getList(){ // define an unique key $key = $this->name.'_'.md5($this->value); if( isset(self::$listobj[$key]) ){ return self::$listobj[$key]; } if($this->value){ self::$listobj[$key] = json_decode($this->value); } else{ self::$listobj[$key] = false; } return self::$listobj[$key]; }
php
public function getList(){ // define an unique key $key = $this->name.'_'.md5($this->value); if( isset(self::$listobj[$key]) ){ return self::$listobj[$key]; } if($this->value){ self::$listobj[$key] = json_decode($this->value); } else{ self::$listobj[$key] = false; } return self::$listobj[$key]; }
[ "public", "function", "getList", "(", ")", "{", "// define an unique key", "$", "key", "=", "$", "this", "->", "name", ".", "'_'", ".", "md5", "(", "$", "this", "->", "value", ")", ";", "if", "(", "isset", "(", "self", "::", "$", "listobj", "[", "$", "key", "]", ")", ")", "{", "return", "self", "::", "$", "listobj", "[", "$", "key", "]", ";", "}", "if", "(", "$", "this", "->", "value", ")", "{", "self", "::", "$", "listobj", "[", "$", "key", "]", "=", "json_decode", "(", "$", "this", "->", "value", ")", ";", "}", "else", "{", "self", "::", "$", "listobj", "[", "$", "key", "]", "=", "false", ";", "}", "return", "self", "::", "$", "listobj", "[", "$", "key", "]", ";", "}" ]
Get the list
[ "Get", "the", "list" ]
c883e13b1b877d74e266edf2a646661039803440
https://github.com/silverbusters/silverstripe-simplelistfield/blob/c883e13b1b877d74e266edf2a646661039803440/model/fieldtypes/SimpleListFieldDB.php#L20-L36
18,379
silverbusters/silverstripe-simplelistfield
model/fieldtypes/SimpleListFieldDB.php
SimpleListFieldDB.getHeading
public function getHeading(){ $list = $this->getList(); if( isset($list->heading) && $list->heading ){ return Convert::html2raw($list->heading); } return null; }
php
public function getHeading(){ $list = $this->getList(); if( isset($list->heading) && $list->heading ){ return Convert::html2raw($list->heading); } return null; }
[ "public", "function", "getHeading", "(", ")", "{", "$", "list", "=", "$", "this", "->", "getList", "(", ")", ";", "if", "(", "isset", "(", "$", "list", "->", "heading", ")", "&&", "$", "list", "->", "heading", ")", "{", "return", "Convert", "::", "html2raw", "(", "$", "list", "->", "heading", ")", ";", "}", "return", "null", ";", "}" ]
Get list heading
[ "Get", "list", "heading" ]
c883e13b1b877d74e266edf2a646661039803440
https://github.com/silverbusters/silverstripe-simplelistfield/blob/c883e13b1b877d74e266edf2a646661039803440/model/fieldtypes/SimpleListFieldDB.php#L59-L67
18,380
silverbusters/silverstripe-simplelistfield
model/fieldtypes/SimpleListFieldDB.php
SimpleListFieldDB.getItems
public function getItems(){ $list = $this->getList(); if( isset($list->items) && !empty($list->items) ) { $arrayList = new ArrayList(); foreach($list->items as $id => $item){ $item->ID = $id; $arrayList->push( new ArrayData($item) ); } return $arrayList; } return false; }
php
public function getItems(){ $list = $this->getList(); if( isset($list->items) && !empty($list->items) ) { $arrayList = new ArrayList(); foreach($list->items as $id => $item){ $item->ID = $id; $arrayList->push( new ArrayData($item) ); } return $arrayList; } return false; }
[ "public", "function", "getItems", "(", ")", "{", "$", "list", "=", "$", "this", "->", "getList", "(", ")", ";", "if", "(", "isset", "(", "$", "list", "->", "items", ")", "&&", "!", "empty", "(", "$", "list", "->", "items", ")", ")", "{", "$", "arrayList", "=", "new", "ArrayList", "(", ")", ";", "foreach", "(", "$", "list", "->", "items", "as", "$", "id", "=>", "$", "item", ")", "{", "$", "item", "->", "ID", "=", "$", "id", ";", "$", "arrayList", "->", "push", "(", "new", "ArrayData", "(", "$", "item", ")", ")", ";", "}", "return", "$", "arrayList", ";", "}", "return", "false", ";", "}" ]
Get list items
[ "Get", "list", "items" ]
c883e13b1b877d74e266edf2a646661039803440
https://github.com/silverbusters/silverstripe-simplelistfield/blob/c883e13b1b877d74e266edf2a646661039803440/model/fieldtypes/SimpleListFieldDB.php#L72-L89
18,381
thiagodp/json
lib/JSON.php
JSON.encode
static function encode( $data, $getterPrefixForObjectMethods = 'get', $ignoreNulls = false ) { $type = gettype( $data ); $isObject = false; switch ( $type ) { case 'string' : return '"' . self::fixString( $data ) . '"'; case 'number' : ; // continue case 'integer' : ; // continue case 'float' : ; // continue case 'double' : return $data; case 'boolean' : return ( $data ) ? 'true' : 'false'; case 'NULL' : return 'null'; case 'object' : { $className = get_class( $data ); if ( array_key_exists( $className, self::$conversions ) && is_callable( self::$conversions[ $className ] ) ) { $function = self::$conversions[ $className ]; $convertedValue = call_user_func( $function, $data ); return self::encode( $convertedValue ); } $data = RTTI::getAttributes( $data, RTTI::anyVisibility(), $getterPrefixForObjectMethods ); $isObject = true; // continue } case 'array' : { $output = array(); foreach ( $data as $key => $value ) { $encodedValue = self::encode( $value, $getterPrefixForObjectMethods ); if ( $ignoreNulls && 'null' === $encodedValue ) { continue; } if ( is_numeric( $key ) ) { $output []= $encodedValue; } else { $encodedKey = self::encode( $key, $getterPrefixForObjectMethods ); $output []= $encodedKey . ': ' . $encodedValue; } } return $isObject ? '{ ' . implode( ', ', $output ) . ' }' : '[ ' . implode( ', ', $output ) . ' ]'; } default: return ''; // Not supported type } }
php
static function encode( $data, $getterPrefixForObjectMethods = 'get', $ignoreNulls = false ) { $type = gettype( $data ); $isObject = false; switch ( $type ) { case 'string' : return '"' . self::fixString( $data ) . '"'; case 'number' : ; // continue case 'integer' : ; // continue case 'float' : ; // continue case 'double' : return $data; case 'boolean' : return ( $data ) ? 'true' : 'false'; case 'NULL' : return 'null'; case 'object' : { $className = get_class( $data ); if ( array_key_exists( $className, self::$conversions ) && is_callable( self::$conversions[ $className ] ) ) { $function = self::$conversions[ $className ]; $convertedValue = call_user_func( $function, $data ); return self::encode( $convertedValue ); } $data = RTTI::getAttributes( $data, RTTI::anyVisibility(), $getterPrefixForObjectMethods ); $isObject = true; // continue } case 'array' : { $output = array(); foreach ( $data as $key => $value ) { $encodedValue = self::encode( $value, $getterPrefixForObjectMethods ); if ( $ignoreNulls && 'null' === $encodedValue ) { continue; } if ( is_numeric( $key ) ) { $output []= $encodedValue; } else { $encodedKey = self::encode( $key, $getterPrefixForObjectMethods ); $output []= $encodedKey . ': ' . $encodedValue; } } return $isObject ? '{ ' . implode( ', ', $output ) . ' }' : '[ ' . implode( ', ', $output ) . ' ]'; } default: return ''; // Not supported type } }
[ "static", "function", "encode", "(", "$", "data", ",", "$", "getterPrefixForObjectMethods", "=", "'get'", ",", "$", "ignoreNulls", "=", "false", ")", "{", "$", "type", "=", "gettype", "(", "$", "data", ")", ";", "$", "isObject", "=", "false", ";", "switch", "(", "$", "type", ")", "{", "case", "'string'", ":", "return", "'\"'", ".", "self", "::", "fixString", "(", "$", "data", ")", ".", "'\"'", ";", "case", "'number'", ":", ";", "// continue", "case", "'integer'", ":", ";", "// continue", "case", "'float'", ":", ";", "// continue\t\t\t", "case", "'double'", ":", "return", "$", "data", ";", "case", "'boolean'", ":", "return", "(", "$", "data", ")", "?", "'true'", ":", "'false'", ";", "case", "'NULL'", ":", "return", "'null'", ";", "case", "'object'", ":", "{", "$", "className", "=", "get_class", "(", "$", "data", ")", ";", "if", "(", "array_key_exists", "(", "$", "className", ",", "self", "::", "$", "conversions", ")", "&&", "is_callable", "(", "self", "::", "$", "conversions", "[", "$", "className", "]", ")", ")", "{", "$", "function", "=", "self", "::", "$", "conversions", "[", "$", "className", "]", ";", "$", "convertedValue", "=", "call_user_func", "(", "$", "function", ",", "$", "data", ")", ";", "return", "self", "::", "encode", "(", "$", "convertedValue", ")", ";", "}", "$", "data", "=", "RTTI", "::", "getAttributes", "(", "$", "data", ",", "RTTI", "::", "anyVisibility", "(", ")", ",", "$", "getterPrefixForObjectMethods", ")", ";", "$", "isObject", "=", "true", ";", "// continue", "}", "case", "'array'", ":", "{", "$", "output", "=", "array", "(", ")", ";", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "encodedValue", "=", "self", "::", "encode", "(", "$", "value", ",", "$", "getterPrefixForObjectMethods", ")", ";", "if", "(", "$", "ignoreNulls", "&&", "'null'", "===", "$", "encodedValue", ")", "{", "continue", ";", "}", "if", "(", "is_numeric", "(", "$", "key", ")", ")", "{", "$", "output", "[", "]", "=", "$", "encodedValue", ";", "}", "else", "{", "$", "encodedKey", "=", "self", "::", "encode", "(", "$", "key", ",", "$", "getterPrefixForObjectMethods", ")", ";", "$", "output", "[", "]", "=", "$", "encodedKey", ".", "': '", ".", "$", "encodedValue", ";", "}", "}", "return", "$", "isObject", "?", "'{ '", ".", "implode", "(", "', '", ",", "$", "output", ")", ".", "' }'", ":", "'[ '", ".", "implode", "(", "', '", ",", "$", "output", ")", ".", "' ]'", ";", "}", "default", ":", "return", "''", ";", "// Not supported type", "}", "}" ]
Encodes a variable into JSON format. @param mixed $data Data to be encoded. @param string $getterPrefixForObjectMethods Prefix used for getter methods. OPTIONAL. Defaults to 'get'. @param bool $ignoreNulls Ignore null values when encoding. OPTIONAL. Defaults to false. @return string
[ "Encodes", "a", "variable", "into", "JSON", "format", "." ]
058e07a47ef28983fceb94f98d7edf08983f08ef
https://github.com/thiagodp/json/blob/058e07a47ef28983fceb94f98d7edf08983f08ef/lib/JSON.php#L64-L106
18,382
thiagodp/json
lib/JSON.php
JSON.decode
static function decode( $json, $convertObjectsToArrays = false, $recursionDepth = 512, // same as PHP default $options = 0 ) { // Just use PHP's decode function return json_decode( $json, $convertObjectsToArrays, $recursionDepth, $options ); }
php
static function decode( $json, $convertObjectsToArrays = false, $recursionDepth = 512, // same as PHP default $options = 0 ) { // Just use PHP's decode function return json_decode( $json, $convertObjectsToArrays, $recursionDepth, $options ); }
[ "static", "function", "decode", "(", "$", "json", ",", "$", "convertObjectsToArrays", "=", "false", ",", "$", "recursionDepth", "=", "512", ",", "// same as PHP default", "$", "options", "=", "0", ")", "{", "// Just use PHP's decode function", "return", "json_decode", "(", "$", "json", ",", "$", "convertObjectsToArrays", ",", "$", "recursionDepth", ",", "$", "options", ")", ";", "}" ]
Decodes a JSON content into an object or an array. @see http://php.net/manual/en/function.json-decode.php @param string $json The JSON content. @param bool $convertObjectsToArrays When true, converts objects to arrays. @param int $recursionDepth Recursion depth. @param int $options Bit mask of JSON options. Currently supports only JSON_BIGINT_AS_STRING. Default is to cast large integers as floats. @return object | array | bool | null NULL is returned if the JSON cannot be decoded or if the encoded data is deeper than the recursion limit.
[ "Decodes", "a", "JSON", "content", "into", "an", "object", "or", "an", "array", "." ]
058e07a47ef28983fceb94f98d7edf08983f08ef
https://github.com/thiagodp/json/blob/058e07a47ef28983fceb94f98d7edf08983f08ef/lib/JSON.php#L125-L133
18,383
yuncms/framework
src/authclient/WeChat.php
WeChat.refreshAccessToken
public function refreshAccessToken(OAuthToken $token) { $params = [ 'grant_type' => 'refresh_token' ]; $params = array_merge($token->getParams(), $params); $request = $this->createRequest() ->setMethod('POST') ->setUrl($this->refreshTokenUrl) ->setData($params); $this->applyClientCredentialsToRequest($request); $response = $this->sendRequest($request); $token = $this->createToken(['params' => $response]); $this->setAccessToken($token); return $token; }
php
public function refreshAccessToken(OAuthToken $token) { $params = [ 'grant_type' => 'refresh_token' ]; $params = array_merge($token->getParams(), $params); $request = $this->createRequest() ->setMethod('POST') ->setUrl($this->refreshTokenUrl) ->setData($params); $this->applyClientCredentialsToRequest($request); $response = $this->sendRequest($request); $token = $this->createToken(['params' => $response]); $this->setAccessToken($token); return $token; }
[ "public", "function", "refreshAccessToken", "(", "OAuthToken", "$", "token", ")", "{", "$", "params", "=", "[", "'grant_type'", "=>", "'refresh_token'", "]", ";", "$", "params", "=", "array_merge", "(", "$", "token", "->", "getParams", "(", ")", ",", "$", "params", ")", ";", "$", "request", "=", "$", "this", "->", "createRequest", "(", ")", "->", "setMethod", "(", "'POST'", ")", "->", "setUrl", "(", "$", "this", "->", "refreshTokenUrl", ")", "->", "setData", "(", "$", "params", ")", ";", "$", "this", "->", "applyClientCredentialsToRequest", "(", "$", "request", ")", ";", "$", "response", "=", "$", "this", "->", "sendRequest", "(", "$", "request", ")", ";", "$", "token", "=", "$", "this", "->", "createToken", "(", "[", "'params'", "=>", "$", "response", "]", ")", ";", "$", "this", "->", "setAccessToken", "(", "$", "token", ")", ";", "return", "$", "token", ";", "}" ]
Gets new auth token to replace expired one. @param OAuthToken $token expired auth token. @return OAuthToken new auth token. @throws \yii\authclient\InvalidResponseException
[ "Gets", "new", "auth", "token", "to", "replace", "expired", "one", "." ]
af42e28ea4ae15ab8eead3f6d119f93863b94154
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/authclient/WeChat.php#L144-L164
18,384
nooku/nooku-installer
src/Nooku/Composer/Installer/JoomlaExtension.php
JoomlaExtension._initialize
protected function _initialize() { $config = $this->_config->get('joomla'); if(is_null($config) || !is_array($config)) { $config = array(); } $defaults = array( 'name' => 'root', 'username' => 'root', 'groups' => array(8), 'email' => '[email protected]' ); $this->_credentials = array_merge($defaults, $config); $this->_bootstrap(); $this->_loadFramework(); }
php
protected function _initialize() { $config = $this->_config->get('joomla'); if(is_null($config) || !is_array($config)) { $config = array(); } $defaults = array( 'name' => 'root', 'username' => 'root', 'groups' => array(8), 'email' => '[email protected]' ); $this->_credentials = array_merge($defaults, $config); $this->_bootstrap(); $this->_loadFramework(); }
[ "protected", "function", "_initialize", "(", ")", "{", "$", "config", "=", "$", "this", "->", "_config", "->", "get", "(", "'joomla'", ")", ";", "if", "(", "is_null", "(", "$", "config", ")", "||", "!", "is_array", "(", "$", "config", ")", ")", "{", "$", "config", "=", "array", "(", ")", ";", "}", "$", "defaults", "=", "array", "(", "'name'", "=>", "'root'", ",", "'username'", "=>", "'root'", ",", "'groups'", "=>", "array", "(", "8", ")", ",", "'email'", "=>", "'[email protected]'", ")", ";", "$", "this", "->", "_credentials", "=", "array_merge", "(", "$", "defaults", ",", "$", "config", ")", ";", "$", "this", "->", "_bootstrap", "(", ")", ";", "$", "this", "->", "_loadFramework", "(", ")", ";", "}" ]
Initializes extension installer. @return void
[ "Initializes", "extension", "installer", "." ]
2aa82ed08983bccd51905426cfff4980ba960d89
https://github.com/nooku/nooku-installer/blob/2aa82ed08983bccd51905426cfff4980ba960d89/src/Nooku/Composer/Installer/JoomlaExtension.php#L60-L79
18,385
nooku/nooku-installer
src/Nooku/Composer/Installer/JoomlaExtension.php
JoomlaExtension._getElementFromManifest
protected function _getElementFromManifest($manifest, $manifestPath) { $element = ''; $type = (string) $manifest->attributes()->type; switch($type) { case 'component': $name = strtolower((string) $manifest->name); $element = preg_replace('/[^A-Z0-9_\.-]/i', '', $name); if (substr($element, 0, 4) != 'com_') { $element = 'com_'.$element; } break; case 'module': case 'plugin': if(count($manifest->files->children())) { foreach($manifest->files->children() as $file) { if ((string) $file->attributes()->$type) { $element = (string) $file->attributes()->$type; break; } } } break; case 'file': case 'library': $element = substr($manifestPath, 0, -strlen('.xml')); break; case 'package': $element = preg_replace('/[^A-Z0-9_\.-]/i', '', $manifest->packagename); if (substr($element, 0, 4) != 'pkg_') { $element = 'pkg_'.$element; } break; case 'language': $element = $manifest->get('tag'); break; case 'template': $name = preg_replace('/[^A-Z0-9_ \.-]/i', '', $manifest->name); $element = strtolower(str_replace(' ', '_', $name)); break; default: break; } return $element; }
php
protected function _getElementFromManifest($manifest, $manifestPath) { $element = ''; $type = (string) $manifest->attributes()->type; switch($type) { case 'component': $name = strtolower((string) $manifest->name); $element = preg_replace('/[^A-Z0-9_\.-]/i', '', $name); if (substr($element, 0, 4) != 'com_') { $element = 'com_'.$element; } break; case 'module': case 'plugin': if(count($manifest->files->children())) { foreach($manifest->files->children() as $file) { if ((string) $file->attributes()->$type) { $element = (string) $file->attributes()->$type; break; } } } break; case 'file': case 'library': $element = substr($manifestPath, 0, -strlen('.xml')); break; case 'package': $element = preg_replace('/[^A-Z0-9_\.-]/i', '', $manifest->packagename); if (substr($element, 0, 4) != 'pkg_') { $element = 'pkg_'.$element; } break; case 'language': $element = $manifest->get('tag'); break; case 'template': $name = preg_replace('/[^A-Z0-9_ \.-]/i', '', $manifest->name); $element = strtolower(str_replace(' ', '_', $name)); break; default: break; } return $element; }
[ "protected", "function", "_getElementFromManifest", "(", "$", "manifest", ",", "$", "manifestPath", ")", "{", "$", "element", "=", "''", ";", "$", "type", "=", "(", "string", ")", "$", "manifest", "->", "attributes", "(", ")", "->", "type", ";", "switch", "(", "$", "type", ")", "{", "case", "'component'", ":", "$", "name", "=", "strtolower", "(", "(", "string", ")", "$", "manifest", "->", "name", ")", ";", "$", "element", "=", "preg_replace", "(", "'/[^A-Z0-9_\\.-]/i'", ",", "''", ",", "$", "name", ")", ";", "if", "(", "substr", "(", "$", "element", ",", "0", ",", "4", ")", "!=", "'com_'", ")", "{", "$", "element", "=", "'com_'", ".", "$", "element", ";", "}", "break", ";", "case", "'module'", ":", "case", "'plugin'", ":", "if", "(", "count", "(", "$", "manifest", "->", "files", "->", "children", "(", ")", ")", ")", "{", "foreach", "(", "$", "manifest", "->", "files", "->", "children", "(", ")", "as", "$", "file", ")", "{", "if", "(", "(", "string", ")", "$", "file", "->", "attributes", "(", ")", "->", "$", "type", ")", "{", "$", "element", "=", "(", "string", ")", "$", "file", "->", "attributes", "(", ")", "->", "$", "type", ";", "break", ";", "}", "}", "}", "break", ";", "case", "'file'", ":", "case", "'library'", ":", "$", "element", "=", "substr", "(", "$", "manifestPath", ",", "0", ",", "-", "strlen", "(", "'.xml'", ")", ")", ";", "break", ";", "case", "'package'", ":", "$", "element", "=", "preg_replace", "(", "'/[^A-Z0-9_\\.-]/i'", ",", "''", ",", "$", "manifest", "->", "packagename", ")", ";", "if", "(", "substr", "(", "$", "element", ",", "0", ",", "4", ")", "!=", "'pkg_'", ")", "{", "$", "element", "=", "'pkg_'", ".", "$", "element", ";", "}", "break", ";", "case", "'language'", ":", "$", "element", "=", "$", "manifest", "->", "get", "(", "'tag'", ")", ";", "break", ";", "case", "'template'", ":", "$", "name", "=", "preg_replace", "(", "'/[^A-Z0-9_ \\.-]/i'", ",", "''", ",", "$", "manifest", "->", "name", ")", ";", "$", "element", "=", "strtolower", "(", "str_replace", "(", "' '", ",", "'_'", ",", "$", "name", ")", ")", ";", "break", ";", "default", ":", "break", ";", "}", "return", "$", "element", ";", "}" ]
Load the element name from the installation manifest. @param $manifest @return mixed|string
[ "Load", "the", "element", "name", "from", "the", "installation", "manifest", "." ]
2aa82ed08983bccd51905426cfff4980ba960d89
https://github.com/nooku/nooku-installer/blob/2aa82ed08983bccd51905426cfff4980ba960d89/src/Nooku/Composer/Installer/JoomlaExtension.php#L173-L225
18,386
webforge-labs/psc-cms
lib/Psc/Code/Generate/GClass.php
GClass.setName
public function setName($name) { if (mb_strpos($name,'\\') !== FALSE) { $this->setNamespace(Code::getNamespace($name)); $this->name = Code::getClassName($name); } else { $this->name = $name; $this->namespace = NULL; } return $this; }
php
public function setName($name) { if (mb_strpos($name,'\\') !== FALSE) { $this->setNamespace(Code::getNamespace($name)); $this->name = Code::getClassName($name); } else { $this->name = $name; $this->namespace = NULL; } return $this; }
[ "public", "function", "setName", "(", "$", "name", ")", "{", "if", "(", "mb_strpos", "(", "$", "name", ",", "'\\\\'", ")", "!==", "FALSE", ")", "{", "$", "this", "->", "setNamespace", "(", "Code", "::", "getNamespace", "(", "$", "name", ")", ")", ";", "$", "this", "->", "name", "=", "Code", "::", "getClassName", "(", "$", "name", ")", ";", "}", "else", "{", "$", "this", "->", "name", "=", "$", "name", ";", "$", "this", "->", "namespace", "=", "NULL", ";", "}", "return", "$", "this", ";", "}" ]
Setzt den Namen der Klasse Namespace wird immer mitgesetzt! D. h. übergibt man hier nur den ShortName wird der Namespace auf NULL gesetzt Wenn man nur den Namen der Klasse und nicht den Namespace wechseln will, muss man setClassName() nehmen @param string FQN;
[ "Setzt", "den", "Namen", "der", "Klasse" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Generate/GClass.php#L652-L661
18,387
webforge-labs/psc-cms
lib/Psc/Code/Generate/GClass.php
GClass.removeInterface
public function removeInterface(GClass $class) { if (array_key_exists($n = $class->getFQN(), $this->interfaces)) { unset($this->interfaces[$n]); } return $this; }
php
public function removeInterface(GClass $class) { if (array_key_exists($n = $class->getFQN(), $this->interfaces)) { unset($this->interfaces[$n]); } return $this; }
[ "public", "function", "removeInterface", "(", "GClass", "$", "class", ")", "{", "if", "(", "array_key_exists", "(", "$", "n", "=", "$", "class", "->", "getFQN", "(", ")", ",", "$", "this", "->", "interfaces", ")", ")", "{", "unset", "(", "$", "this", "->", "interfaces", "[", "$", "n", "]", ")", ";", "}", "return", "$", "this", ";", "}" ]
Entfernt das Interface aus der Klasse @chainable
[ "Entfernt", "das", "Interface", "aus", "der", "Klasse" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Generate/GClass.php#L804-L809
18,388
lode/fem
src/login_github.php
login_github.get_config
protected static function get_config() { $config_file = \alsvanzelf\fem\ROOT_DIR.'config/github.ini'; if (file_exists($config_file) == false) { $exception = bootstrap::get_library('exception'); throw new $exception('no github application config found'); } return parse_ini_file($config_file); }
php
protected static function get_config() { $config_file = \alsvanzelf\fem\ROOT_DIR.'config/github.ini'; if (file_exists($config_file) == false) { $exception = bootstrap::get_library('exception'); throw new $exception('no github application config found'); } return parse_ini_file($config_file); }
[ "protected", "static", "function", "get_config", "(", ")", "{", "$", "config_file", "=", "\\", "alsvanzelf", "\\", "fem", "\\", "ROOT_DIR", ".", "'config/github.ini'", ";", "if", "(", "file_exists", "(", "$", "config_file", ")", "==", "false", ")", "{", "$", "exception", "=", "bootstrap", "::", "get_library", "(", "'exception'", ")", ";", "throw", "new", "$", "exception", "(", "'no github application config found'", ")", ";", "}", "return", "parse_ini_file", "(", "$", "config_file", ")", ";", "}" ]
collects a config containing the github app codes from a ini file @return array with 'client_id', 'client_secret', 'callback_url' values
[ "collects", "a", "config", "containing", "the", "github", "app", "codes", "from", "a", "ini", "file" ]
c1c466c1a904d99452b341c5ae7cbc3e22b106e1
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_github.php#L63-L71
18,389
lode/fem
src/login_github.php
login_github.get_by_info
public static function get_by_info($info, $update_oauth_token=true) { $mysql = bootstrap::get_library('mysql'); // find via the oauth token $sql = "SELECT * FROM `login_github` WHERE `oauth_token` = '%s';"; $login = $mysql::select('row', $sql, $info['oauth_token']); if (!empty($login)) { return new static($login['id']); } // find via the github username $sql = "SELECT * FROM `login_github` WHERE `github_username` = '%s';"; $login = $mysql::select('row', $sql, $info['github_username']); if (empty($login)) { return false; } $object = new static($login['id']); // keep token up to date if ($update_oauth_token && $info['oauth_token'] != $login['oauth_token']) { $object->update_oauth_token($info['oauth_token']); } return $object; }
php
public static function get_by_info($info, $update_oauth_token=true) { $mysql = bootstrap::get_library('mysql'); // find via the oauth token $sql = "SELECT * FROM `login_github` WHERE `oauth_token` = '%s';"; $login = $mysql::select('row', $sql, $info['oauth_token']); if (!empty($login)) { return new static($login['id']); } // find via the github username $sql = "SELECT * FROM `login_github` WHERE `github_username` = '%s';"; $login = $mysql::select('row', $sql, $info['github_username']); if (empty($login)) { return false; } $object = new static($login['id']); // keep token up to date if ($update_oauth_token && $info['oauth_token'] != $login['oauth_token']) { $object->update_oauth_token($info['oauth_token']); } return $object; }
[ "public", "static", "function", "get_by_info", "(", "$", "info", ",", "$", "update_oauth_token", "=", "true", ")", "{", "$", "mysql", "=", "bootstrap", "::", "get_library", "(", "'mysql'", ")", ";", "// find via the oauth token", "$", "sql", "=", "\"SELECT * FROM `login_github` WHERE `oauth_token` = '%s';\"", ";", "$", "login", "=", "$", "mysql", "::", "select", "(", "'row'", ",", "$", "sql", ",", "$", "info", "[", "'oauth_token'", "]", ")", ";", "if", "(", "!", "empty", "(", "$", "login", ")", ")", "{", "return", "new", "static", "(", "$", "login", "[", "'id'", "]", ")", ";", "}", "// find via the github username", "$", "sql", "=", "\"SELECT * FROM `login_github` WHERE `github_username` = '%s';\"", ";", "$", "login", "=", "$", "mysql", "::", "select", "(", "'row'", ",", "$", "sql", ",", "$", "info", "[", "'github_username'", "]", ")", ";", "if", "(", "empty", "(", "$", "login", ")", ")", "{", "return", "false", ";", "}", "$", "object", "=", "new", "static", "(", "$", "login", "[", "'id'", "]", ")", ";", "// keep token up to date", "if", "(", "$", "update_oauth_token", "&&", "$", "info", "[", "'oauth_token'", "]", "!=", "$", "login", "[", "'oauth_token'", "]", ")", "{", "$", "object", "->", "update_oauth_token", "(", "$", "info", "[", "'oauth_token'", "]", ")", ";", "}", "return", "$", "object", ";", "}" ]
checks whether the login match one on file and returns the found login $info needs to contain both 'oauth_token' and 'github_username' use ::get_by_oauth_token() if only the 'oauth_token' is known magic alert: also update the token on file if the token is different but the username is found to do manually, set $update_oauth_token to false and call $login->update_oauth_token() @param array $info as returned by ::is_valid() @param boolean $update_oauth_token defaults to true @return $this|boolean false when the token is not found
[ "checks", "whether", "the", "login", "match", "one", "on", "file", "and", "returns", "the", "found", "login" ]
c1c466c1a904d99452b341c5ae7cbc3e22b106e1
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_github.php#L87-L112
18,390
lode/fem
src/login_github.php
login_github.get_by_user_id
public static function get_by_user_id($user_id) { $mysql = bootstrap::get_library('mysql'); $sql = "SELECT * FROM `login_github` WHERE `user_id` = %d;"; $login = $mysql::select('row', $sql, $user_id); if (empty($login)) { return false; } return new static($login['id']); }
php
public static function get_by_user_id($user_id) { $mysql = bootstrap::get_library('mysql'); $sql = "SELECT * FROM `login_github` WHERE `user_id` = %d;"; $login = $mysql::select('row', $sql, $user_id); if (empty($login)) { return false; } return new static($login['id']); }
[ "public", "static", "function", "get_by_user_id", "(", "$", "user_id", ")", "{", "$", "mysql", "=", "bootstrap", "::", "get_library", "(", "'mysql'", ")", ";", "$", "sql", "=", "\"SELECT * FROM `login_github` WHERE `user_id` = %d;\"", ";", "$", "login", "=", "$", "mysql", "::", "select", "(", "'row'", ",", "$", "sql", ",", "$", "user_id", ")", ";", "if", "(", "empty", "(", "$", "login", ")", ")", "{", "return", "false", ";", "}", "return", "new", "static", "(", "$", "login", "[", "'id'", "]", ")", ";", "}" ]
checks whether the given user id match a login on file and returns the found login @param int $user_id @return $this|boolean false when the user id is not found
[ "checks", "whether", "the", "given", "user", "id", "match", "a", "login", "on", "file", "and", "returns", "the", "found", "login" ]
c1c466c1a904d99452b341c5ae7cbc3e22b106e1
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_github.php#L121-L131
18,391
lode/fem
src/login_github.php
login_github.get_by_github_username
public static function get_by_github_username($github_username) { $mysql = bootstrap::get_library('mysql'); $sql = "SELECT * FROM `login_github` WHERE `github_username` = '%s';"; $login = $mysql::select('row', $sql, $github_username); if (empty($login)) { return false; } return new static($login['id']); }
php
public static function get_by_github_username($github_username) { $mysql = bootstrap::get_library('mysql'); $sql = "SELECT * FROM `login_github` WHERE `github_username` = '%s';"; $login = $mysql::select('row', $sql, $github_username); if (empty($login)) { return false; } return new static($login['id']); }
[ "public", "static", "function", "get_by_github_username", "(", "$", "github_username", ")", "{", "$", "mysql", "=", "bootstrap", "::", "get_library", "(", "'mysql'", ")", ";", "$", "sql", "=", "\"SELECT * FROM `login_github` WHERE `github_username` = '%s';\"", ";", "$", "login", "=", "$", "mysql", "::", "select", "(", "'row'", ",", "$", "sql", ",", "$", "github_username", ")", ";", "if", "(", "empty", "(", "$", "login", ")", ")", "{", "return", "false", ";", "}", "return", "new", "static", "(", "$", "login", "[", "'id'", "]", ")", ";", "}" ]
checks whether the given github username match one on file and returns the found login @param string $github_username @return $this|boolean false when the username is not found
[ "checks", "whether", "the", "given", "github", "username", "match", "one", "on", "file", "and", "returns", "the", "found", "login" ]
c1c466c1a904d99452b341c5ae7cbc3e22b106e1
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_github.php#L140-L150
18,392
lode/fem
src/login_github.php
login_github.get_by_oauth_token
public static function get_by_oauth_token($oauth_token) { $mysql = bootstrap::get_library('mysql'); $sql = "SELECT * FROM `login_github` WHERE `oauth_token` = '%s';"; $login = $mysql::select('row', $sql, $oauth_token); if (empty($login)) { return false; } return new static($login['id']); }
php
public static function get_by_oauth_token($oauth_token) { $mysql = bootstrap::get_library('mysql'); $sql = "SELECT * FROM `login_github` WHERE `oauth_token` = '%s';"; $login = $mysql::select('row', $sql, $oauth_token); if (empty($login)) { return false; } return new static($login['id']); }
[ "public", "static", "function", "get_by_oauth_token", "(", "$", "oauth_token", ")", "{", "$", "mysql", "=", "bootstrap", "::", "get_library", "(", "'mysql'", ")", ";", "$", "sql", "=", "\"SELECT * FROM `login_github` WHERE `oauth_token` = '%s';\"", ";", "$", "login", "=", "$", "mysql", "::", "select", "(", "'row'", ",", "$", "sql", ",", "$", "oauth_token", ")", ";", "if", "(", "empty", "(", "$", "login", ")", ")", "{", "return", "false", ";", "}", "return", "new", "static", "(", "$", "login", "[", "'id'", "]", ")", ";", "}" ]
checks whether the given oauth token match one on file and returns the found login @param string $oauth_token @return $this|boolean false when the token is not found
[ "checks", "whether", "the", "given", "oauth", "token", "match", "one", "on", "file", "and", "returns", "the", "found", "login" ]
c1c466c1a904d99452b341c5ae7cbc3e22b106e1
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_github.php#L159-L169
18,393
lode/fem
src/login_github.php
login_github.signup
public static function signup($user_id, $info) { if (empty($info['github_username']) || empty($info['oauth_token']) || empty($info['scope'])) { $exception = bootstrap::get_library('exception'); throw new $exception('all info from ::is_valid() is needed for signup'); } $mysql = bootstrap::get_library('mysql'); $sql = "INSERT INTO `login_github` SET `user_id` = %d, `github_username` = '%s', `oauth_token` = '%s', `scope` = '%s' ;"; $binds = [$user_id, $info['github_username'], $info['oauth_token'], $info['scope']]; $mysql::query($sql, $binds); return new static($mysql::$insert_id); }
php
public static function signup($user_id, $info) { if (empty($info['github_username']) || empty($info['oauth_token']) || empty($info['scope'])) { $exception = bootstrap::get_library('exception'); throw new $exception('all info from ::is_valid() is needed for signup'); } $mysql = bootstrap::get_library('mysql'); $sql = "INSERT INTO `login_github` SET `user_id` = %d, `github_username` = '%s', `oauth_token` = '%s', `scope` = '%s' ;"; $binds = [$user_id, $info['github_username'], $info['oauth_token'], $info['scope']]; $mysql::query($sql, $binds); return new static($mysql::$insert_id); }
[ "public", "static", "function", "signup", "(", "$", "user_id", ",", "$", "info", ")", "{", "if", "(", "empty", "(", "$", "info", "[", "'github_username'", "]", ")", "||", "empty", "(", "$", "info", "[", "'oauth_token'", "]", ")", "||", "empty", "(", "$", "info", "[", "'scope'", "]", ")", ")", "{", "$", "exception", "=", "bootstrap", "::", "get_library", "(", "'exception'", ")", ";", "throw", "new", "$", "exception", "(", "'all info from ::is_valid() is needed for signup'", ")", ";", "}", "$", "mysql", "=", "bootstrap", "::", "get_library", "(", "'mysql'", ")", ";", "$", "sql", "=", "\"INSERT INTO `login_github` SET\n\t\t`user_id` = %d,\n\t\t`github_username` = '%s',\n\t\t`oauth_token` = '%s',\n\t\t`scope` = '%s'\n\t;\"", ";", "$", "binds", "=", "[", "$", "user_id", ",", "$", "info", "[", "'github_username'", "]", ",", "$", "info", "[", "'oauth_token'", "]", ",", "$", "info", "[", "'scope'", "]", "]", ";", "$", "mysql", "::", "query", "(", "$", "sql", ",", "$", "binds", ")", ";", "return", "new", "static", "(", "$", "mysql", "::", "$", "insert_id", ")", ";", "}" ]
adds a new login connection between a local user and a github account @param int $user_id @param array $info as returned by ::is_valid() @return $this
[ "adds", "a", "new", "login", "connection", "between", "a", "local", "user", "and", "a", "github", "account" ]
c1c466c1a904d99452b341c5ae7cbc3e22b106e1
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_github.php#L178-L196
18,394
lode/fem
src/login_github.php
login_github.update_oauth_token
public function update_oauth_token($new_oauth_token) { $mysql = bootstrap::get_library('mysql'); $sql = "UPDATE `login_github` SET `oauth_token` = '%s' WHERE `id` = %d;"; $binds = [$new_oauth_token, $this->id]; $mysql::query($sql, $binds); }
php
public function update_oauth_token($new_oauth_token) { $mysql = bootstrap::get_library('mysql'); $sql = "UPDATE `login_github` SET `oauth_token` = '%s' WHERE `id` = %d;"; $binds = [$new_oauth_token, $this->id]; $mysql::query($sql, $binds); }
[ "public", "function", "update_oauth_token", "(", "$", "new_oauth_token", ")", "{", "$", "mysql", "=", "bootstrap", "::", "get_library", "(", "'mysql'", ")", ";", "$", "sql", "=", "\"UPDATE `login_github` SET `oauth_token` = '%s' WHERE `id` = %d;\"", ";", "$", "binds", "=", "[", "$", "new_oauth_token", ",", "$", "this", "->", "id", "]", ";", "$", "mysql", "::", "query", "(", "$", "sql", ",", "$", "binds", ")", ";", "}" ]
updates the oauth token for the login @param string $new_oauth_token @return void
[ "updates", "the", "oauth", "token", "for", "the", "login" ]
c1c466c1a904d99452b341c5ae7cbc3e22b106e1
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_github.php#L237-L243
18,395
lode/fem
src/login_github.php
login_github.request_authorization
public static function request_authorization($scope=null, $callback_url=null) { $config = static::get_config(); if (!empty($callback_url) && strpos($callback_url, $config['callback_url']) !== 0) { $exception = bootstrap::get_library('exception'); throw new $exception('custom callback url needs to start with defined callback url'); } if (empty($callback_url)) { $callback_url = $config['callback_url']; } $text = bootstrap::get_library('text'); $session = bootstrap::get_library('session'); $request = bootstrap::get_library('request'); // state is a shared secret to prevent people faking the callback $state = $text::generate_token($length=40); $session::start(session::TYPE_TEMPORARY); $_SESSION['fem/login_github/state'] = $state; $_SESSION['fem/login_github/scope'] = $scope; // let the user authorize at github $url = 'https://github.com/login/oauth/authorize'; $arguments = [ 'client_id' => $config['client_id'], 'scope' => $scope, 'state' => $state, ]; $request::redirect($url.'?'.http_build_query($arguments)); }
php
public static function request_authorization($scope=null, $callback_url=null) { $config = static::get_config(); if (!empty($callback_url) && strpos($callback_url, $config['callback_url']) !== 0) { $exception = bootstrap::get_library('exception'); throw new $exception('custom callback url needs to start with defined callback url'); } if (empty($callback_url)) { $callback_url = $config['callback_url']; } $text = bootstrap::get_library('text'); $session = bootstrap::get_library('session'); $request = bootstrap::get_library('request'); // state is a shared secret to prevent people faking the callback $state = $text::generate_token($length=40); $session::start(session::TYPE_TEMPORARY); $_SESSION['fem/login_github/state'] = $state; $_SESSION['fem/login_github/scope'] = $scope; // let the user authorize at github $url = 'https://github.com/login/oauth/authorize'; $arguments = [ 'client_id' => $config['client_id'], 'scope' => $scope, 'state' => $state, ]; $request::redirect($url.'?'.http_build_query($arguments)); }
[ "public", "static", "function", "request_authorization", "(", "$", "scope", "=", "null", ",", "$", "callback_url", "=", "null", ")", "{", "$", "config", "=", "static", "::", "get_config", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "callback_url", ")", "&&", "strpos", "(", "$", "callback_url", ",", "$", "config", "[", "'callback_url'", "]", ")", "!==", "0", ")", "{", "$", "exception", "=", "bootstrap", "::", "get_library", "(", "'exception'", ")", ";", "throw", "new", "$", "exception", "(", "'custom callback url needs to start with defined callback url'", ")", ";", "}", "if", "(", "empty", "(", "$", "callback_url", ")", ")", "{", "$", "callback_url", "=", "$", "config", "[", "'callback_url'", "]", ";", "}", "$", "text", "=", "bootstrap", "::", "get_library", "(", "'text'", ")", ";", "$", "session", "=", "bootstrap", "::", "get_library", "(", "'session'", ")", ";", "$", "request", "=", "bootstrap", "::", "get_library", "(", "'request'", ")", ";", "// state is a shared secret to prevent people faking the callback", "$", "state", "=", "$", "text", "::", "generate_token", "(", "$", "length", "=", "40", ")", ";", "$", "session", "::", "start", "(", "session", "::", "TYPE_TEMPORARY", ")", ";", "$", "_SESSION", "[", "'fem/login_github/state'", "]", "=", "$", "state", ";", "$", "_SESSION", "[", "'fem/login_github/scope'", "]", "=", "$", "scope", ";", "// let the user authorize at github", "$", "url", "=", "'https://github.com/login/oauth/authorize'", ";", "$", "arguments", "=", "[", "'client_id'", "=>", "$", "config", "[", "'client_id'", "]", ",", "'scope'", "=>", "$", "scope", ",", "'state'", "=>", "$", "state", ",", "]", ";", "$", "request", "::", "redirect", "(", "$", "url", ".", "'?'", ".", "http_build_query", "(", "$", "arguments", ")", ")", ";", "}" ]
send a user to github to authorize our application @param string $scope defaults to the scope of the previous authorization or no scopes at all if authorization is never done yet see https://developer.github.com/v3/oauth/#parameters @param string $callback_url defaults to what is set in the config @return void even more so, the user is gone
[ "send", "a", "user", "to", "github", "to", "authorize", "our", "application" ]
c1c466c1a904d99452b341c5ae7cbc3e22b106e1
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_github.php#L254-L284
18,396
lode/fem
src/login_github.php
login_github.is_valid
public static function is_valid($callback_data, $extended=true) { $exception = bootstrap::get_library('exception'); if (empty($callback_data['state'])) { throw new $exception('state expected in oauth callback'); } $session = bootstrap::get_library('session'); $session::start($session::TYPE_TEMPORARY); if ($callback_data['state'] != $_SESSION['fem/login_github/state']) { throw new $exception('state is different, someone tries to fake the callback?'); } if (empty($callback_data['code'])) { return false; } if ($extended) { return static::is_valid_extended($callback_data); } return true; }
php
public static function is_valid($callback_data, $extended=true) { $exception = bootstrap::get_library('exception'); if (empty($callback_data['state'])) { throw new $exception('state expected in oauth callback'); } $session = bootstrap::get_library('session'); $session::start($session::TYPE_TEMPORARY); if ($callback_data['state'] != $_SESSION['fem/login_github/state']) { throw new $exception('state is different, someone tries to fake the callback?'); } if (empty($callback_data['code'])) { return false; } if ($extended) { return static::is_valid_extended($callback_data); } return true; }
[ "public", "static", "function", "is_valid", "(", "$", "callback_data", ",", "$", "extended", "=", "true", ")", "{", "$", "exception", "=", "bootstrap", "::", "get_library", "(", "'exception'", ")", ";", "if", "(", "empty", "(", "$", "callback_data", "[", "'state'", "]", ")", ")", "{", "throw", "new", "$", "exception", "(", "'state expected in oauth callback'", ")", ";", "}", "$", "session", "=", "bootstrap", "::", "get_library", "(", "'session'", ")", ";", "$", "session", "::", "start", "(", "$", "session", "::", "TYPE_TEMPORARY", ")", ";", "if", "(", "$", "callback_data", "[", "'state'", "]", "!=", "$", "_SESSION", "[", "'fem/login_github/state'", "]", ")", "{", "throw", "new", "$", "exception", "(", "'state is different, someone tries to fake the callback?'", ")", ";", "}", "if", "(", "empty", "(", "$", "callback_data", "[", "'code'", "]", ")", ")", "{", "return", "false", ";", "}", "if", "(", "$", "extended", ")", "{", "return", "static", "::", "is_valid_extended", "(", "$", "callback_data", ")", ";", "}", "return", "true", ";", "}" ]
checks whether an oauth callback contains a valid state and code magic alert: this also does a lot more validation and info gathering to do manually, set $extended to false and call ::is_valid_extended() or .. .. call ::exchange_for_oauth_token(), ::verify_scope(), ::get_user_info() and ::verify_user() can return an info array containing 'oauth_token', 'github_username', etc. @see ::is_valid_extended() @param array $callback_data as received from github, containing 'state', 'code' and 'scope' @param boolean $extended defaults to true @return boolean|array returns array on successful validation and $extended set to true
[ "checks", "whether", "an", "oauth", "callback", "contains", "a", "valid", "state", "and", "code" ]
c1c466c1a904d99452b341c5ae7cbc3e22b106e1
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_github.php#L300-L321
18,397
lode/fem
src/login_github.php
login_github.exchange_for_oauth_token
public static function exchange_for_oauth_token($code) { $config = static::get_config(); $url = 'https://github.com/login/oauth/access_token'; $options = [ 'body' => [ // 'json' || 'body' || 'query' 'client_id' => $config['client_id'], 'client_secret' => $config['client_secret'], 'code' => $code, ], 'headers' => [ 'Accept' => 'application/json', ], ]; $http = new \GuzzleHttp\Client(); $response = $http->post($url, $options)->json(); if (empty($response['access_token'])) { $exception = bootstrap::get_library('exception'); throw new $exception('can not get oauth token for temporary code'); } return [ 'oauth_token' => $response['access_token'], 'scope' => $response['scope'], ]; }
php
public static function exchange_for_oauth_token($code) { $config = static::get_config(); $url = 'https://github.com/login/oauth/access_token'; $options = [ 'body' => [ // 'json' || 'body' || 'query' 'client_id' => $config['client_id'], 'client_secret' => $config['client_secret'], 'code' => $code, ], 'headers' => [ 'Accept' => 'application/json', ], ]; $http = new \GuzzleHttp\Client(); $response = $http->post($url, $options)->json(); if (empty($response['access_token'])) { $exception = bootstrap::get_library('exception'); throw new $exception('can not get oauth token for temporary code'); } return [ 'oauth_token' => $response['access_token'], 'scope' => $response['scope'], ]; }
[ "public", "static", "function", "exchange_for_oauth_token", "(", "$", "code", ")", "{", "$", "config", "=", "static", "::", "get_config", "(", ")", ";", "$", "url", "=", "'https://github.com/login/oauth/access_token'", ";", "$", "options", "=", "[", "'body'", "=>", "[", "// 'json' || 'body' || 'query'", "'client_id'", "=>", "$", "config", "[", "'client_id'", "]", ",", "'client_secret'", "=>", "$", "config", "[", "'client_secret'", "]", ",", "'code'", "=>", "$", "code", ",", "]", ",", "'headers'", "=>", "[", "'Accept'", "=>", "'application/json'", ",", "]", ",", "]", ";", "$", "http", "=", "new", "\\", "GuzzleHttp", "\\", "Client", "(", ")", ";", "$", "response", "=", "$", "http", "->", "post", "(", "$", "url", ",", "$", "options", ")", "->", "json", "(", ")", ";", "if", "(", "empty", "(", "$", "response", "[", "'access_token'", "]", ")", ")", "{", "$", "exception", "=", "bootstrap", "::", "get_library", "(", "'exception'", ")", ";", "throw", "new", "$", "exception", "(", "'can not get oauth token for temporary code'", ")", ";", "}", "return", "[", "'oauth_token'", "=>", "$", "response", "[", "'access_token'", "]", ",", "'scope'", "=>", "$", "response", "[", "'scope'", "]", ",", "]", ";", "}" ]
exchange the temporary code for a lasting oauth token @param string $code @return string @throws exception if the exchange fails
[ "exchange", "the", "temporary", "code", "for", "a", "lasting", "oauth", "token" ]
c1c466c1a904d99452b341c5ae7cbc3e22b106e1
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_github.php#L368-L395
18,398
lode/fem
src/login_github.php
login_github.verify_scope
public static function verify_scope($received_scope, $requested_scope='user:email') { if (strpos($received_scope, $requested_scope) !== false) { return true; } if (strpos($requested_scope, ':')) { $parent_requested_scope = substr($requested_scope, 0, strpos($requested_scope, ':')); if (strpos($received_scope, $parent_requested_scope) !== false) { return true; } } return false; }
php
public static function verify_scope($received_scope, $requested_scope='user:email') { if (strpos($received_scope, $requested_scope) !== false) { return true; } if (strpos($requested_scope, ':')) { $parent_requested_scope = substr($requested_scope, 0, strpos($requested_scope, ':')); if (strpos($received_scope, $parent_requested_scope) !== false) { return true; } } return false; }
[ "public", "static", "function", "verify_scope", "(", "$", "received_scope", ",", "$", "requested_scope", "=", "'user:email'", ")", "{", "if", "(", "strpos", "(", "$", "received_scope", ",", "$", "requested_scope", ")", "!==", "false", ")", "{", "return", "true", ";", "}", "if", "(", "strpos", "(", "$", "requested_scope", ",", "':'", ")", ")", "{", "$", "parent_requested_scope", "=", "substr", "(", "$", "requested_scope", ",", "0", ",", "strpos", "(", "$", "requested_scope", ",", "':'", ")", ")", ";", "if", "(", "strpos", "(", "$", "received_scope", ",", "$", "parent_requested_scope", ")", "!==", "false", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
checks whether the received scope meets the requested scope @param string $received_scope @param string $requested_scope defaults to 'user:email' @return boolean
[ "checks", "whether", "the", "received", "scope", "meets", "the", "requested", "scope" ]
c1c466c1a904d99452b341c5ae7cbc3e22b106e1
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_github.php#L404-L417
18,399
lode/fem
src/login_github.php
login_github.get_user_info
public static function get_user_info($oauth_token) { $url = 'https://api.github.com/user'; $options = [ 'headers' => [ 'Accept' => 'application/json', 'Authorization' => 'token '.$oauth_token, ], ]; $http = new \GuzzleHttp\Client(); return $http->get($url, $options)->json(); }
php
public static function get_user_info($oauth_token) { $url = 'https://api.github.com/user'; $options = [ 'headers' => [ 'Accept' => 'application/json', 'Authorization' => 'token '.$oauth_token, ], ]; $http = new \GuzzleHttp\Client(); return $http->get($url, $options)->json(); }
[ "public", "static", "function", "get_user_info", "(", "$", "oauth_token", ")", "{", "$", "url", "=", "'https://api.github.com/user'", ";", "$", "options", "=", "[", "'headers'", "=>", "[", "'Accept'", "=>", "'application/json'", ",", "'Authorization'", "=>", "'token '", ".", "$", "oauth_token", ",", "]", ",", "]", ";", "$", "http", "=", "new", "\\", "GuzzleHttp", "\\", "Client", "(", ")", ";", "return", "$", "http", "->", "get", "(", "$", "url", ",", "$", "options", ")", "->", "json", "(", ")", ";", "}" ]
gets a users github account details for a given oauth token @param string $oauth_token @return array can be expected to contain a 'login' key with the github username
[ "gets", "a", "users", "github", "account", "details", "for", "a", "given", "oauth", "token" ]
c1c466c1a904d99452b341c5ae7cbc3e22b106e1
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_github.php#L425-L436