Serializers::checkInclude()

@param mixed $include
@param bool $deep
@return
553173
private function checkInclude($include,$deep = false){
		if (is_string($include)){
			$include = array($include);
		}
		$include = Hash::normalize($include);

		foreach($include as $key => $val){
			$val = Hash::merge($this->includeDef,$val);
			// if Embed in config is true all include array set true
			if($this->config['embed']){
				$val['embed'] = true;
			}
			if ($val['include']){
				$val['include'] = $this->checkInclude($val['include'],true);
			}
			$include[$key] = $val;

		}
		
		
		if (!$deep){
			$this->include = $include;
		}
    	return $include;
	}
1072281
private String[] readIncludeFiles(final String filename, final int depth) {
    logger.info("In readIncludeFiles() for filename='" + filename + "' depth=" + depth);
    if (depth > 10) { // 10 seems like a nice limit... If we're this deep, we're
      // probably in an infinite loop anyway.
      logger.log(Logging.Priority.ERROR.getLevel(), "readIncludeFiles(): Too deep to continue including (depth=" + depth + "). Ending this branch at: " + filename);
      return new String[0];
    }
    final List<String> filenames = new ArrayList<String>();
    java.io.InputStream in = null;
    try {
      final List<InputStream> ioStreams = getInputStreamsForFile(filename);

      for (int i = 0; i < ioStreams.size(); i++) {
        try {
          in = ioStreams.get(i);

          int currentChar = in.read();
          String currentLine = "";
          while (currentChar != -1) {
            if (currentChar == '\r' || currentChar == '\n') {
              if (currentLine.indexOf("#include ") == 0) {
                final String includeFile = replaceVariables(currentLine.substring(9));
                if (includeFile.equals("false")) {
                  logger.info("Found '#include false': Cancelling include processing for this file.");
                  return new String[0];
                }
                logger.info("Found: " + currentLine + ", adding include of '" + includeFile + "' from file='" + filename + "'");
                filenames.add(includeFile);
              }
              currentLine = "";
            } else {
              final byte temp[] = new byte[1];
              temp[0] = (byte) currentChar;
              currentLine += new String(temp, 0, 1);
            }
            currentChar = in.read();
          }
        }
        catch (final java.io.IOException ex) {
          logger.log(Logging.Priority.ERROR.getLevel(), "Unable to read property file to parse include files (" + filename + "): ", ex);
        }
        finally {
          try {
            if (in != null) {
              in.close();
            }
          }
          catch (final java.io.IOException ignored) {
          }
        }
      }
    }
    catch (final java.io.IOException ex) {
      logger.log(Logging.Priority.ERROR.getLevel(), "Unable to read property file to parse include files (" + filename + "): ", ex);
    }
    return filenames.toArray(new String[filenames.size()]);
  }
677837
public function setIncludes($includes)
    {
        if ($this->isReference()) {
            throw $this->tooManyAttributes();
        }
        if ($includes !== null && strlen($includes) > 0) {
            $tok = strtok($includes, ", ");
            while ($tok !== false) {
                $o = $this->createInclude();
                $o->setName($tok);
                $tok = strtok(", ");
            }
        }
    }
883395
function getInclude() {
  const type = tokens[pos].include_type;

  if (type === 1) return getInclude1();
  if (type === 2) return getInclude2();
  if (type === 3) return getInclude3();
  if (type === 4) return getInclude4();
  if (type === 5) return getInclude5();
  if (type === 6) return getInclude6();
  if (type === 7) return getInclude7();
  if (type === 8) return getInclude8();
  if (type === 9) return getIncludeWithKeyframes1();
  if (type === 10) return getIncludeWithKeyframes2();
}
669039
private function addIncludekeyToRelationsIfNotSet($includeKey, $relationships)
    {
        if (!array_key_exists($includeKey, $relationships)) {
            $relationships[$includeKey] = [];
            return $relationships;
        }

        return $relationships;
    }
861293
protected function executeTransformerInclude(Scope $scope, $includeKey, $includeDefinition, $data)
    {
        // Transformer explicitly provided an include method
        $transformer = $scope->transformer();
        $method = $includeDefinition['method'];
        if (method_exists($transformer, $method)) {
            return $transformer->$method($data, $scope);
        }

        // Otherwise try handle the include automatically
        return $this->autoWireInclude($includeKey, $includeDefinition, $data);
    }
795102
public function include($includes)
	{
		$model = $this;

		(function() use ($includes, $model): void
		{
			$this->including($includes)->loadIncludes([$model]);
		})->bindTo($this->builder(), Query::class)();

		return $this;
	}
187775
public void setIncludes(final String includes) {
    if (this.localSet == null) {
      this.localSet = new ConditionalFileSet();
      this.owner.appendExceptFileSet(this.localSet);
    }
    this.localSet.setIncludes(includes);
  }
419621
protected static function hasIdKey(array &$includedData)
    {
        return \array_key_exists(JsonApiTransformer::ID_KEY, $includedData)
        && !empty($includedData[JsonApiTransformer::ID_KEY]);
    }
898501
static function findFileToInclude($file_path, &$new_file_path, &$rel_to_include = "")
    {
        // First look in path of current file
        static $_path_array = null;
        if (__DIR__) {
            $selfdir = dirname(__DIR__);
            $new_file_path = $selfdir . "/" . $file_path;
            $old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler", 0);
            if (@file_exists($new_file_path) || is_dir($new_file_path)) {
                $new_file_path = $selfdir . "/" . $file_path;
                $old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
                return true;
            }
            $old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
        }

        // else look in incude path
        if (!isset($_path_array)) {
            $_ini_include_path = get_include_path();

            if (defined("__DIR __")) {
                $selfdir = dirname(__DIR__);
            } else {
                $selfdir = dirname(dirname(__FILE__));
            }

            if (strstr($_ini_include_path, ';')) {
                $_ini_include_path = $selfdir . ";" . $_ini_include_path;
                $_path_array = explode(';', $_ini_include_path);
            } else {
                $_ini_include_path = $selfdir . ":" . $_ini_include_path;
                $_path_array = explode(':', $_ini_include_path);
            }
        }
        // Turn off Error handling for the following to avoid open_basedir errors
        $old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler", 0);
        foreach ($_path_array as $_include_path) {
            if (@file_exists($_include_path . "/" . $file_path)) {
                $new_file_path = $_include_path . "/" . $file_path;
                $old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
                return true;
            }
        }
        $old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");

        $new_file_path = $file_path;
        return false;
    }
948859
public function autoInclude()
    {
        if (!Config::inst()->get(PiwikExtension::class, 'auto_include')) {
            return false;
        }

        if (Director::is_cli()) {
            return false;
        }

        //don't include on dev/build etc...
        if ($this->isBlockedController()) {
            return false;
        }

        if ($this->isBackend() && !Config::inst()->get(PiwikExtension::class, 'include_in_backend')) {
            return false;
        }

        return true;
    }
63406
protected function hasValidQueryParams(JsonApiSerializer $serializer, Fields $fields, Included $included)
    {
        $this->validateFieldsQueryParams($serializer, $fields, 'Fields');
        $this->validateIncludeQueryParamsTypes($serializer, $included, 'Include');

        return empty($this->queryParamErrorBag);
    }
423679
private function getValidatedIncludes(iterable $includesFromParent): iterable
    {
        $ruleIndexes = $this->serializerClass::readIncludesRuleIndexes($this->getSerializedRuleSet());

        if ($ruleIndexes === null) {
            // without validation
            foreach ($includesFromParent as $path => $split) {
                yield $path => $split;
            }
        } else {
            // with validation
            $ruleIndex = $this->serializerClass::readRuleMainIndex($ruleIndexes);
            $this->validationStarts(static::PARAM_INCLUDE, $ruleIndexes);
            foreach ($includesFromParent as $path => $split) {
                $this->getCaptures()->clear();
                $this->validateAndAccumulateError($path, $ruleIndex);
                if ($this->getCaptures()->count() > 0) {
                    yield $this->readSingleCapturedValue() => $split;
                }
            }
            $this->validateEnds(static::PARAM_INCLUDE, $ruleIndexes);
        }
    }
735034
private function checkTable($table, $include, $exclude)
    {
        if(in_array($table, $exclude))
        {
            return false;
        }

        return !isset($include[0]) || in_array($table, $include);
    }
437523
public void setIncludeBody(boolean include) {
        addField(SubscribeOptionFields.include_body, FormField.Type.bool);
        setAnswer(SubscribeOptionFields.include_body.getFieldName(), include);
    }
361151
protected static function buildProjection($include = '*')
    {
        if ('*' == $include) {
            return null;
        }

        if (empty($include)) {
            $include = static::DEFAULT_ID_FIELD;
        }
        if (!is_array($include)) {
            $include = array_map('trim', explode(',', trim($include, ',')));
        }
        if (false === array_search(static::DEFAULT_ID_FIELD, $include)) {
            $include[] = static::DEFAULT_ID_FIELD;
        }

        $out = [];
        foreach ($include as $key) {
            $out[$key] = 1;
        }

        return $out;
    }
727046
protected function autoIncludeParents()
    {
        $parsed = [];

        foreach ($this->requestedIncludes as $include) {
            $nested = explode('.', $include);

            $part = array_shift($nested);
            $parsed[] = $part;

            while (count($nested) > 0) {
                $part .= '.'.array_shift($nested);
                $parsed[] = $part;
            }
        }

        $this->requestedIncludes = array_values(array_unique($parsed));
    }