Find a structure

@param string $section
@return \Core\Model\Settings\StructureAbstract
761817
public function find( $section )
    {
        $def        = $this->getDefinitions();
        $keyNames   = $def->getKeyNames( $section );
        $fieldsets  = $def->getFieldsets( $section );
        $settings   = array();

        if ( empty( $keyNames ) && empty( $fieldsets ) )
        {
            return $this->createStructure( array(
                'section' => $section,
            ) );
        }

        if ( ! empty( $keyNames ) )
        {
            $select = $this->sql()
                           ->select()
                           ->where( $this->keysWhere(
                                array_keys( $keyNames )
                            ) );

            /* @var $result \Zend\Db\Adapter\Driver\ResultInterface */
            $result = $this->sql()
                           ->prepareStatementForSqlObject( $select )
                           ->execute();

            foreach ( $result as $row )
            {
                $key = $row['key'];

                if ( isset( $keyNames[$key] ) )
                {
                    $settings[$keyNames[$key]] = $row['value'];
                }
                else
                {
                    $parts = explode( '.', $key );
                    $index = array_pop( $parts );
                    $key   = implode( '.', $parts );

                    if ( isset( $keyNames[$key] ) )
                    {
                        if ( empty( $settings[$keyNames[$key]] ) )
                        {
                            $settings[$keyNames[$key]] = array();
                        }

                        $settings[$keyNames[$key]][$index] = $row['value'];
                    }
                }
            }
        }

        if ( ! empty( $fieldsets ) )
        {
            foreach ( $fieldsets as $name => $fieldset )
            {
                $fieldset = (string) $fieldset;
                $settings[$name] = $this->find( $fieldset );
            }
        }

        return $this->createStructure( array(
            'section'   => $section,
            'settings'  => $settings,
        ) );
    }
1101695
public function get($section, $key)
    {
        foreach ($this->lines as $line) {
            if ($line['type'] != 'entry') {
                continue;
            }
            if ($line['section'] != $section) {
                continue;
            }
            if ($line['key'] != $key) {
                continue;
            }
            return $line['value'];
        }

        throw new RuntimeException('Missing Section or Key');
    }
1103688
public function getSection()
    {
        if (null === $this->_section) {
            $this->setSection(new Section($this->getUid(), array('page' => $this)));
        }

        return $this->_section;
    }
364538
public function removeSection($section)
    {
        if ($has = $this->hasSection($section)) {
            unset($this->sections[$section]);
        }

        return $has;
    }
913987
public function getConfig($section)
    {
        if (!isset($this->_sections[$section])) {
            $this->_sections[$section] = $this->di->getConfig($section, $this->di->environment(), []);
        }

        return $this->_sections[$section];
    }
971134
private function findSection($section)
	{
		// Check section type
		if (is_int($section) || $section === 'new') {
			return $section;
		} else if (is_string($section)) {
			// Search section names for related index
			$sections = array_keys($this->sections->byName);
			$index = array_search($section, $sections);

			// Return index if found
			if ($index !== false) {
				return $index;
			}
		}

		// Return error message and value
		$this->error = array();
		$this->error['page'] = "Section '$section' was not found on this page";
		return -1;
	}
24207
public function getCustomPaths( $section )
	{
		$paths = array();

		foreach ( $this->_manifests as $path => $manifest )
		{
			if ( isset( $manifest['custom'][$section] ) ) {
				$paths[$path] = $manifest['custom'][$section];
			}
		}

		return $paths;
	}
58389
public function getSectionIdx($section)
    {
        if ($section instanceof \atk4\ui\AccordionSection) {
            return parent::getSectionIdx($section);
        }

        return parent::getSectionIdx($section->owner);
    }
474414
public function getSection($section = null)
    {
        if (null === $this->container) {
            return $this->getRawSection($section);
        }

        return $this->compileParameters($section);
    }
1079032
protected function _findSection($template) {
		$regEx = $this->_prepareSectionRegEx($this->_otag, $this->_ctag);

		$section_start = null;
		$section_type  = null;
		$content_start = null;

		$search_offset = 0;

		$section_stack = array();
		$matches = array();
		while (preg_match($regEx, $template, $matches, PREG_OFFSET_CAPTURE, $search_offset)) {
			if (isset($matches['delims'][0])) {
				list($otag, $ctag) = explode(' ', $matches['delims'][0]);
				$regEx = $this->_prepareSectionRegEx($otag, $ctag);
				$search_offset = $matches[0][1] + strlen($matches[0][0]);
				continue;
			}

			$match    = $matches[0][0];
			$offset   = $matches[0][1];
			$type     = $matches['type'][0];
			$tag_name = trim($matches['tag_name'][0]);

			$search_offset = $offset + strlen($match);

			switch ($type) {
				case '^':
				case '#':
					if (empty($section_stack)) {
						$section_start = $offset;
						$section_type  = $type;
						$content_start = $search_offset;
					}
					array_push($section_stack, $tag_name);
					break;
				case '/':
					if (empty($section_stack) || ($tag_name !== array_pop($section_stack))) {
						if ($this->_throwsException(MustacheException::UNEXPECTED_CLOSE_SECTION)) {
							throw new MustacheException('Unexpected close section: ' . $tag_name, MustacheException::UNEXPECTED_CLOSE_SECTION);
						}
					}

					if (empty($section_stack)) {
						// $before, $type, $tag_name, $content, $after
						return array(
							substr($template, 0, $section_start),
							$section_type,
							$tag_name,
							substr($template, $content_start, $offset - $content_start),
							substr($template, $search_offset),
						);
					}
					break;
			}
		}

		if (!empty($section_stack)) {
			if ($this->_throwsException(MustacheException::UNCLOSED_SECTION)) {
				throw new MustacheException('Unclosed section: ' . $section_stack[0], MustacheException::UNCLOSED_SECTION);
			}
		}
	}
870405
public function findAllButActiveForSection(Section $section)
    {
        $queryBuilder = $this->createQueryBuilder('contribution')
            ->orderBy('contribution.creationDate', 'DESC')
            ->andWhere('contribution.section = :section')
            ->andWhere('contribution.id != :activeId')
            ->setParameter('section', $section)
            ->setParameter('activeId', $section->getActiveContribution()->getId());

        return $queryBuilder->getQuery()->getResult();
    }
1046334
public static function InSection($Section) {
      $Section = (array)$Section;
      foreach ($Section as $Name) {
         if (isset(self::$_Section[$Name]))
            return TRUE;
      }
      return FALSE;
   }
5785
public static function Section($Section, $Method = 'add') {
      $Section = array_fill_keys((array)$Section, TRUE);
      
      
      switch (strtolower($Method)) {
         case 'add':
            self::$_Section = array_merge(self::$_Section, $Section);
            break;
         case 'remove':
            self::$_Section = array_diff_key(self::$_Section, $Section);
            break;
         case 'set':
            self::$_Section = $Section;
            break;
         case 'get':
         default:
            return array_keys(self::$_Section);
      }
   }
742530
public function sectionHasKey($section, $key)
    {
        return (isset($this->raw_parameters[$section])
            && is_array($this->raw_parameters[$section])
            && array_key_exists($key, $this->raw_parameters[$section])
        );
    }
443199
public function get($structure, $default = null)
    {
        if ($structure instanceof Structure) {
            return $structure->get($this->path, $default, $this->separator);
        }

        return StructureHelper::getByPath($structure, $this->path, $this->separator ?: '.');
    }
1141019
protected function processSection(array $section)
        {
            $config = array();

            foreach ($section as $key => $value) {
                $this->processKey($key, $value, $config);
            }

            return $config;
        }
830284
private function processComponentSections($sections)
	{
		// var to hold output
		$output = array();

		// loop through each component grouping
		foreach ($sections as $component => $files)
		{
			// if we dont have an array for that component let's create it
			if (!isset($output[$component]))
			{
				$output[$component] = [];
			}

			// loop through each file
			foreach ($files as $file)
			{
				if (!preg_match('/(.*)v[0-9]+_[0-9]+.php$/', $file))
				{
					continue;
				}
				$output[$component] = array_merge($output[$component], $this->processFile($file));
			}
		}

		// return output
		return $output;
	}