_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q265000
BizField.getDefaultValue
test
public function getDefaultValue() { if ($this->defaultValue !== null) { return Expression::evaluateExpression($this->defaultValue, $this->getDataObj()); } return ""; }
php
{ "resource": "" }
q265001
BizField.getValueOnCreate
test
public function getValueOnCreate() { if ($this->valueOnCreate !== null) { return $this->getSqlValue(Expression::evaluateExpression($this->valueOnCreate, $this->getDataObj())); } return ""; }
php
{ "resource": "" }
q265002
BizField.getValueOnUpdate
test
public function getValueOnUpdate() { if ($this->valueOnUpdate !== null) return $this->getSqlValue(Expression::evaluateExpression($this->valueOnUpdate, $this->getDataObj())); return ""; }
php
{ "resource": "" }
q265003
BizField.checkRequired
test
public function checkRequired() { if (!$this->required || $this->required == "") { return false; } elseif ($this->required == "Y") { $required = true; } elseif ($required != "N") { $required = false; } else { $required = Expression::eva...
php
{ "resource": "" }
q265004
BizField.checkValueType
test
public function checkValueType($value = null) { if (!$value) { $value = $this->value; } $validator = Openbizx::getService(VALIDATE_SERVICE); switch ($this->type) { case "Number": $result = is_numeric($value); break; ...
php
{ "resource": "" }
q265005
BizField.validate
test
public function validate() { $ret = true; if ($this->validator) $ret = Expression::evaluateExpression($this->validator, $this->getDataObj()); return $ret; }
php
{ "resource": "" }
q265006
Twig_Loader_Themes.findFile
test
public function findFile($name, $relative = true) { if ($this->refFindTemplate === null) { $this->refFindTemplate = new ReflectionMethod('Twig_Loader_Filesystem', 'findTemplate'); $this->refFindTemplate->setAccessible(true); } $name = $this->prepareName($name); ...
php
{ "resource": "" }
q265007
Twig_Loader_Themes.prepareName
test
protected function prepareName($name) { $name = preg_replace('#/{2,}#', '/', strtr($name, '\\', '/')); if (isset($name[0]) && static::NP_PREFIX != $name[0]) { $name = static::NP_PREFIX.$this->theme.'/'.$name; } return $name; }
php
{ "resource": "" }
q265008
Twig_Loader_Themes.useTheme
test
public function useTheme($theme) { if (!in_array($theme, $this->fsloader->getNamespaces())) { throw new Twig_Error_Loader(sprintf('Theme "%s" not registered.', $theme)); } $this->theme = $theme; }
php
{ "resource": "" }
q265009
Twig_Loader_Themes.registerTheme
test
public function registerTheme($themeNamespace, $autoUse = true) { $basePath = $this->basePath; $parentNamespace = null; $themesInheritanceList = explode(static::NP_DELIMITER, ltrim($themeNamespace, static::NP_DELIMITER)); while ($themeName = array_shift($themesInheritanceList)) { ...
php
{ "resource": "" }
q265010
Twig_Loader_Themes.addTheme
test
protected function addTheme($basePath, $themeName, $parentNamespace = null, $isContainer = false) { $themePaths = array(); $themeNamespace = $themeName; /** * If parent namespace provided, inherit paths from parent and append parent namespace to the theme namespace. */ ...
php
{ "resource": "" }
q265011
ArrayUtils.key2offset
test
public static function key2offset(array &$arr, $key) { return isset($arr[$key]) ? array_flip(array_keys($arr))[$key] : false; }
php
{ "resource": "" }
q265012
ArrayUtils.offset2key
test
public static function offset2key(array &$arr, $offset) { $keys = array_keys($arr); return isset($keys[$offset]) ? $keys[$offset] : false; }
php
{ "resource": "" }
q265013
ArrayUtils.stDeviation
test
public static function stDeviation(array $arr) { if (!is_array($arr) || sizeof($arr) < 2) { return null; } $mean = self::mean($arr); array_walk($arr, function (&$x) use ($mean) { $x = ($x - $mean)*($x -$mean); }); return sqrt(array_sum($arr)/(...
php
{ "resource": "" }
q265014
Route.setMiddleware
test
public function setMiddleware($middleware): Route { if( !is_array($middleware) ){ $middleware = [$middleware]; } $this->middleware = array_merge($this->middleware, $middleware); return $this; }
php
{ "resource": "" }
q265015
Route.getAction
test
public function getAction() { if( is_string($this->action) && $this->namespace ){ return trim($this->namespace, '\\') . '\\' . $this->action; } return $this->action; }
php
{ "resource": "" }
q265016
Route.getPathParams
test
public function getPathParams(string $path): array { $pathParams = []; // Build out the regex $pattern = implode("\/", $this->getPatternParts()); if( preg_match("/^{$pattern}$/", $path, $parts) ){ // Grab all but the first match, because that will always be the full st...
php
{ "resource": "" }
q265017
Route.matchScheme
test
public function matchScheme($scheme): bool { if( empty($this->schemes) ){ return true; } return array_search(strtolower($scheme), array_map('strtolower', $this->schemes)) !== false; }
php
{ "resource": "" }
q265018
Route.matchHostname
test
public function matchHostname(string $hostnames): bool { if( empty($this->hostnames) ){ return true; } return array_search(strtolower($hostnames), array_map('strtolower', $this->hostnames)) !== false; }
php
{ "resource": "" }
q265019
Route.matchUri
test
public function matchUri(string $uri): bool { $pattern = implode("\/", $this->patternParts); return preg_match("/^{$pattern}$/i", $this->stripLeadingAndTrailingSlash($uri)) != false; }
php
{ "resource": "" }
q265020
BizDataTree.fetchTree
test
public function fetchTree($rootSearchRule, $depth, $globalSearchRule = "") { $this->depth = $depth; $this->globalSearchRule = $globalSearchRule; // query on given search rule $searchRule = "(" . $rootSearchRule . ")"; if ($globalSearchRule != "") $searchRule .= " AND...
php
{ "resource": "" }
q265021
BizDataTree.fetchNodePath
test
public function fetchNodePath($nodeSearchRule, &$pathArray) { $recordList = $this->directFetch($nodeSearchRule); if (count($recordList) >= 1) { if ($recordList[0]['PId'] != '0') { $searchRule = "[Id]='" . $recordList[0]['PId'] . "'"; $this->fetchNodePath($sea...
php
{ "resource": "" }
q265022
BizDataTree._getChildrenNodes
test
private function _getChildrenNodes(&$node, $depth) { $pid = $node->recordId; $searchRule = "[PId]='$pid'"; if ($this->globalSearchRule != "") $searchRule .= " AND " . $this->globalSearchRule; $recordList = $this->directFetch($searchRule); foreach ($recordList as $re...
php
{ "resource": "" }
q265023
Report.getSettings
test
public function getSettings($groups = null, $flag = null) { $settings = array(); foreach ($this->results as $result) { if (IResult::SUCCESS === $result->getStatus()) { $settings = array_merge($settings, $result->getSettings($groups, $flag)); } } ...
php
{ "resource": "" }
q265024
HTMLPreview.getLink
test
protected function getLink() { if ($this->link == null) return null; $formobj = $this->getFormObj(); return Expression::evaluateExpression($this->link, $formobj); }
php
{ "resource": "" }
q265025
HTMLPreview.getText
test
protected function getText() { if ($this->text == null) return null; $formObj = $this->getFormObj(); return Expression::evaluateExpression($this->text, $formObj); }
php
{ "resource": "" }
q265026
NewForm.getNewRecord
test
protected function getNewRecord() { if ($this->getDataObj()) { $recArr = $this->getDataObj()->newRecord(); } if (!$recArr) return null; // load default values if new record value is empty $defaultRecArr = array(); foreach ($this->dataPanel as $...
php
{ "resource": "" }
q265027
HOTPSecret.setSecret
test
public function setSecret($secret, $format = self::FORMAT_RAW) { if ($format == static::FORMAT_HEX) { $secret = hex2bin($secret); } elseif ($format == static::FORMAT_BASE32) { $secret = $this->base32decode($secret); } $this->secret = $secret; }
php
{ "resource": "" }
q265028
Number.getBinary
test
private static function getBinary(float $number): int { $num = 2; if ($number < $num) { return 0; } $result = $num; while (true) { $num *= 2; if ($number < $num) { return $result; } $result = $num; } return 0; }
php
{ "resource": "" }
q265029
Number.getNumber
test
public static function getNumber(float $number, int $decimal = 2): string { if (floor($number) == $number) { $decimal = 0; } switch (self::$locale) { default: case 'cs': case 'sk': case 'de': case 'pl': return number_format($number, $decimal, ',', ' '); case 'en': return number_form...
php
{ "resource": "" }
q265030
BizDataSql.addTableColumn
test
public function addTableColumn($join, $column, $alias=null) { $tcol = $this->getTableColumn($join, $column); if ($alias) $tcol .= " AS ".$alias; if (!$this->_tableColumns) $this->_tableColumns = $tcol; else $this->_tableColumns .= ", ".$tcol; }
php
{ "resource": "" }
q265031
BizDataSql.addSqlExpression
test
public function addSqlExpression($sqlExpr, $alias=null) { if ($alias) $sqlExpr .= ' AS '.$alias; if (!$this->_tableColumns) $this->_tableColumns = $sqlExpr; else $this->_tableColumns .= ", ".$sqlExpr; }
php
{ "resource": "" }
q265032
BizDataSql.resetSQL
test
public function resetSQL() { $this->_sqlWhere = null; $this->_orderBy = null; $this->_otherSQL = null; }
php
{ "resource": "" }
q265033
BizDataSql.addOrderBy
test
public function addOrderBy($orderBy) { if ($orderBy == null) return; if ($this->_orderBy == null) { $this->_orderBy = $orderBy; } elseif (strpos($this->_orderBy, $orderBy) === false) { $this->_orderBy .= " AND " . $orderBy; ...
php
{ "resource": "" }
q265034
BizDataSql.addOtherSQL
test
public function addOtherSQL($otherSQL) { if ($otherSQL == null) return; if ($this->_otherSQL == null) { $this->_otherSQL = $otherSQL; } elseif (strpos($this->_otherSQL, $otherSQL) === false) { $this->_otherSQL .= " AND " . $otherSQL...
php
{ "resource": "" }
q265035
BizDataSql.addAssociation
test
public function addAssociation($assoc) { $where = ""; if ($assoc["Relationship"] == "1-M" || $assoc["Relationship"] == "M-1" || $assoc["Relationship"] == "1-1") { // assc table should same as maintable if ($assoc["Table"] != $this->_mainTable) return; // a...
php
{ "resource": "" }
q265036
BizDataSql.getSqlStatement
test
public function getSqlStatement() { $ret = "SELECT " . $this->_tableColumns; $ret .= " FROM " . $this->_tableJoins; if ($this->_sqlWhere != null) { $ret .= " WHERE " . $this->_sqlWhere; } /* if ($this->orderBy != null) { $ret ....
php
{ "resource": "" }
q265037
DataSet.get
test
public function get($key) { if (isset($this->varValue[$key])) { return new DataRecord($this->varValue[$key], $this->bizDataObj); } else { return NULL; } }
php
{ "resource": "" }
q265038
CliController.cliAction
test
public function cliAction() { $exitCode = $this->cliApplication->run(new RequestInput($this->getRequest())); if (is_numeric($exitCode)) { $model = new ConsoleModel(); $model->setErrorLevel($exitCode); return $model; } }
php
{ "resource": "" }
q265039
TemplateHelper.getDefaultTemplateLocations
test
private static function getDefaultTemplateLocations() { return array( Openbizx::$app->getModulePath() . "/$packagePath/template/$templateFile", dirname(Openbizx::$app->getModulePath() . "/$packagePath") . "/template/$templateFile", Openbizx::$app->getModulePath() . "/$mod...
php
{ "resource": "" }
q265040
LabelList.render
test
public function render() { $value = $this->text ? $this->getText() : $this->value; $fromList = array(); $this->getFromList($fromList); $valueArr = explode(',', $this->value); $style = $this->getStyle(); $func = $this->getFunction(); $id = $this->objectName; ...
php
{ "resource": "" }
q265041
Font.getFontGoogle
test
protected function getFontGoogle($api_key = '') { // Check API KEY if (!empty($api_key)) { $fonts = $this->getFontViaAPI($api_key); // Check fonts if (is_array($fonts) && !empty($fonts)) { return $fonts; } } /** ...
php
{ "resource": "" }
q265042
Setting.matchesGroup
test
public function matchesGroup($groups = null) { if (null !== $groups) { $group_names = self::getGroupNames($groups); return in_array($this->group, $group_names); } return true; }
php
{ "resource": "" }
q265043
BizDataObj.validateInput
test
public function validateInput() { $this->errorFields = array(); foreach ($this->bizRecord->inputFields as $fld) { /* @var $bizField BizField */ $bizField = $this->bizRecord->get($fld); if ($bizField->encrypted == "Y") { if ($bizField->checkRequire...
php
{ "resource": "" }
q265044
BizDataObj.validateUniqueness
test
protected function validateUniqueness() { if (!$this->uniqueness) return true; $groupList = explode(";", $this->uniqueness); foreach ($groupList as $group) { $searchRule = ""; $needCheck = true; $fields = explode(",", $group); forea...
php
{ "resource": "" }
q265045
BizDataObj.canUpdateRecord
test
public function canUpdateRecord($record = null) { if ($this->dataPermControl == 'Y') { $svcObj = Openbizx::getService(OPENBIZ_DATAPERM_SERVICE); if (!$record) { $record = $this->getActiveRecord(); } $result = $svcObj->checkDataPerm($record, 2,...
php
{ "resource": "" }
q265046
BizDataObj.canDeleteRecord
test
public function canDeleteRecord($record = null) { if ($this->dataPermControl == 'Y') { $svcObj = Openbizx::getService(OPENBIZ_DATAPERM_SERVICE); if (!$record) { $record = $this->getActiveRecord(); } $result = $svcObj->checkDataPerm($record, 3, ...
php
{ "resource": "" }
q265047
BizDataObj.updateRecord
test
public function updateRecord($recArr, $oldRecord = null) { $this->events()->trigger(__FUNCTION__ . '.pre', $this, array('record' => $recArr, 'old_record' => $oldRecord)); if (!$this->canUpdateRecord($oldRecord)) { $this->errorMessage = MessageHelper::getMessage("DATA_NO_PERMISSION_UPDATE...
php
{ "resource": "" }
q265048
BizDataObj.newRecord
test
public function newRecord() { $recArr = $this->bizRecord->getEmptyRecordArr(); // if association is 1-M, set the field (pointing to the column) value as the FieldRefVal if ($this->association["Relationship"] == "1-M") { foreach ($this->bizRecord as $field) { if (...
php
{ "resource": "" }
q265049
BizDataObj.generateId
test
protected function generateId($isBeforeInsert = true, $tableName = null, $idCloumnName = null) { // Identity type id is generated after insert is done. // If this method is called before insert, return null. if ($isBeforeInsert && $this->idGeneration == 'Identity') return null; ...
php
{ "resource": "" }
q265050
BizDataObj.insertRecord
test
public function insertRecord($recArr) { $this->events()->trigger(__FUNCTION__ . '.pre', $this, array('record', $recArr)); if ($this->_isNeedGenerateId($recArr)) $recArr["Id"] = $this->generateId(); // for certain cases, id is generated before insert $this->bizRecord->setInput...
php
{ "resource": "" }
q265051
BizDataObj.deleteRecord
test
public function deleteRecord($recArr) { $this->events()->trigger(__FUNCTION__ . '.pre', $this, array('record', $recArr)); if (!$this->canDeleteRecord()) { $this->errorMessage = MessageHelper::getMessage("DATA_NO_PERMISSION_DELETE", $this->objectName); throw new Openbizx\Data\...
php
{ "resource": "" }
q265052
BizDataObj.getOnAuditFields
test
public function getOnAuditFields() { $fieldList = array(); foreach ($this->bizRecord as $field) { if ($field->onAudit) $fieldList[] = $field; } return $fieldList; }
php
{ "resource": "" }
q265053
BizDataObj._runDOTrigger
test
private function _runDOTrigger($triggerType) { // locate the trigger metadata file BOName_Trigger.xml $triggerServiceName = $this->objectName . "_Trigger"; $xmlFile = ObjectFactoryHelper::getXmlFileWithPath($triggerServiceName); if (!$xmlFile) { return; } ...
php
{ "resource": "" }
q265054
BizDataObj.getJoinFields
test
public function getJoinFields($joinDataObj) { // get the maintable of the joindataobj $joinTable = $joinDataObj->mainTableName; $returnRecord = array(); // find the proper join according to the maintable foreach ($this->tableJoins as $tableJoin) { if ($tableJoin-...
php
{ "resource": "" }
q265055
BizDataObj.joinRecord
test
public function joinRecord($joinDataObj, $joinName = "") { // get the maintable of the joindataobj $joinTable = $joinDataObj->mainTableName; $joinRecord = null; $returnRecord = array(); // find the proper join according to join name and the maintable foreach ($this->...
php
{ "resource": "" }
q265056
BizDataObj._isNeedGenerateId
test
private function _isNeedGenerateId($recArr) { if ($this->idGeneration != 'None' && (!$recArr["Id"] || $recArr["Id"] == "")) { return true; } if ($this->idGeneration == 'Identity') { return true; } }
php
{ "resource": "" }
q265057
Runner.run
test
public function run() { $successful = true; $this->initReport(); $checks = array(); foreach ($this->config->getCheckDefinitions() as $check_definition) { $checks[] = $this->getCheckInstance($check_definition); } $progress = $this->command->getHelperSet(...
php
{ "resource": "" }
q265058
Runner.initReport
test
protected function initReport() { $report_implementor = $this->config->getReportImplementor(); $report = new $report_implementor(); if (!$report instanceof IReport) { throw new \InvalidArgumentException( 'The given report class "' . $report_implementor . '" does ...
php
{ "resource": "" }
q265059
HttpKernel.resolveRoute
test
private function resolveRoute(Request $request): Route { if( ($route = $this->router->resolve($request)) === null ){ // 405 Method Not Allowed if( ($methods = $this->router->getMethodsForUri($request)) ){ throw new MethodNotAllowedHttpException; } ...
php
{ "resource": "" }
q265060
HttpKernel.resolveActionParameters
test
private function resolveActionParameters(Request $request, callable $target): array { // Get the target's parameters if( is_array($target) ) { $functionParameters = (new \ReflectionClass(get_class($target[0])))->getMethod($target[1])->getParameters(); } else{ ...
php
{ "resource": "" }
q265061
ReadOnlyCache.has
test
public function has($name, $groups = null, $flag = null) { foreach ($this->settings as $setting) { if (($setting->getName() === $name) && $setting->matchesGroup($groups) && $setting->matchesFlag($flag)) { return true; } } return false; }
php
{ "resource": "" }
q265062
ReadOnlyCache.get
test
public function get($name, $groups = null, $flag = null) { $found = null; foreach ($this->settings as $setting) { if (($setting->getName() === $name) && $setting->matchesGroup($groups) && $setting->matchesFlag($flag)) { return $setting; } } r...
php
{ "resource": "" }
q265063
ReadOnlyCache.getAll
test
public function getAll($groups = null, $flag = null) { $settings = array(); if (null === $groups) { foreach ($this->settings as $setting) { $settings[] = $setting; } } elseif (is_string($groups) || is_array($groups)) { foreach ($this->sett...
php
{ "resource": "" }
q265064
ReadOnlyCache.load
test
public function load() { $location = $this->location; // no location given from commandline -> use config values or fallback to default location if (empty($location)) { $location = $this->parameters->get( 'read_location', $this->parameters->get( ...
php
{ "resource": "" }
q265065
ReadOnlyCache.setLocation
test
public function setLocation($location) { if (!is_readable($location)) { throw new \InvalidArgumentException('Given cache location "' . $location . '" is not readable.'); } $this->location = $location; return $this; }
php
{ "resource": "" }
q265066
PleasingPrefixFilter.prefixCss
test
protected function prefixCss( $content ) { $replaced = array(); if( $rules = $this->getRules( $content ) ) { foreach( $rules as $rule ) { $prefixed = array(); if( strpos( $content, $rule->getRaw() ) !== false && !in_array( $rule->getRaw(), $replaced ) ) { if(...
php
{ "resource": "" }
q265067
PleasingPrefixFilter.prefixAlignItems
test
protected function prefixAlignItems( $value, $extra = null ) { $prop[] = '-ms-flex-align'; switch( $value ) { case 'flex-start': $val[] = 'start'; break; case 'flex-end': $val[] = 'end'; break; default: $val[] = $value; $prop[] = '-ms-gri...
php
{ "resource": "" }
q265068
PleasingPrefixFilter.prefixAlignContent
test
protected function prefixAlignContent( $value, $extra = null ) { $prop = array( '-webkit-align-content', '-ms-flex-line-pack', 'align-content' ); $val[] = $value; switch( $value ) { case 'flex-start': $val[] = 'start'; break; case 'flex-end': ...
php
{ "resource": "" }
q265069
PleasingPrefixFilter.prefixAlignSelf
test
protected function prefixAlignSelf( $value, $extra = null ) { $prop = array( '-webkit-align-self', '-ms-flex-item-align', 'align-self' ); $val[] = $value; switch( $value ) { case 'flex-start': $val[] = 'start'; break; case 'flex-end': $v...
php
{ "resource": "" }
q265070
PleasingPrefixFilter.prefixFlex
test
protected function prefixFlex( $value, $extra = null ) { $parts = explode( " ", $value ); if( count( $parts ) == 3 ) { // Make sure there's a % after the basis to avoid IE10/11 Bugs. // 0px does not work because a minifier would remove it. // // https://github.com/philipwalton/flex...
php
{ "resource": "" }
q265071
PleasingPrefixFilter.prefixJustifyContent
test
protected function prefixJustifyContent( $value, $extra = null ) { $prop = array( '-webkit-justify-content', '-ms-flex-pack', 'justify-content' ); $val[] = $value; switch( $value ) { case 'flex-start': $val[] = 'start'; break; case 'flex-end': ...
php
{ "resource": "" }
q265072
PleasingPrefixFilter.getPrefixRules
test
private function getPrefixRules( $prop, $val, $extra = null ) { $extra = ( empty( $extra ) ) ? null : ' ' . $extra; if( !is_array( $prop ) && is_array( $val ) ) { $properties = array_fill( 0, count( $val ), $prop ); $values = $val; } elseif( !is_array( $val ) && is_array( $prop ) )...
php
{ "resource": "" }
q265073
Media.Comment
test
public function Comment($media_id, $comment) { $this->AddParam('text', $comment); return $this->Post($this->buildUrl($media_id . '/comments')); }
php
{ "resource": "" }
q265074
InstagramBase.Delete
test
protected function Delete($url = null, $params = array()) { if (empty($url)) trigger_error('A URL is required in ' . __METHOD__, E_USER_ERROR); if (!empty($params)) $this->AddParams($params); return $this->request->Delete($url, array_merge($this->default_params, $t...
php
{ "resource": "" }
q265075
ContentResult.getFilteredMedia
test
function getFilteredMedia(array $filters, $allowPlaceholder = true) { $col = []; foreach($this['media'] as $medium) { if (!isset($hasImage) && $medium['type'] == 'image') { $hasImage = true; } if (in_array($medium['type'], $filters)) { ...
php
{ "resource": "" }
q265076
ContentResult.getPreferredImage
test
function getPreferredImage($aspect = null, $orientation = null) { // If theres no images, check for placeholders if (!$this->getFilteredMedia(['image'], false)) { if ($ph = $this->getPlaceholder()) { if ($aspect) { return $ph['meta']['src'][$aspect]; ...
php
{ "resource": "" }
q265077
ContentResult.getPlaceholder
test
function getPlaceholder($index = null) { if (!isset($this['meta']['media']['placeholder'])) { return null; } if (!$this->placeholder_pick) { $this->placeholder_pick = rand(0, count($this['meta']['media']['placeholder']) - 1); } return $this['meta']['me...
php
{ "resource": "" }
q265078
CssRule.fromString
test
public static function fromString( $string ) { if( preg_match( '#(\s+)?([^:]+):([^!;]+)([^;]+)?#', trim( $string, "\n\r" ), $matches ) ) { $rule = new self(); $rule ->setRaw($string) ->setProperty( ( !empty( $matches[ 2 ] ) ) ? trim( $matches[ 2 ] ) : null ) ->setValu...
php
{ "resource": "" }
q265079
CssRule.getOutput
test
public function getOutput() { return sprintf( $this->getTemplate(), $this->getProperty(), $this->getValue(), $this->getBang() ); }
php
{ "resource": "" }
q265080
EloquentReflection.getEloquentReflectionMethod
test
public static function getEloquentReflectionMethod($object, string $method) { if ($object instanceof Builder) { if (method_exists(Model::class, $method)) { return new ReflectionMethod(Model::class, $method); } elseif (method_exists(Query::class, $method)) { ...
php
{ "resource": "" }
q265081
SitemapController.indexAction
test
public function indexAction(Request $request) { $registry = $this->get('ekyna_sitemap.provider_registry'); $sitemaps = []; $lastUpdateDate = null; foreach($registry->getSitemaps() as $sitemap) { $providers = $registry->getProvidersBySitemap($sitemap); $sitema...
php
{ "resource": "" }
q265082
SitemapController.sitemapAction
test
public function sitemapAction(Request $request) { $sitemap = $request->attributes->get('sitemap', null); $registry = $this->get('ekyna_sitemap.provider_registry'); $providers = $registry->getProvidersBySitemap($sitemap); if (0 === count($providers)) { throw new NotFound...
php
{ "resource": "" }
q265083
XMLParser.&
test
function &getTree() { // load xml and check if it turns a valid object. TODO: it will throw error. /* $xml = simplexml_load_file($this->data); if (!$xml) { echo 'invalid xml file '.$this->data; exit; } */ //$parser = xml_parser_create('ISO-8859-1'); $par...
php
{ "resource": "" }
q265084
ResourceServer.isValidRequest
test
public function isValidRequest($headerOnly = true, $accessToken = null) { $accessTokenString = ($accessToken !== null) ? $accessToken : $this->determineAccessToken($headerOnly); // Set the access token $this->accessToken = $thi...
php
{ "resource": "" }
q265085
ResourceServer.determineAccessToken
test
public function determineAccessToken($headerOnly = FALSE) { switch ($headerOnly){ case FALSE: $accessToken = $this->requestHandler->getParam($this->tokenKey); if ($accessToken !== null){ break; } case TRUE: $tokenType = $this->getTokenType(); if (strrpos(get_class($tokenType),"Beare...
php
{ "resource": "" }
q265086
CallsMiddleware.call
test
public function call( string $method, array &$arguments = [], string $callType = Caller::TYPE_DEFAULT, $result = null, bool $catchHalt = true ) { $done = false; $this->each(function ($middleware, $key) use (&$done, &$method, &$arguments, $callType, &$result, $...
php
{ "resource": "" }
q265087
CallsMiddleware.callContextChanged
test
protected function callContextChanged(string $type, $before, $after): bool { $before = is_object($before) ? get_class($before) : ""; $after = is_object($after) ? get_class($after) : ""; return $type === Caller::TYPE_CALLER && $before && $after && $before !== $after; }
php
{ "resource": "" }
q265088
AbstractEngine.storeCommand
test
protected function storeCommand(CommandInterface $command) { $priority = $command->getPriority(); for ($count = count($this->commands), $i = 0; $i < $count; $i++) { if ($this->commands[$i]->getPriority() < $priority) { array_splice($this->commands, $i, 0, [ ...
php
{ "resource": "" }
q265089
AbstractEngine.performExecution
test
protected function performExecution(callable $callback) { $this->executionDepth++; $count = $this->executionCount; $this->executionCount = 0; $this->debug('BEGIN execution (depth: {depth})', [ 'depth' => $this->executionDepth ]); ...
php
{ "resource": "" }
q265090
GlobalPhsService.get
test
public function get($ph) { if (isset($this->phs[$ph])) { return $this->phs[$ph]; } return null; }
php
{ "resource": "" }
q265091
PharCompiler.create
test
public function create($phar_path = 'environaut.phar') { if (file_exists($phar_path)) { unlink($phar_path); } $phar = new \Phar($phar_path, 0, 'environaut.phar'); $phar->setSignatureAlgorithm(\Phar::SHA1); $phar->startBuffering(); $root_dir = dirname(d...
php
{ "resource": "" }
q265092
Router.getPattern
test
public static function getPattern(string $name): ?string { if( array_key_exists($name, static::$patterns) ){ return static::$patterns[$name]; } return null; }
php
{ "resource": "" }
q265093
Router.mergeGroupConfig
test
protected function mergeGroupConfig(array $groupConfig): array { $config = $this->config; $config['hostname'] = $groupConfig['hostname'] ?? null; $config['prefix'] = $groupConfig['prefix'] ?? null; $config['namespace'] = $groupConfig['namespace'] ?? null; if( array_key_exis...
php
{ "resource": "" }
q265094
BizDataObj_Assoc.removeRecord
test
public static function removeRecord($dataObj, $recArr, &$isParentObjUpdated) { if ($dataObj->association["Relationship"] == "M-M") { $isParentObjUpdated = false; return self::_removeRecordMtoM($dataObj, $recArr); } elseif ($dataObj->association["Relationship"] == "Self-Self")...
php
{ "resource": "" }
q265095
BizDataObj_Assoc._removeRecordMtoM
test
private static function _removeRecordMtoM($dataObj, $recArr) { // delete a record on XTable $db = $dataObj->getDBConnection(); //TODO: delete using XDataObj if XDataObj is defined $where = $dataObj->association["XColumn1"] . "='" . $dataObj->association["FieldRefVal"] . "'"; ...
php
{ "resource": "" }
q265096
BizDataObj_Assoc._removeRecordMto1
test
private static function _removeRecordMto1($dataObj, $recArr) { // set the $recArr[Id] to the parent table foriegn key column // get parent/association dataobj $asscObj = Openbizx::getObject($dataObj->association["AsscObjName"]); // call parent dataobj's updateRecord $updateRe...
php
{ "resource": "" }
q265097
Model.relationsToArray
test
public function relationsToArray(){ $snakeAttributes = null; if (isset($this->ddvSnakeAttributes)&&is_bool($this->ddvSnakeAttributes)){ $snakeAttributes = static::$snakeAttributes; static::$snakeAttributes = $this->ddvSnakeAttributes; } $res = parent::relationsToA...
php
{ "resource": "" }
q265098
MetaObject.readMetadata
test
protected function readMetadata(&$xmlArr) { $rootKeys = array_keys($xmlArr); $rootKey = $rootKeys[0]; if ($rootKey != "ATTRIBUTES") { $this->objectName = isset($xmlArr[$rootKey]["ATTRIBUTES"]["NAME"]) ? $xmlArr[$rootKey]["ATTRIBUTES"]["NAME"] : null; $this->objectDesc...
php
{ "resource": "" }
q265099
MetaObject.readMetaCollection
test
protected function readMetaCollection(&$xmlArr, &$metaList) { if (!$xmlArr) { $metaList = null; return; } if (isset($xmlArr["ATTRIBUTES"])) { $metaList[] = $xmlArr; } else { $metaList = $xmlArr; } }
php
{ "resource": "" }