Should the import be skipped?

@return boolean|null
338475
private function Skip($path, $env){

		$path = Less_Parser::AbsPath($path, true);

		if( $path && Less_Parser::FileParsed($path) ){

			if( isset($this->currentFileInfo['reference']) ){
				return true;
			}

			return !isset($this->options['multiple']) && !$env->importMultiple;
		}

	}
716691
@SuppressWarnings("resource")
    private boolean importModules() {

        boolean result = true;

        try {
            m_logStream.println("Checking module dependencies.");
            Multimap<String, String> dependencies = HashMultimap.create();
            Set<String> unsortedModules = Sets.newHashSet(m_modulesToExport);
            for (String module : m_modulesToExport) {
                String manifestPath = CmsStringUtil.joinPaths(
                    m_currentConfiguration.getModulesPath(),
                    module,
                    m_currentConfiguration.getResourcesSubFolder(),
                    "manifest.xml");
                Document doc = CmsXmlUtils.unmarshalHelper(
                    CmsFileUtil.readFully(new FileInputStream(manifestPath)),
                    new CmsXmlEntityResolver(null));

                List<?> depNodes = doc.getRootElement().selectNodes("//dependencies/dependency/@name");
                for (Object nodeObj : depNodes) {
                    Node node = ((Node)nodeObj);
                    String dependency = node.getText();
                    if (m_modulesToExport.contains(dependency)) {
                        // we can only handle dependencies between selected modules
                        // and just have to assume that other dependencies are fulfilled
                        dependencies.put(module, dependency);
                    }
                }
            }
            List<String> sortedModules = Lists.newArrayList();
            // if there are no cycles, this loop will find one element on each iteration
            for (int i = 0; i < m_modulesToExport.size(); i++) {
                String nextModule = null;
                for (String key : unsortedModules) {
                    if (dependencies.get(key).isEmpty()) {
                        nextModule = key;
                        break;
                    }
                }
                if (nextModule != null) {
                    sortedModules.add(nextModule);
                    unsortedModules.remove(nextModule);
                    for (String key : Sets.newHashSet(dependencies.keySet())) { // copy key set to avoid concurrent modification exception
                        dependencies.get(key).remove(nextModule);
                    }
                }
            }
            m_logStream.println("Modules sorted by dependencies: " + sortedModules);
            for (String moduleName : sortedModules) {
                String dir = CmsStringUtil.joinPaths(
                    m_currentConfiguration.getModulesPath(),
                    moduleName,
                    m_currentConfiguration.getResourcesSubFolder());
                File dirEntry = new File(dir);
                if (!dirEntry.exists()) {
                    continue;
                }
                try {
                    m_logStream.println("Creating temp file for module " + moduleName);
                    File outputFile = File.createTempFile(moduleName + "-", ".zip");
                    FileOutputStream fos = new FileOutputStream(outputFile);
                    m_logStream.println("Zipping module structure to " + outputFile.getAbsolutePath());
                    zipRfsFolder(dirEntry, fos);
                    result &= importModule(outputFile);
                    outputFile.delete();
                } catch (Exception e) {
                    LOG.error(e.getLocalizedMessage(), e);
                    e.printStackTrace(m_logStream);
                    result = false;
                }
            }
        } catch (Exception e) {

            LOG.error(e.getLocalizedMessage(), e);
            m_logStream.println("Unable to check dependencies for modules, giving up.");
            e.printStackTrace(m_logStream);
            result = false;
        }
        return result;
    }
657538
public function getImports()
    {
        $imports = [];
        $tokens = token_get_all(file_get_contents($this->file));
        reset($tokens);
        $token = '';
        while ($token !== false) {
            $token = next($tokens);
            if (!is_array($token)) {
                continue;
            }
            if ($token[0] === T_USE) {
                $stmt = $this->parseUseStatement($tokens);
                $imports += $stmt;
            } elseif ($token[0] === T_CLASS) {
                break;
            }
        }
        return $imports;
    }
775317
public function afterImport()
    {
        $obj = Craft::$app->globals;
        $refObject = new \ReflectionObject($obj);
        if ($refObject->hasProperty('_allGlobalSets')) {
            $refProperty1 = $refObject->getProperty('_allGlobalSets');
            $refProperty1->setAccessible(true);
            $refProperty1->setValue($obj, null);
        }
    }
1067672
public function isNewVisitor(): bool
    {
        $referer = System::getContainer()->get('request_stack')->getCurrentRequest()->headers->get('referer');
        $schemeAndHttpHost = System::getContainer()->get('request_stack')->getCurrentRequest()->getSchemeAndHttpHost();

        return null === $referer || false === preg_match('$^'.$schemeAndHttpHost.'$i', $referer);
    }
460025
private function is_importer_available() {
		require_once ABSPATH . 'wp-admin/includes/plugin.php';

		if ( class_exists( 'WP_Import' ) ) {
			return true;
		}

		$plugins            = get_plugins();
		$wordpress_importer = 'wordpress-importer/wordpress-importer.php';
		if ( array_key_exists( $wordpress_importer, $plugins ) ) {
			$error_msg = "WordPress Importer needs to be activated. Try 'wp plugin activate wordpress-importer'.";
		} else {
			$error_msg = "WordPress Importer needs to be installed. Try 'wp plugin install wordpress-importer --activate'.";
		}

		return new WP_Error( 'importer-missing', $error_msg );
	}
268572
public function importAction()
    {
        if (!$this->getRequest() instanceof ConsoleRequest) {
            throw new \RuntimeException('You can only use this action from a console!');
        }

        $filter = $this->inputFilterSearch;

        $filter->setData(
            $this->params()
                 ->fromRoute()
        );

        if ($filter->isValid() && $filter->getValue('help') == null) {
            if ($filter->getValue('confirm') == 'yes') {
                $confirm = new Confirm(
                    'Are you sure you want to Import Search Results? [y/n]',
                    'y',
                    'n'
                );

                $result = $confirm->show();
            } else {
                $result = true;
            }

            if ($result) {
                $this->serviceSearch->import();
            }
        } else {
            if ($filter->getValue('help') != null) {
                $this->getEventManager()
                     ->trigger(
                         'Mp3Help',
                         null,
                         ['help' => 'import']
                     );

                exit;
            }
        }
    }
1130576
private boolean canBeSkipped (TypeRef importedClass) {
		// skip known imported classes and the ones in JRE
		if (allReferencedTypes.contains(importedClass) || importedReferencedTypes.contains(importedClass) || importedClass.isJava())
			return true;
		// Skip the imported classes which are excluded 
		String classPackage = importedClass.getPackageRef().getFQN();
		for (String excludePrefix: excludePrefixes) {		// skip by the package prefix
			if (classPackage.startsWith(excludePrefix))
				return true;
		}
		if (excludes.contains(classPackage))				// skip by the full package name
			return true;
		return classPackage.length()<2;						// special situation for the primitive array 
	}
155944
public function import()
    {
        try {
            ini_set(
                'max_execution_time',
                '0'
            );

            clearstatcache();

            if (is_dir($this->getSearchPath())) {
                $searchPath = new \RecursiveDirectoryIterator(
                    $this->getSearchPath(),
                    \FilesystemIterator::FOLLOW_SYMLINKS
                );

                $searchFile = $this->getSearchFile();

                clearstatcache();

                if (!touch($searchFile)) {
                    throw new \Exception(
                        $searchFile . ' ' . $this->translate->translate(
                            'could not be created',
                            'mp3'
                        )
                    );
                }

                if (is_file($searchFile)) {
                    $handle = fopen(
                        $searchFile,
                        'w'
                    );

                    if (is_writable($searchFile)) {
                        if (!$handle) {
                            throw new \Exception(
                                $this->translate->translate('Cannot Open File') . ': ' . $searchFile
                            );
                        }
                    } else {
                        throw new \Exception(
                            $this->translate->translate('File Is Not Writable') . ': ' . $searchFile
                        );
                    }

                    $array = [];

                    /**
                     * @var \RecursiveDirectoryIterator $current
                     */
                    foreach (new \RecursiveIteratorIterator($searchPath) as $current) {
                        $basePathName = basename($current->getPathname());

                        if ($basePathName != '..') {
                            $fileExtension = substr(
                                strrchr(
                                    $basePathName,
                                    '.'
                                ),
                                1
                            );

                            clearstatcache();

                            /**
                             * Directory
                             */
                            if (is_dir($current->getPathname())) {
                                $directoryName = substr(
                                    $current->getPathName(),
                                    0,
                                    -2
                                );

                                $replaceDirectory = str_replace(
                                    $this->getSearchPath(),
                                    '',
                                    $directoryName
                                );

                                $directoryTrim = ltrim(
                                    $replaceDirectory,
                                    '/'
                                );

                                $array[] = $directoryTrim;
                            }

                            /**
                             * File
                             */
                            if (is_file($current->getPathname()) && in_array(
                                    '.' . $fileExtension,
                                    $this->getExtensions()
                                )
                            ) {
                                $fileName = $current->getPathname();

                                $replaceFileName = str_replace(
                                    $this->getSearchPath(),
                                    '',
                                    $fileName
                                );

                                $fileNameTrim = ltrim(
                                    $replaceFileName,
                                    '/'
                                );

                                $array[] = $fileNameTrim;
                            }
                        }
                    }

                    $result = array_unique($array);

                    sort($result);

                    fwrite(
                        $handle,
                        serialize($result)
                    );

                    fclose($handle);
                } else {
                    throw new \Exception(
                        $searchFile . ' ' . $this->translate->translate(
                            'was not found',
                            'mp3'
                        )
                    );
                }
            } else {
                throw new \Exception(
                    $this->getBaseDir() . ' ' . $this->translate->translate(
                        'was not found',
                        'mp3'
                    )
                );
            }
        } catch (\Exception $e) {
            echo $e->getMessage();
            throw $e;
        }
    }
263513
public function isSupported()
    {
        $row = $this->getMixer();

        if($row instanceof DatabaseRowInterface)
        {
            if(!$row->hasProperty($this->_parent_column))  {
                return false;
            }
        }

        return true;
    }
434466
public function check(): bool
    {
        return $this->installable = $this->items->filter(function ($specification) {
            return $specification->check() === false && $specification->optional() === false;
        })->isEmpty();
    }
191
public function skipDiscounts()
    {
        // already loaded skip discounts config
        if ($this->_blSkipDiscounts !== null) {
            return $this->_blSkipDiscounts;
        }

        if ($this->oxarticles__oxskipdiscounts->value) {
            return true;
        }


        $this->_blSkipDiscounts = false;
        if (\OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DiscountList::class)->hasSkipDiscountCategories()) {
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            $sO2CView = getViewName('oxobject2category', $this->getLanguage());
            $sViewName = getViewName('oxcategories', $this->getLanguage());
            $sSelect = "select 1 from $sO2CView as $sO2CView left join {$sViewName} on {$sViewName}.oxid = $sO2CView.oxcatnid
                         where $sO2CView.oxobjectid=" . $oDb->quote($this->getId()) . " and {$sViewName}.oxactive = 1 and {$sViewName}.oxskipdiscounts = '1' ";
            $this->_blSkipDiscounts = ($oDb->getOne($sSelect) == 1);
        }

        return $this->_blSkipDiscounts;
    }
42616
private function _calcularImporteNeto(){
            if (!empty($this->data['Gasto']['Impuesto']) && empty($this->data['Gasto']['importe_neto'])) {
                if (!empty($this->data['Gasto']['Impuesto'])) {
                    foreach ($this->data['Gasto']['Impuesto'] as $imp){
                        $this->data['Gasto']['importe_neto'] += $imp['neto'];
                    }
                }
            }
        }
1204057
public function checkIntegrity()
    {
        $combine = array_merge(['put' => array_diff_assoc($_SESSION, $this->sessionHandler->all())],['forget' => array_keys(array_diff_assoc($this->sessionHandler->all(), $_SESSION))]);
        if ($combine) {
            foreach($combine as $method => $dataArray) {
                if (!empty($dataArray)) {
                    $this->sessionHandler->$method($dataArray);
                }
            }
        }
        return true;
    }
661106
public function import()
    {
        \DB::beginTransaction();

        try {
            $imported = ($this->insertRole()) ?: false;
            $imported = ($this->insertService()) ?: $imported;
            $imported = ($this->insertRoleServiceAccess()) ?: $imported;
            $imported = ($this->insertApp()) ?: $imported;
            $imported = ($this->insertUser()) ?: $imported;
            $imported = ($this->insertUserAppRole()) ?: $imported;
            $imported = ($this->insertOtherResource()) ?: $imported;
            $imported = ($this->insertEventScripts()) ?: $imported;
            $imported = ($this->storeFiles()) ?: $imported;
            $imported = ($this->overwrote) ?: $imported;
        } catch (\Exception $e) {
            \DB::rollBack();
            \Log::error('Failed to import package. Rolling back. ' . $e->getMessage());

            throw $e;
        }

        \DB::commit();

        return $imported;
    }
818829
public function main()
    {
        $this->info('Task: import system groups');
        $this->hr();

        $systemGroups = Configure::read('Groups.systemGroups');
        if (empty($systemGroups)) {
            $this->warn("System groups are not configured.  Nothing to do.");

            return true;
        }

        // get groups table
        $table = TableRegistry::get('Groups.Groups');

        foreach ($systemGroups as $group) {
            if (empty($group['name'])) {
                $this->warn("Skipping group without a name.");
                continue;
            }

            if ($table->exists(['name' => $group['name']])) {
                $this->warn("Group [" . $group['name'] . "] already exists. Skipping.");
                continue;
            }

            $this->info("Group [" . $group['name'] . "] does not exist. Creating.");
            $entity = $table->newEntity();
            $entity = $table->patchEntity($entity, $group);
            $result = $table->save($entity);
            if (!$result) {
                $this->err("Errors: \n" . implode("\n", $this->getImportErrors($entity)));
                $this->abort("Failed to create group [" . $group['name'] . "]");
            }
        }

        $this->success('System groups imported successfully');
    }
1325811
public function startImport()
    {
        if ($this->_targetModel instanceof \MUtil_Model_ModelAbstract) {
            // No multiOptions as a new items can be created during import
            $fields = array(
                'gap_id_attended_by', 'gap_id_referred_by', 'gap_id_activity',  'gap_id_procedure', 'gap_id_location',
                );
            foreach ($fields as $name) {
                $this->_targetModel->del($name, 'multiOptions');
            }
        }

        return parent::startImport();
    }