@param string $subdef_type
@param string $subdef_name

@return databox_subdef
@throws Exception_Databox_SubdefNotFound
1129
public function get_subdef($subdef_type, $subdef_name)
    {
        $type = strtolower($subdef_type);
        $name = strtolower($subdef_name);

        $group = $this->getSubdefGroup(strtolower($subdef_type));

        if (!$group) {
            throw new Exception_Databox_SubdefNotFound(sprintf('Databox subdef name `%s` of type `%s` not found', $name, $type));
        }

        try {
            return $group->getSubdef($name);
        } catch (RuntimeException $exception) {
            throw new Exception_Databox_SubdefNotFound(sprintf('Databox subdef name `%s` of type `%s` not found', $name, $type), $exception);
        }
    }
596921
def p_DataMemberDef(p):
    '''
    
    '''
    if p[1].val != None:
        raise SyntaxError
    p[0] = DataMemberDef(p[2], p[3], p[4], p[5], p[6], p[7])
1220014
public static function export_customfield_data(data_controller $data, \stdClass $exportdata, array $subcontext) {
        writer::with_context($data->get_context())->export_data($subcontext, $exportdata);
    }
998630
function (beanDef, beanName, packageDef) {
        var keyType = beanDef.$keyType;
        var parentKeyType = null;
        var parent = beanDef[jv._MD_PARENTDEF];
        if (!parent[jv._MD_BUILTIN]) {
            parentKeyType = parent.$keyType;
            if (keyType == null) {
                beanDef.$keyType = parentKeyType;
                return;
            }
        } else if (keyType == null) {
            // keyType not specified
            return;
        }
        jv._preprocessBean(keyType, beanName + ".$keyType", packageDef);
        if (parentKeyType != null) {
            __checkInheritance(parentKeyType, keyType);
        }
        // in all cases, keyType must be a sub-type of aria.core.JsonTypes.String
        if (keyType[jv._MD_BASETYPE].typeName != "String") {
            jv._logError(jv.INHERITANCE_EXPECTED, [keyType[jv._MD_TYPENAME], jv._BASE_TYPES_PACKAGE + ".String"]);
            return;
        }
    }
377487
private function readBIFF5CellRangeAddressFixed($subData)
    {
        // offset: 0; size: 2; index to first row
        $fr = self::getInt2d($subData, 0) + 1;

        // offset: 2; size: 2; index to last row
        $lr = self::getInt2d($subData, 2) + 1;

        // offset: 4; size: 1; index to first column
        $fc = ord($subData{4});

        // offset: 5; size: 1; index to last column
        $lc = ord($subData{5});

        // check values
        if ($fr > $lr || $fc > $lc) {
            throw new PHPExcel_Reader_Exception('Not a cell range address');
        }

        // column index to letter
        $fc = PHPExcel_Cell::stringFromColumnIndex($fc);
        $lc = PHPExcel_Cell::stringFromColumnIndex($lc);

        if ($fr == $lr and $fc == $lc) {
            return "$fc$fr";
        }
        return "$fc$fr:$lc$lr";
    }
585862
public function __constructSubReport()
    {
        $this->registerEvent(
            "OnInit",
            function () {
                $params = array_merge($this->params, $_POST);
                if (isset($params["@subReport"])) {
                    $name = $params["@subReport"];
                    unset($params["@subReport"]);
                    $settings = $this->settings();
                    $subReports = Utility::get($settings, "subReports");
                    $class = Utility::get($subReports, $name);
                    if ($class!=null) {
                        $params["@reportName"] = $name;
                        $r = new $class($params);
                        echo "<subreport-partial>";
                        $r->run()->render();
                        echo "</subreport-partial>";
                    } else {
                        header("HTTP/1.1 404 Could not find [$name] sub report");
                    }
                    exit;              
                }    
            }
        );
        $this->registerEvent(
            "OnResourceInit",
            function () {
                $this->getResourceManager()->addScriptFileOnBegin(
                    $this->getResourceManager()->publishAssetFolder(
                        realpath(dirname(__FILE__)."/../clients/core")
                    )."/KoolReport.subReport.js"
                );
            }
        );
    }
85053
function pg_get_indexdef(self, name) {
	return do_query(self, 'SELECT indexdef FROM pg_indexes WHERE indexname = $1 LIMIT 1', [name]).then(function(rows) {
		if(!rows) { throw new TypeError("Unexpected result from query: " + util.inspect(rows)); }
		if(rows.length === 0) {
			throw new TypeError("Index does not exist: " + name);
		}
		return (rows.shift()||{}).indexdef;
	});
}
1258288
function child($name, $required = false) {
		if (!isset($this->{__METHOD__}[$name])) {
			$this->{__METHOD__}[$name] = df_n_set($this->e()->child($name, $required));
		}
		return df_n_get($this->{__METHOD__}[$name]);
	}
1282353
public static function getInstance(Kwf_Component_Data $subroot)
    {
        while ($subroot) {
            if (Kwc_Abstract::getFlag($subroot->componentClass, 'subroot')) {
                break;
            }
            $subroot = $subroot->parent;
        }
        if (!$subroot) $subroot = Kwf_Component_Data_Root::getInstance();

        static $instance = array();
        if (!isset($instance[$subroot->componentId])) {
            $analyzer = new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive();
            $analyzer->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_ShortWords(2));
            //$stopWords = explode(' ', 'der dir das einer eine ein und oder doch ist sind an in vor nicht wir ihr sie es ich');
            //$analyzer->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_StopWords($stopWords));
            Zend_Search_Lucene_Analysis_Analyzer::setDefault($analyzer);
            Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
            Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions(0666);
            $path = 'cache/fulltext';
            $path .= '/'.$subroot->componentId;
            try {
                $instance[$subroot->componentId] = Zend_Search_Lucene::open($path);
            } catch (Zend_Search_Lucene_Exception $e) {
                $instance[$subroot->componentId] = Zend_Search_Lucene::create($path);
            }
        }
        return $instance[$subroot->componentId];
    }
1205
def sub_types
      # Iterate through the Google::Protobuf::FieldDescriptor list
      entries.map do |fd|
        # fd.name = 'current_entity_to_update'
        # fd.number = 1
        # fd.label = :optional
        # fd.submsg_name = "com.foo.bar.Baz"
        # fd.subtype = #<Google::Protobuf::Descriptor:0x007fabb3947f08>
        if fd.subtype.class == Google::Protobuf::Descriptor
          # There is a subtype; recurse
          [name, fd.submsg_name] + fd.subtype.sub_types
        else
          [name, fd.submsg_name]
        end
      end.flatten.compact
    end
236929
public function shareRecord($base_id, $record_id)
    {
        $record = new \record_adapter($this->app, \phrasea::sbasFromBas($this->app, $base_id), $record_id);

        //get list of subdefs
        $subdefs = $record->get_subdefs();

        $databoxSubdefs = $record->getDatabox()->get_subdef_structure()->getSubdefGroup($record->getType());
        $acl = $this->getAclForUser();
        $subdefList = [];
        $defaultKey = null;
        foreach ($subdefs as $subdef) {
            $subdefName = $subdef->get_name();
            if ($subdefName == 'document') {
                if (!$acl->has_right_on_base($record->getBaseId(), \ACL::CANDWNLDHD)) {
                    continue;
                }
                $label = $this->app->trans('prod::tools: document');
            }
            elseif ($databoxSubdefs->hasSubdef($subdefName)) {
                if (!$acl->has_access_to_subdef($record, $subdefName)) {
                    continue;
                }
                $label = $databoxSubdefs->getSubdef($subdefName)->get_label($this->app['locale']);
            }
            else {
                // this subdef does no exists anymore in databox structure ?
                continue;   // don't publish it
            }
            $value = $subdef->get_name();
            $preview = $record->get_subdef($value);
            $defaultKey = $value;   // will set a default option if neither preview,thumbnail or document is present


            if (($previewLink = $preview->get_permalink()) !== null) {
                $permalinkUrl = $previewLink->get_url()->__toString();
                $permaviewUrl = $previewLink->get_page();
                $previewWidth = $preview->get_width();
                $previewHeight = $preview->get_height();
                $embedUrl = $this->app->url('alchemy_embed_view', ['url' => (string)$permalinkUrl]);
                $previewData = [
                    'label'        => $label,
                    'permalinkUrl' => $permalinkUrl,
                    'permaviewUrl' => $permaviewUrl,
                    'embedUrl'     => $embedUrl,
                    'width'        => $previewWidth,
                    'height'       => $previewHeight
                ];
                $subdefList[$value] = $previewData;
            }
        }

        // candidates as best default selected option
        foreach (["preview", "thumbnail", "document"] as $k) {
            if (array_key_exists($k, $subdefList)) {
                $defaultKey = $k;
                break;
            }
        }
        // if no subdef was sharable, subdefList is empty and defaultKey is null
        // the twig MUST handle that
        $outputVars = [
            'isAvailable' => !empty($subdefList),
            'subdefList'  => $subdefList,
            'defaultKey'  => $defaultKey
        ];

        return $this->renderResponse('prod/Share/record.html.twig', $outputVars);
    }
788604
public function getPhinxType($sqlTypeDef)
    {
        $matches = [];
        if (!preg_match('/^([\w]+)(\(([\d]+)*(,([\d]+))*\))*(.+)*$/', $sqlTypeDef, $matches)) {
            throw new UnsupportedColumnTypeException('Column type "' . $sqlTypeDef . '" is not supported by MySQL.');
        } else {
            $limit = null;
            $scale = null;
            $type = $matches[1];
            if (count($matches) > 2) {
                $limit = $matches[3] ? (int)$matches[3] : null;
            }
            if (count($matches) > 4) {
                $scale = (int)$matches[5];
            }
            if ($type === 'tinyint' && $limit === 1) {
                $type = static::PHINX_TYPE_BOOLEAN;
                $limit = null;
            }
            switch ($type) {
                case 'varchar':
                    $type = static::PHINX_TYPE_STRING;
                    if ($limit === 255) {
                        $limit = null;
                    }
                    break;
                case 'char':
                    $type = static::PHINX_TYPE_CHAR;
                    if ($limit === 255) {
                        $limit = null;
                    }
                    if ($limit === 36) {
                        $type = static::PHINX_TYPE_UUID;
                    }
                    break;
                case 'tinyint':
                    $type = static::PHINX_TYPE_INTEGER;
                    $limit = static::INT_TINY;
                    break;
                case 'smallint':
                    $type = static::PHINX_TYPE_SMALL_INTEGER;
                    $limit = static::INT_SMALL;
                    break;
                case 'mediumint':
                    $type = static::PHINX_TYPE_INTEGER;
                    $limit = static::INT_MEDIUM;
                    break;
                case 'int':
                    $type = static::PHINX_TYPE_INTEGER;
                    if ($limit === 11) {
                        $limit = null;
                    }
                    break;
                case 'bigint':
                    if ($limit === 20) {
                        $limit = null;
                    }
                    $type = static::PHINX_TYPE_BIG_INTEGER;
                    break;
                case 'bit':
                    $type = static::PHINX_TYPE_BIT;
                    if ($limit === 64) {
                        $limit = null;
                    }
                    break;
                case 'blob':
                    $type = static::PHINX_TYPE_BINARY;
                    break;
                case 'tinyblob':
                    $type = static::PHINX_TYPE_BINARY;
                    $limit = static::BLOB_TINY;
                    break;
                case 'mediumblob':
                    $type = static::PHINX_TYPE_BINARY;
                    $limit = static::BLOB_MEDIUM;
                    break;
                case 'longblob':
                    $type = static::PHINX_TYPE_BINARY;
                    $limit = static::BLOB_LONG;
                    break;
                case 'tinytext':
                    $type = static::PHINX_TYPE_TEXT;
                    $limit = static::TEXT_TINY;
                    break;
                case 'mediumtext':
                    $type = static::PHINX_TYPE_TEXT;
                    $limit = static::TEXT_MEDIUM;
                    break;
                case 'longtext':
                    $type = static::PHINX_TYPE_TEXT;
                    $limit = static::TEXT_LONG;
                    break;
            }

            try {
                // Call this to check if parsed type is supported.
                $this->getSqlType($type, $limit);
            } catch (UnsupportedColumnTypeException $e) {
                $type = Literal::from($type);
            }

            $phinxType = [
                'name' => $type,
                'limit' => $limit,
                'scale' => $scale
            ];

            if (static::PHINX_TYPE_ENUM == $type || static::PHINX_TYPE_SET == $type) {
                $phinxType['values'] = explode("','", trim($matches[6], "()'"));
            }

            return $phinxType;
        }
    }
994510
public function getObjectsByType($type, $subtype = null)
    {
        $objects = array();

        foreach ($this->objects as $id => $object) {
            if ($object->getHeader()->get('Type') == $type &&
                (is_null($subtype) || $object->getHeader()->get('Subtype') == $subtype)
            ) {
                $objects[$id] = $object;
            }
        }

        return $objects;
    }
333385
private function createSubSpec($_subTerms, $Subfield = null)
    {
        $fieldContext = $this->field->getBaseSpec();
        $context = $fieldContext;
        if (!is_null($Subfield)) {
            $context = $fieldContext.$Subfield->getBaseSpec();
            $subfieldContext = $Subfield->getBaseSpec();
        }

        $handleSubTerm = function ($subTerm) use ($fieldContext, $context) {
            if ('\\' == $subTerm[0]) { // is a comparisonString
                return new ComparisonString(substr($subTerm, 1));
            } else {
                if (strpos('[/_$', $subTerm[0]) && is_null($context)) {
                    throw new InvalidMARCspecException(
                        InvalidMARCspecException::SS.
                        InvalidMARCspecException::MISSINGFIELD,
                        $subTerm
                    );
                }

                switch ($subTerm[0]) {
                    case '_':
                        if ($refPos = strpos($context, $subTerm[0])) {
                            if ('$' !== substr($context, $refPos - 1, 1)) {
                                return new MARCspec(substr($context, 0, $refPos).$subTerm);
                            }
                        }

                        return new MARCspec($fieldContext.$subTerm);

                    case '$':
                        return new MARCspec($fieldContext.$subTerm);

                    case '/':
                        $refPos = strrpos($context, $subTerm[0]);
                        if ($refPos) {
                            if ('$' !== substr($context, $refPos - 1, 1)) {
                                return new MARCspec(substr($context, 0, $refPos).$subTerm);
                            }
                        }

                        return new MARCspec($context.$subTerm);

                    case '[':
                        $refPos = strrpos($context, $subTerm[0]);
                        if ($refPos) {
                            if ('$' !== substr($context, $refPos - 1, 1)) {
                                return new MARCspec(substr($context, 0, $refPos).$subTerm);
                            } else {
                                return new MARCspec($context.$subTerm);
                            }
                        } else {
                            return new MARCspec(substr($context, 0, 3).$subTerm);
                        }

                    default:
                        return new MARCspec($subTerm);
                }
            }
        };

        $_subTermSet = [];

        if (array_key_exists('leftsubterm', $_subTerms)) {
            $_subTermSet['leftsubterm'] = $handleSubTerm($_subTerms['leftsubterm']);
        } else {
            $_subTermSet['leftsubterm'] = new self($context);
        }

        $_subTermSet['rightsubterm'] = $handleSubTerm($_subTerms['rightsubterm']);

        return new SubSpec($_subTermSet['leftsubterm'], $_subTerms['operator'], $_subTermSet['rightsubterm']);
    }
735057
public function filterByDataType($data_type)
    {
        $callback = function (BindingInterface $binding, $key) use ($data_type) {
            switch ($data_type) {
                case PDO::PARAM_BOOL:
                    return $binding->isBoolean();
                case PDO::PARAM_NULL:
                    return $binding->isNull();
                case PDO::PARAM_INT:
                    return $binding->isInteger();
                case PDO::PARAM_STR:
                    return $binding->isString();
                case PDO::PARAM_LOB:
                    return $binding->isLargeObject();
                case PDO::PARAM_STMT:
                    return $binding->isStatement();
                case PDO::PARAM_INPUT_OUTPUT:
                    return $binding->isInputOutput();
            }
        };

        return $this->filter($callback);
    }
1297474
def _populate_sub_entity(self, entity, type_name):
        
        key = type_name.lower()
        if isinstance(entity[key], str):
            # If the expected sub-entity is a string, it's a unknown ID
            entity[key] = dict(id=entity[key])
            return
        cache = self._cache[key]
        subentity = cache.get(entity[key]['id'])
        if not subentity:
            subentities = self.api.get(type_name, id=entity[key]['id'], results_limit=1)
            if len(subentities) > 0:
                subentity = subentities[0]
                entity[key] = subentity
        else:
            entity[key] = subentity
247508
protected function definition_sub() {
        $mform = $this->_form;

        $plugindefaults = get_config('workshopeval_best');
        $current = $this->_customdata['current'];

        $options = array();
        for ($i = 9; $i >= 1; $i = $i-2) {
            $options[$i] = get_string('comparisonlevel' . $i, 'workshopeval_best');
        }
        $mform->addElement('select', 'comparison', get_string('comparison', 'workshopeval_best'), $options);
        $mform->addHelpButton('comparison', 'comparison', 'workshopeval_best');
        $mform->setDefault('comparison', $plugindefaults->comparison);

        $this->set_data($current);
    }