@param string[] $bitList

@return int[]
@throws \Exception
167950
public static function getNormalized(array $bitList)
    {
        $bitListNormalized = [];
        foreach ($bitList as $bitRow) {
            $matches = [];
            preg_match('/^(?<first>[\d]+)(-(?<second>[\d]+))?$/', (string)$bitRow, $matches);
            if (empty($matches)) {
                throw new WrongBitMappingRule("Incorrect Bit syntax: '{$bitRow}'");
            }

            if (!isset($matches['second'])) {
                if (isset($bitListNormalized[$matches['first']])) {
                    throw new WrongBitMappingRule('You can`t add "-" after number.');
                }
                $bitListNormalized[$matches['first']] = (int)$matches['first'];
                continue;
            }

            if ($matches['first'] > $matches['second']) {
                throw new WrongBitMappingRule("Start bit zone should be greater than end. But got: {$matches['first']} - {$matches['second']}");
            }
            if (!is_numeric($matches['first']) || !is_numeric($matches['second'])) {
                throw new WrongBitMappingRule("Start and end of zone should be numbers, but got: {$matches['first']} - {$matches['second']}");
            }

            for ($i = (int)$matches['first'], $end = $matches['second']; $i <= $end; $i++) {
                if (isset($bitListNormalized[$i])) {
                    throw new WrongBitMappingRule("Bit {$bitListNormalized[$i]} used more than once");
                }
                $bitListNormalized[$i] = $i; // Bits started from 1, but in array we start working with 0
            }
        }

        return array_values($bitListNormalized);
    }
1102365
private function convertNodeListToArray(DOMNodeList $nodeList)
    {
      $array = array();

      if(!is_null($nodeList) && $nodeList->length > 0)
      {
         foreach($nodeList as $node)
           array_push($array, $node);
      }

      return $array;
    }
929914
private function preloadDependencies(array $nodeList)
    {
        $userIdList = [];
        $siteIdList = [];

        foreach ($nodeList as $node) {
            $userIdList[$node->uid] = $node->uid;
            foreach ($node->ucms_sites as $siteId) {
                $siteIdList[$siteId] = $siteId;
            }
        }

        if ($userIdList) {
            $this->entityManager->getStorage('user')->loadMultiple($userIdList);
        }
        if ($siteIdList) {
            $this->manager->getStorage()->loadAll($siteIdList);
        }
    }
1031262
public static function bitToIndex(int $mask): int
    {
        if (!self::isSingleBit($mask)) {
            throw new \InvalidArgumentException('Must be single bit');
        }
        return (int)log($mask, 2);
    }
402178
public function bulkIndex(array $contentList, callable $errorCallback)
    {
        $fullTextBulkData = [];
        foreach ($contentList as $content) {
            try {
                $fullTextBulkData[] = $this->mapper->mapContent($content);
            } catch (NotFoundException $e) {
                $errorCallback($content, $e);
            }
        }

        $this->indexerGateway->bulkIndex($fullTextBulkData);
    }
254295
public function rawlist($directory)
    {
        $list = ftp_rawlist($this->connection, $directory);
        if (!$list) {
            throw new \Exception("Could raw list files in remote directory: " . $directory);
        }

        return $list;
    }
1055781
public List<BitmexPrivateOrder> getBitmexOrders() throws ExchangeException {
    return getBitmexOrders(null, null, null, null, null);
  }
1269903
public function nlist($directory)
    {
        $list = ftp_nlist($this->connection, $directory);
        if (!$list) {
            throw new \Exception("Could list files in remote directory: " . $directory);
        }

        return $list;
    }
940521
protected function filterList($list)
    {
        $conf = Configuration::getConfig(self::CONFIG_FILE_NAME);
        $disableWhitelisting
            = $conf->getBoolean(self::PROPNAME_DISABLE_WHITELISTING, false);

        if (!isset($this->originalsp['disco.doNotFilterIdps'])
            || !$this->originalsp['disco.doNotFilterIdps']
        ) {
            $list = parent::filterList($list);
            $list = $this->scoping($list);
            if (!$disableWhitelisting) {
                $list = $this->whitelisting($list);
            }
            $list = $this->greylisting($list);
            $list = $this->greylistingPerSP($list, $this->originalsp);
        }

        if (empty($list)) {
            throw new Exception('All IdPs has been filtered out. And no one left.');
        }

        return $list;
    }
1256530
private function countMergeCommits(array $commitList)
    {
        $count = 0;
        foreach ($commitList as $filePathCommit) {
            if (!$this->isMergeCommit($filePathCommit)) {
                continue;
            }

            $count++;
        }

        return $count;
    }
1327016
public function listFiles($directory)
    {
        $writeBinn= new BinnList;

        $writeBinn->addUint8(self::FSERV_READDIR);
        $writeBinn->addStr($directory);     // Dir path
        $writeBinn->addUint8(0);       // Mode

        $read = $this->writeAndReadSocket($writeBinn->serialize());

        $readBinn = new BinnList;

        $readBinn->binnOpen($read);
        $results = $readBinn->unserialize();

        if ($results[0] != self::FSERV_STATUS_OK) {
            // Error
            throw new RuntimeException('GDaemon List files error:' . isset($results[1]) ? $results[1] : 'Unknown');
        }

        $filesList = $results[2];
        $returnList = [];

        foreach($filesList as &$file) {

            if (in_array(basename($file[0]), ['.', '..'])) {
                continue;
            }

            $returnList[] = basename($file[0]);
        }

        return $returnList;
    }
989938
public function arrangePermissionList($fileList)
    {
        $betterList = array();
        foreach ($fileList as $fileName) {

            $pathInfo = pathinfo($fileName);
            $dirname = $pathInfo['dirname'];

            $currentPath = $fileName;
            if ($this->getSearchCount($dirname, $fileList) > 1) {
                $currentPath = $dirname;
            }

            if (!$this->isItemIncludes($currentPath, $betterList)) {
                $betterList[] = $currentPath;
            }
        }

        return $betterList;
    }
185207
public function addSites(array $list) : int
    {
        $count = $this->getObjectsCount();
        $nb_customer = $this->getCustomer();

        foreach ($list as $item) {
            if (!($item instanceof CNabuSite) &&
                is_numeric($nb_site_id = nb_getMixedValue($item, NABU_SITE_FIELD_ID))
            ) {
                $nb_site = $nb_customer->getSite($nb_site_id);
                if (!$nb_site instanceof CNabuSite) {
                    throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
                }
            } elseif ($item instanceof CNabuSite) {
                $nb_site = $item;
                if (!$nb_site->validateCustomer($nb_customer)) {
                    throw new ENabuSecurityException(ENabuSecurityException::ERROR_CUSTOMER_NOT_OWNER);
                }
            } else {
                throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
            }

            $nb_site->refresh(true, true);
            $this->nb_site_list->addItem($nb_site);
            $this->nb_language_list->merge($nb_site->getLanguages(true));
            $this->nb_role_list->merge($nb_site->getRoles(true));
        }

        return $this->getObjectsCount() - $count;
    }
303773
public static function serial($bitFrame)
    {
        $codeArr = array();

        foreach ($bitFrame as $line)
            $codeArr[] = join('', $line);

        return gzcompress(join("\n", $codeArr), 9);
    }
328306
protected function getMpftMap($bitfield) {
		$result = array();

		// loop until last '1' bit
		$bit = 0;
		while((1 << $bit) <= $bitfield){
			if($bitfield & (1 << $bit)){
				$result[$bit] = $this->getMpftName($bit);
			}
			$bit++;
		}
		return $result;
	}
704466
public function toBytes(int $bitOffset, int $numBytes) : SplFixedArray
    {
        $bytes = new SplFixedArray($numBytes);

        for ($i = 0; $i < $numBytes; ++$i) {
            $byte = 0;

            for ($j = 0; $j < 8; ++$j) {
                if ($this->get($bitOffset)) {
                    $byte |= 1 << (7 - $j);
                }

                ++$bitOffset;
            }

            $bytes[$i] = $byte;
        }

        return $bytes;
    }
895792
private function searchOverridenParameters(array $parametersList): array
    {
        $parametersUsageCount = [];

        foreach ($parametersList as $list) {
            foreach ($list as $parameter => $_value) {
                if (!isset($parametersUsageCount[$parameter])) {
                    $parametersUsageCount[$parameter] = 0;
                }

                $parametersUsageCount[$parameter] += 1;
            }
        }

        $overriddenParameters = array_filter($parametersUsageCount, function ($count) {
            return $count > 1;
        });

        return array_keys($overriddenParameters);
    }