Return if the extractor can extract the requested data or not.

@param $source
@param $type
@param ExtractionContextInterface $extractionContext
@return boolean
965794
public function canExtract($source, $type, ExtractionContextInterface $extractionContext)
    {
        if (!$source instanceof ContainerInterface) {
            return false;
        }

        if (!$type instanceof SwaggerSchema) {
            return false;
        }

        return true;
    }
869835
public function canExtract($source, $type, ExtractionContextInterface $extractionContext)
    {
        if (!$type instanceof Schema) {
            return false;
        }

        if (!$source instanceof ReflectionClass) {
            return false;
        }

        $constraints = $this->getPropertiesConstraints(
            $source,
            $type,
            $this->getValidationGroups($extractionContext)
        );

        return count($constraints);
    }
510535
public function canExtract($source, $target, ExtractionContextInterface $extractionContext)
    {
        if (!$target instanceof SupportedTarget) {
            return false;
        }

        if (is_null(self::getPrimitiveType($source))) {
            return false;
        }

        return true;
    }
339997
protected static function executeFields(ExecutionContext $context, ObjectType $parent, $source, $fields)
    {
        return self::executeFieldsSerially($context, $parent, $source, $fields);
    }
1288917
public function setExtractionMode($extractionMode = null)
    {
        if (null === $extractionMode) {
            $this->extractionMode = static::MODE_ALLOW_ICANN
                | static::MODE_ALLOW_PRIVATE
                | static::MODE_ALLOW_NOT_EXISTING_SUFFIXES;

            return;
        }

        if (!is_int($extractionMode)) {
            throw new RuntimeException('Invalid argument type, extractionMode must be integer');
        }

        if (!in_array($extractionMode, [
            static::MODE_ALLOW_ICANN,
            static::MODE_ALLOW_PRIVATE,
            static::MODE_ALLOW_NOT_EXISTING_SUFFIXES,
            static::MODE_ALLOW_ICANN | static::MODE_ALLOW_PRIVATE,
            static::MODE_ALLOW_ICANN | static::MODE_ALLOW_NOT_EXISTING_SUFFIXES,
            static::MODE_ALLOW_ICANN | static::MODE_ALLOW_PRIVATE | static::MODE_ALLOW_NOT_EXISTING_SUFFIXES,
            static::MODE_ALLOW_PRIVATE | static::MODE_ALLOW_NOT_EXISTING_SUFFIXES
        ], true)
        ) {
            throw new RuntimeException(
                'Invalid argument type, extractionMode must be one of defined constants of their combination'
            );
        }

        $this->extractionMode = $extractionMode;
    }
116439
public boolean shouldBeExcluded(final Class<?> type, final RandomizerContext context) {
        Set<Predicate<Class<?>>> typeExclusionPredicates = context.getParameters().getTypeExclusionPredicates();
        for (Predicate<Class<?>> typeExclusionPredicate : typeExclusionPredicates) {
            if (typeExclusionPredicate.test(type)) {
                return true;
            }
        }
        return false;
    }
752226
public function getSource(OperationContextInterface $context = null)
    {
        $sourceId = $this->getSourceId();
        if ($sourceId === null) {
            return null;
        }
        $context = $this->ensureContext($context);

        return $this->getSession()->getObject($sourceId, $context);
    }
935014
public static function zipExtract(String $source, String $target = NULL) : Bool
    {
        $source = Info::rpath($source);
        $target = Info::rpath($target);

        $source = Base::suffix($source, '.zip');

        if( ! file_exists($source) )
        {
            throw new Exception\FileNotFoundException(NULL, $source);
        }

        if( empty($target) )
        {
            $target = Extension::remove($source);
        }

        $zip = new ZipArchive;

        if( $zip->open($source) === true )
        {
            $zip->extractTo($target);
            $zip->close();

            return true;
        }
        else
        {
            return false;
        }
    }
1101559
protected function extractRdata(array $resourceRecord, int $type, string $parent)
    {
        switch ($type) {
            case RecordTypeEnum::TYPE_A:
            case RecordTypeEnum::TYPE_AAAA:
                return $resourceRecord['address'];
            case RecordTypeEnum::TYPE_NS:
            case RecordTypeEnum::TYPE_CNAME:
            case RecordTypeEnum::TYPE_PTR:
                return $this->handleName($resourceRecord['target'], $parent);
            case RecordTypeEnum::TYPE_SOA:
                return [
                    'mname' => $this->handleName($resourceRecord['mname'], $parent),
                    'rname' => $this->handleName($resourceRecord['rname'], $parent),
                    'serial' => $resourceRecord['serial'],
                    'refresh' => $resourceRecord['refresh'],
                    'retry' => $resourceRecord['retry'],
                    'expire' => $resourceRecord['expire'],
                    'minimum' => $resourceRecord['minimum'],
                ];
            case RecordTypeEnum::TYPE_MX:
                return [
                    'preference' => $resourceRecord['preference'],
                    'exchange' => $this->handleName($resourceRecord['exchange'], $parent),
                ];
            case RecordTypeEnum::TYPE_TXT:
                return $resourceRecord['text'];
            case RecordTypeEnum::TYPE_SRV:
                return [
                    'priority' => (int) $resourceRecord['priority'],
                    'weight' => (int) $resourceRecord['weight'],
                    'port' => (int) $resourceRecord['port'],
                    'target' => $this->handleName($resourceRecord['target'], $parent),
                ];
            case RecordTypeEnum::TYPE_AXFR:
            case RecordTypeEnum::TYPE_ANY:
                return '';
            default:
                throw new UnsupportedTypeException(
                    sprintf('Resource Record type "%s" is not a supported type.', RecordTypeEnum::getName($type))
                );
        }
    }
746289
public function extract() {
        $zip = new ZipArchive();

        $res = $zip->open($this->_sourcePath);
        if ($res === true) {
            $zip->extractTo($this->_workingDir);
            $zip->close();
        } else {
            throw new Exception('Could not open archive ' . $this->_sourcePath);
        }
    }
1018751
private function allowedTypeExist(string $type):bool
    {
        foreach ($this->allowed_text_render as $one) {
            if ($one["type"] === $type) {
                return (true);
            }
        }
        return (false);
    }
1019117
public function extract($source)
    {
        $tmpDirectory = null;

        $this->assertSourceAsFile($source);
        $folder = \tao_helpers_File::createTempDir();
        $zip = new ZipArchive();
        if ($zip->open($source) === true) {
            if (\tao_helpers_File::checkWhetherArchiveIsBomb($zip)) {
                throw new PortableElementExtractException(sprintf('Source %s seems to be a ZIP bomb', $source));
            }
            if($zip->extractTo($folder)){
                $tmpDirectory = $folder;
            }
            $zip->close();
        }

        if (! is_dir($tmpDirectory)) {
            throw new PortableElementExtractException('Unable to extract portable element.');
        }

        return $tmpDirectory;
    }
464475
public function canHandle($type, $namespace)
   {
      # no type; namespace must match
      if ($type === null) {
         if ($this->namespace === null || $namespace !== $this->namespace) {
            return false;
         }
      }
      else {
         if ($this->type !== $type) {
            return false;
         }
         else if ($namespace !== null && $this->namespace !== $namespace) {
            return false;
         }
         else if ($namespace === null && $this->namespace !== null) {
            return false;
         }
      }

      return true;
   }
1350272
public function hasInSource( $key, $source )
	{
		$source	= strtolower( $source );
		return isset( $this->sources[$source][$key] );
	}
1162143
protected function extractNodeType($targetType, array $source)
    {
        if (isset($source['__nodeType'])) {
            $nodeTypeName = $source['__nodeType'];
        } else {
            $matches = [];
            preg_match(self::EXTRACT_CONTENT_TYPE_PATTERN, $targetType, $matches);
            if (isset($matches['nodeType'])) {
                $nodeTypeName = $matches['nodeType'];
            } else {
                $nodeTypeName = 'unstructured';
            }
        }
        return $this->nodeTypeManager->getNodeType($nodeTypeName);
    }
839924
public function isValidSourceId($source) {
        $this->sError = FALSE;

        if ($this->_source === FALSE) {
            $this->_loadSources();
        }
        if (!isset($this->_source[$source])) {
            $this->sError = 'Incorect source id: ' . $source;
            return FALSE;
        }

        return TRUE;
    }
711471
public function appliesToContext(ContextInterface $context): bool
    {
        if (!$context instanceof TypeContext && !$context instanceof PropertyContext) {
            return false;
        }

        $type = $context->getType();
        if (!preg_match($this->regex, $type->getName())) {
            return false;
        }


        return $this->subRule->appliesToContext($context);
    }