Get bite bounds of selected config item (providers, aliases) in file.

@param $item

@return array
179489
protected function getConfigItemBounds($item)
    {
        $file = $this->getFileContents();

        if (!$file) {
            return [null, null];
        }

        $searchStart = '/[\'"]' . $item . '[\'"]/';
        preg_match($searchStart, $file, $matchStart, PREG_OFFSET_CAPTURE);
        $start = array_get(reset($matchStart), 1);
        $end = $start + 1;

        // search for array closing that is not commented
        $match = [')', ']'];
        for ($i = $start; $i <= strlen($file); ++$i) {
            $char = $file[$i];
            if (in_array($char, $match)) {
                if (!$this->isCharInComment($file, $i)) {
                    $end = $i;
                    break;
                }
            }
        }

        return [$start, $end];
    }
364845
protected function _getParamType( &$item )
	{
		if( $item[0] == '"' )
		{
			if( ( $item = substr( $item, 1, strlen( $item ) - 2 ) ) === false ) {
				throw new MW_Common_Exception( sprintf( 'Unable to extract string parameter from >%1$s<', $item ) );
			}

			return MW_DB_Statement_Abstract::PARAM_STR;
		}
		else if( strpos( $item, '.' ) !== false )
		{
			return MW_DB_Statement_Abstract::PARAM_FLOAT;
		}
		else if( ctype_digit( $item ) !== false )
		{
			return MW_DB_Statement_Abstract::PARAM_INT;
		}

		return MW_DB_Statement_Abstract::PARAM_STR;
	}
260882
public function getContainerValues(&$item)
    {
        if (false === is_object($item) && false === is_array($item)) {
            $item = $this->getContainerServices($this->getContainerParameters($item));
        }

        return $item;
    }
43032
protected function getValues($item, array $keys)
    {
        $values = [];
        foreach ($keys as $key) {
            $values[] = Vale::get($item, $key);
        }

        return $values;
    }
839143
protected function _buildItemClasses($item)
    {
        $cls = [
            $this->config('itemClass')
        ];

        if ($this->_isActive($item)) {
            $cls[] = $this->config('itemActiveClass');
        }

        if ($this->_isOpen($item)) {
            $cls[] = $this->config('itemOpenClass');
        }

        return $cls;
    }
6930
public function isSatisfiedBy(Item $item): bool
    {
        foreach ($this->specifications as $specification) {
            if (!$specification->isSatisfiedBy($item)) {
                return false;
            }
        }

        return true;
    }
229966
public function getPluginsThatCanFillItem(Item $item, $field)
    {
        $plugins = [];
        /* @var $plugin Refiller */
        foreach ($this->plugins as $plugin) {
            if ($plugin->isCanRefill($item, $field) || $plugin->isCanSearch($item, $field)) {
                $plugins[] = $plugin;
            }
        }

        return $plugins;
    }
909362
protected function getQuoteType($item)
    {
        $bounds = $this->getConfigItemBounds($item);

        if (!$bounds[0] or !$bounds[1]) {
            return $this->defaultQuoteType;
        }

        $file = $this->getFileContents();
        $substr = substr($file, $bounds[0], $bounds[1] - $bounds[0] + 1);
        return substr_count($substr, '"') > substr_count($substr, "'") ? '"' : "'";
    }
325896
public function __item($item = null)
    {
        $result['name'] = $this->getName();
        $result['content'] = '0';
        $result['active'] = is_null($item) ? true : $item['active'];
        $result['settings'] = Eresus_CMS::getLegacyKernel()->db->
            escape(is_null($item) ? encodeOptions($this->settings) : $item['settings']);
        $result['title'] = $this->title;
        $result['version'] = $this->version;
        $result['description'] = $this->description;
        return $result;
    }
1298765
private function getDataReference($item) {
    if ($this->isASleepingReference) {
      $this->referenceWake();
    }
    if ((is_a($item, '\Nymph\Entity') || is_a($item, '\SciActive\HookOverride'))
        && is_callable([$item, 'toReference'])) {
      // Convert entities to references.
      return $item->toReference();
    } elseif (is_array($item)) {
      // Recurse into lower arrays.
      return array_map([$this, 'getDataReference'], $item);
    } elseif (is_object($item)) {
      foreach ($item as &$curProperty) {
        $curProperty = $this->getDataReference($curProperty);
      }
      unset($curProperty);
    }
    // Not an entity or array, just return it.
    return $item;
  }
1272026
public function getDataByItem(\core_kernel_classes_Resource $item)
    {
        foreach ($this->columns as $column => $config) {
            /** @var Extractor $extractor */
            $extractor = $this->extractors[$config['extractor']];
            if (isset($config['parameters'])) {
                $parameters = $config['parameters'];
            } else {
                $parameters = [];
            }
            $extractor->addColumn($column, $parameters);
        }

        $data = ['0' => []];
        foreach ($this->extractors as $extractor) {

            $extractor->setItem($item);
            $extractor->run();
            $values = $extractor->getData();

            foreach ($values as $key => $value) {

                $interactionData = is_array($value) && count($value) > 1 ? $value : $values;

                if (array_values(array_intersect(array_keys($data[0]), array_keys($interactionData))) == array_keys($interactionData)) {
                    $line = array_intersect_key($data[0], array_flip($this->headers));
                    $data[] = array_merge($line, $interactionData);
                } else {
                    $data[0] = array_merge($data[0], $interactionData);
                }

                $this->headers = array_unique(array_merge($this->headers, array_keys($interactionData)));
            }
        }

        return $data;
    }
720933
public function checkHasSettings($item)
    {
        $plugin = Eresus_Plugin_Registry::getInstance()->load($item['name']);
        if (false === $plugin)
        {
            return false;
        }
        $provider = new Eresus_Admin_ContentProvider_Plugin($plugin);
        return false !== $provider->getSettingsController();
    }
1081047
public function findParent(&$items, $item)
    {
        return $items->filter(function ($element) use ($item) {
            return $item->parent_id == $element->id;
        })->first();
    }
1060956
private function _pop(& $item) : array
    {
        $values = $this->getValues();
        if (empty($values)) {
            $item = null;
            return $values;
        }
        $item = array_pop($values);
        return $values;
    }
1239738
public function parse(array $item): array
    {
        $siteSettings = [];
        foreach ($item['siteSettings'] as $settingKey => $settings) {
            $siteId = isset($settings['siteId']) ? Craft::$app->sites->getSiteByHandle($settings['siteId'])->id : Craft::$app->sites->getPrimarySite()->id;
            unset($settings['siteId']);
            $siteSettings[$siteId] = new CategoryGroup_SiteSettings(array_merge($settings, [
                'siteId' => $siteId,
                'hasUrls' => !empty($settings['uriFormat']),
            ]));
        }
        $categoryGroup = new CategoryGroup([
            'name' => $item['name'],
            'handle' => $item['handle'],
            'maxLevels' => $item['maxLevels'],
        ]);

        $categoryGroup->setSiteSettings($siteSettings);

        return [$categoryGroup, null];
    }
646312
protected function isDescriptorContainer($item)
    {
        return $item instanceof FileDescriptor
            || $item instanceof NamespaceDescriptor
            || $item instanceof ClassDescriptor
            || $item instanceof TraitDescriptor
            || $item instanceof InterfaceDescriptor;
    }
328429
public function parse(array $item): array
    {
        foreach ($item['siteSettings'] as $settingKey => $settings) {
            $siteSettings = new Section_SiteSettings(array_merge($settings, [
                'siteId' => isset($settings['siteId']) ? Craft::$app->sites->getSiteByHandle($settings['siteId'])->id : Craft::$app->sites->getPrimarySite()->id,
            ]));
            if (isset($siteSettings['hasUrls']) && (bool) $siteSettings['hasUrls'] === false) {
                $siteSettings['uriFormat'] = null;
            }
            $item['siteSettings'][$settingKey] = $siteSettings;
        }
        $section = new Section($item);

        return [$section, null];
    }