Linia raportująca
485257
protected function _reportLine($fileName)
    {
        echo $fileName . ' - ' . round($this->_size / 1024 / 1024,
                2) . 'MB in ' . $this->_count . ' files - found: ' . $this->_found . "\n";
    }
498328
private function createMinifyAssetsLib()
    {
        Helper::createFolderIfNoExist(PATH_HOME . 'assetsPublic/cache');
        Helper::createFolderIfNoExist(PATH_HOME . 'assetsPublic/view');

        //Remove todos os dados das pastas de assets
        foreach (Helper::listFolder(PATH_HOME . "assetsPublic/cache") as $cache) {
            if(!is_dir(PATH_HOME . "assetsPublic/cache/" . $cache))
                unlink(PATH_HOME . "assetsPublic/cache/" . $cache);
        }
        foreach (Helper::listFolder(PATH_HOME . "assetsPublic/view") as $cache) {
            if(!is_dir(PATH_HOME . "assetsPublic/view/" . $cache))
                unlink(PATH_HOME . "assetsPublic/view/" . $cache);
        }

        $vendors = Config::getViewPermissoes();
        $this->createRepositorioCache($vendors);
        $this->downloadAssetsCache($vendors);

        foreach ($vendors as $lib) {
            $path = PATH_HOME . VENDOR . $lib . "/public/";
            if (file_exists($path . "view")) {
                foreach (Helper::listFolder($path . "view") as $view) {
                    if (preg_match('/.php$/i', $view)) {

                        //para cada view
                        $nameView = str_replace('.php', '', $view);

                        if(!in_array($nameView, ['updateSystema']))
                            $this->createViewAssets($path, $nameView);
                    }
                }
            }
        }
    }
1022458
protected function executeLint($linter, $input, $output, $fileCount)
    {
        $cache = !$input->getOption('no-cache');
        $maxColumns = floor((new Terminal())->getWidth() / 2);
        $verbosity = $output->getVerbosity();
        $displayProgress = !$input->getOption('no-progress');

        $displayProgress && $linter->setProcessCallback(function ($status, SplFileInfo $file) use ($output, $verbosity, $fileCount, $maxColumns) {
            static $i = 1;

            $percent = floor(($i / $fileCount) * 100);
            $process = str_pad(" {$i} / {$fileCount} ({$percent}%)", 18, ' ', STR_PAD_LEFT);

            if ($verbosity >= OutputInterface::VERBOSITY_VERBOSE) {
                $filename = str_pad(" {$i}: ".$file->getRelativePathname(), $maxColumns - 10, ' ', \STR_PAD_RIGHT);
                $status = \str_pad(('ok' === $status ? '<info>OK</info>' : '<error>Error</error>'), 20, ' ', \STR_PAD_RIGHT);
                $output->writeln(\sprintf("%s\t%s\t%s", $filename, $status, $process));
            } else {
                if ($i && 0 === $i % $maxColumns) {
                    $output->writeln($process);
                }
                $output->write('ok' === $status ? '<info>.</info>' : '<error>E</error>');
            }
            ++$i;
        });

        $displayProgress || $output->write('<info>Checking...</info>');

        return $linter->lint([], $cache);
    }
1233294
public function beforeSave()
    {
        //czyszczenie uprawnień dla roli
        (new \Cms\Orm\CmsCategoryAclQuery)
            ->whereCmsRoleId()->equals($this->getOption('roleId'))
            ->find()
            ->delete();
        //zapis uprawnień "dozwól"
        foreach (explode(';', $this->getElement('allow')->getValue()) as $categoryId) {
            //brak kategorii
            if (!$categoryId) {
                continue;
            }
            $aclRecord = new \Cms\Orm\CmsCategoryAclRecord;
            $aclRecord->access = 'allow';
            $aclRecord->cmsCategoryId = $categoryId;
            $aclRecord->cmsRoleId = $this->getOption('roleId');
            $aclRecord->save();
        }
        //zapis uprawnień "zabroń"
        foreach (explode(';', $this->getElement('deny')->getValue()) as $categoryId) {
            //brak kategorii
            if (!$categoryId) {
                continue;
            }
            $aclRecord = new \Cms\Orm\CmsCategoryAclRecord;
            $aclRecord->access = 'deny';
            $aclRecord->cmsCategoryId = $categoryId;
            $aclRecord->cmsRoleId = $this->getOption('roleId');
            $aclRecord->save();
        }
        //usunięcie cache
        \App\Registry::$cache->remove('mmi-cms-category-acl');
        return true;
    }
706840
public function renderRowDefinition(PHPRtfLite_Table_Row $row)
    {
        $rowIndex = $row->getRowIndex();
        $stream = $this->getRtf()->getWriter();
        $stream->write('\trowd');

        if ($this->_alignment) {
            switch ($this->_alignment) {
                case self::ALIGN_CENTER:
                    $stream->write('\trqc');
                    break;

                case self::ALIGN_RIGHT:
                    $stream->write('\trqr');
                    break;

                default:
                    $stream->write('\trql');
                    break;
            }
        }

        $rowHeight = $row->getHeight();
        if ($rowHeight) {
            $stream->write('\trrh' . PHPRtfLite_Unit::getUnitInTwips($rowHeight));
        }

        if ($this->isPreventPageBreak()) {
            $stream->write('\trkeep ');
        }

        if ($this->isFirstRowHeader() && $rowIndex == 1) {
            $stream->write('\trhdr ');
        }

        if ($this->getLeftPosition() != '') {
            $stream->write('\trleft' . PHPRtfLite_Unit::getUnitInTwips($this->getLeftPosition()) . ' ');
        }

        $width = 0;
        foreach ($this->getColumns() as $columnIndex => $column) {
            $cell = $this->getCell($rowIndex, $columnIndex + 1);

            // render cell definition
            if (!$cell->isHorizontalMerged()) {
                $cell->renderDefinition();

                // cell width
                $width += PHPRtfLite_Unit::getUnitInTwips($cell->getWidth());
                $stream->write('\cellx' . $width);
            }
        }
    }
1315184
public function listarEventosHistDoc($rut, $dv, $dte, $folio)
    {
        // consultar eventos del DTE
        $r = $this->request('listarEventosHistDoc', [
            'rutEmisor' => $rut,
            'dvEmisor' => $dv,
            'tipoDoc' => $dte,
            'folio' => $folio,
        ]);
        // si no se pudo recuperar error
        if ($r===false) {
            return false;
        }
        // si hubo error informar
        if (!in_array($r->codResp, [8, 15, 16])) {
            throw new \Exception($r->descResp);
        }
        // entregar eventos del DTE
        $eventos = [];
        if (!empty($r->listaEventosDoc)) {
            if (!is_array($r->listaEventosDoc)) {
                $r->listaEventosDoc = [$r->listaEventosDoc];
            }
            foreach ($r->listaEventosDoc as $evento) {
                $eventos[] = [
                    'codigo' => $evento->codEvento,
                    'glosa' => $evento->descEvento,
                    'responsable' => $evento->rutResponsable.'-'.$evento->dvResponsable,
                    'fecha' => $evento->fechaEvento,
                ];
            }
        }
        return $eventos;
    }
822348
public function segmentoR(BoletoContract $boleto)
    {
        $this->iniciaDetalhe();
        $this->add(1, 3, Util::onlyNumbers($this->getCodigoBanco()));
        $this->add(4, 7, '0001');
        $this->add(8, 8, '3');
        $this->add(9, 13, Util::formatCnab('9', $this->iRegistrosLote, 5));
        $this->add(14, 14, 'R');
        $this->add(15, 15, '');
        $this->add(16, 17, self::OCORRENCIA_REMESSA);
        if ($boleto->getStatus() == $boleto::STATUS_BAIXA) {
            $this->add(16, 17, self::OCORRENCIA_PEDIDO_BAIXA);
        }
        if ($boleto->getStatus() == $boleto::STATUS_ALTERACAO) {
            $this->add(16, 17, self::OCORRENCIA_ALT_OUTROS_DADOS);
        }
        if ($boleto->getStatus() == $boleto::STATUS_ALTERACAO_DATA) {
            $this->add(16, 17, self::OCORRENCIA_ALT_VENCIMENTO);
        }
        if ($boleto->getStatus() == $boleto::STATUS_CUSTOM) {
            $this->add(16, 17, sprintf('%2.02s', $boleto->getComando()));
        }
        $this->add(18, 18, '0');
        $this->add(19, 26, '00000000');
        $this->add(27, 41, '000000000000000');
        $this->add(42, 42, '0');
        $this->add(43, 50, '00000000');
        $this->add(51, 65, '000000000000000');
        $this->add(66, 66, $boleto->getMulta() > 0 ? '2' : '0'); //0 = ISENTO | 1 = VALOR FIXO | 2 = PERCENTUAL
        $this->add(67, 74, $boleto->getDataVencimento()->format('dmY'));
        $this->add(75, 89, Util::formatCnab('9', $boleto->getMulta(), 15, 2));  //2,20 = 0000000000220
        $this->add(90, 199, '');
        $this->add(200, 207, '00000000');
        $this->add(208, 210, '000');
        $this->add(211, 215, '00000');
        $this->add(216, 216, '');
        $this->add(217, 228, '000000000000');
        $this->add(229, 230, '');
        $this->add(231, 231, '0');
        $this->add(232, 240, '');

        return $this;
    }
764088
public function save()
    {
        //iteracja po polach
        foreach (($data = ($this->data instanceof DataObject) ? $this->data->toArray() : []) as $field => $value) {
            //usuwanie pustych pól
            if ($value === null) {
                unset($data[$field]);
            }
        }
        //zapis json'a
        $this->data = empty($data) ? null : json_encode($data);
        return parent::save();
    }
688318
public function compile($pharOutputPath, $binPath)
    {
        $pharBaseName = basename($pharOutputPath);

        // Delete the phar file if it already exists.
        if (file_exists($pharOutputPath)) {
            unlink($pharOutputPath);
        }

        $phar = $this->initialisePhar($pharOutputPath, 0, $pharBaseName);
        $phar->startBuffering();

        foreach ($this->files as $file) {
            $this->addFileToPhar($file, $phar);
        }

        $this->addFileToPhar($binPath, $phar);

        $phar->setStub($this->createStub($pharBaseName, $binPath));
        $phar->stopBuffering();
    }
897009
public function processarLinha($numLn, Stringy $linha)
    {
        $tamLinha = 400; //total de caracteres das linhas do arquivo
        //o +2 é utilizado para contar o \r\n no final da linha
        if (strlen($linha) != $tamLinha && strlen($linha) != $tamLinha + 2) {
            throw new InvalidPositionException("A linha $numLn não tem $tamLinha posições. Possui " . strlen($linha));
        }

        if (trim($linha) == "") {
            throw new EmptyLineException("A linha $numLn está vazia.");
        }

        //é adicionado um espaço vazio no início_linha para que
        //possamos trabalhar com índices iniciando_1, no lugar_zero,
        //e assim, ter os valores_posição_campos exatamente
        //como no manual CNAB400
        $linha = $linha->insert(" ", 0);
        $tipoLn = $linha->substr(1, 1)->trim();

        $this->needToCreateLote = false;
        if ((string)$tipoLn == static::HEADER_ARQUIVO) {
            $this->needToCreateLote = true;
            $vlinha = $this->processarHeaderArquivo($linha);
        } elseif ((string)$tipoLn == static::DETALHE) {
            $vlinha = $this->processarDetalhe($linha);
        } elseif ((string)$tipoLn == static::TRAILER_ARQUIVO) {
            $vlinha = $this->processarTrailerArquivo($linha);
        } else {
            $vlinha = null;
        }
        return $vlinha;
    }
1298122
public function inserirDetalhe($linhaTxt){

		$class = 'CnabPHP\resources\\'.RetornoAbstract::$banco.'\retorno\\'.RetornoAbstract::$layout.'\Registro3T';
		self::addChild(new $class($linhaTxt));
		RetornoAbstract::$linesCounter++;
		//self::$counter++;
	}
509122
private function _buildTree(array &$tree, array $parents, array $orderedCategories, CmsCategoryRecord $parentCategory = null)
    {
        //uzupełnienie rodziców
        if ($parentCategory !== null) {
            $parents[$parentCategory->id] = $parentCategory;
        } else {
            $parentCategory = new CmsCategoryRecord;
            $parentCategory->id = null;
        }
        /* @var $categoryRecord CmsCategoryRecord */
        foreach ($orderedCategories as $key => $categoryRecord) {
            //niezgodny rodzic
            if ($categoryRecord->parentId != $parentCategory->id) {
                continue;
            }
            //dodawanie do płaskiej listy
            $this->_flatCategories[$categoryRecord->id] = $categoryRecord;
            //usuwanie wykorzystanego rekordu kategorii
            unset($orderedCategories[$key]);
            //zapis do drzewa
            $tree[$categoryRecord->id] = [];
            $tree[$categoryRecord->id]['record'] = $categoryRecord->setOption('parents', $parents);
            $tree[$categoryRecord->id]['children'] = [];
            //zejście rekurencyjne do dzieci
            $this->_buildTree($tree[$categoryRecord->id]['children'], $parents, $orderedCategories, $categoryRecord);
        }
    }
232344
protected function processarDetalhe($linha)
    {
        $detail = $this->createDetail();

        $bancoEmissor = new Banco();
        $bancoEmissor
            ->setAgencia(substr($linha, 22, 1))
            ->setDvAgencia(substr($linha, 31, 1))
            ->setConta(substr($linha, 23, 8))
            ->setDvConta(substr($linha, 31, 1));

        $bancoRecebedor = new Banco();
        $bancoRecebedor
            ->setCod(substr($linha, 166, 3))
            ->setAgencia(substr($linha, 169, 4))
            ->setDvAgencia(substr($linha, 173, 1));

        $bancoEmpresa = new Banco();
        $bancoEmpresa->setCod(substr($linha, 21, 17));
        $empresa = new Empresa();
        $empresa
            ->setBanco($bancoEmpresa)
            ->setTipoInscricao(substr($linha, 2, 2))
            ->setNumInscricao(substr($linha, 4, 14))
            ->addReservado(substr($linha, 38, 25));

        $detail
            ->setBancoEmissor($bancoEmissor)
            ->setBancoRecebedor($bancoRecebedor)
            ->setRegistro(substr($linha, 1, 1))
            ->setNumOcorrencia(substr($linha, 117, 10))
            ->setDataVencimento(substr($linha, 147, 6))
            ->setValor($this->formataNumero(substr($linha, 153, 13)))
            ->setDespCobranca(substr($linha, 176, 2))
            ->setOutrasDespesas($this->formataNumero(substr($linha, 189, 13)))
            ->setJurosAtraso($this->formataNumero(substr($linha, 202, 13)))
            ->setTaxaIof($this->formataNumero(substr($linha, 215, 13)))
            ->setDescontoConcedido($this->formataNumero(substr($linha, 241, 13)))
            ->setValorRecebido($this->formataNumero(substr($linha, 254, 13)))
            ->setJurosMora($this->formataNumero(substr($linha, 267, 13)))
            ->setOutrosRecebimentos($this->formataNumero(substr($linha, 280, 13)))
            ->setValorAbatimento($this->formataNumero(substr($linha, 228, 13)))
            ->setValorLancamento($this->formataNumero(substr($linha, 306, 13)))
            ->setIndicativoDc(substr($linha, 319, 1))
            ->setIndicadorValor(substr($linha, 320, 1))
            ->setValorAjuste($this->formataNumero(substr($linha, 321, 12)))
            ->setSequencial(substr($linha, 395, 6))
            ->setMotivoCodOcorrencia(substr($linha, 319, 10))
            ->setNumCartorio(substr($linha, 369, 2))
            ->setNumCartorio(substr($linha, 369, 2))
            ->setNumCartorio(substr($linha, 369, 2))
        ;

        return $detail;
    }
243729
public function contentCollapseIcon(
        array &$data,
        $sortField,
        $level,
        &$contentCollapseIcon,
        DatabaseRecordListXclass $parentObj
    ) {
        if ($data['_EXPAND_TABLE_'] === 'tt_content') {
            $expandTitle = $this->languageService->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xlf:list.expandElement');
            $collapseTitle = $this->languageService->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xlf:list.collapseElement');
            $expandedGridelements = $parentObj->getExpandedGridelements();
            if ($expandedGridelements[$data['uid']]) {
                $href = htmlspecialchars(($parentObj->listURL() . '&gridelementsExpand[' . (int)$data['uid'] . ']=0'));
                $contentCollapseIcon = '<a class="btn btn-default t3js-toggle-gridelements-list open-gridelements-container" data-state="expanded" href="' . $href .
                    '" id="t3-gridelements-' . $data['uid'] . '" title="' . $collapseTitle
                    . '" data-toggle-title="' . $expandTitle . '">'
                    . $this->getIconFactory()->getIcon('actions-view-list-expand', 'small')->render()
                    . $this->getIconFactory()->getIcon('actions-view-list-collapse', 'small')->render() . '</a>';
            } else {
                $href = htmlspecialchars(($parentObj->listURL() . '&gridelementsExpand[' . (int)$data['uid'] . ']=1'));
                $contentCollapseIcon = '<a class="btn btn-default t3js-toggle-gridelements-list" data-state="collapsed" href="' . $href .
                    '" id="t3-gridelements-' . $data['uid'] . '" title="' . $expandTitle
                    . '" data-toggle-title="' . $collapseTitle . '">'
                    . $this->getIconFactory()->getIcon('actions-view-list-expand', 'small')->render()
                    . $this->getIconFactory()->getIcon('actions-view-list-collapse', 'small')->render() . '</a>';
            }
        }
    }
1206899
def ler_configuracao
      #@artigo.merge!(YAML.load(ler_arquivo(Formatafacil::Tarefa.arquivo_configuracao)))
      #converte_parametros_para_boolean

      #@modelo = @artigo['modelo']
      if File.exist?(@arquivo_abstract) then
        @artigo['abstract'] = ler_arquivo(@arquivo_abstract)
        @artigo.merge!(ler_metadados_do_arquivo(@arquivo_abstract))
      end
      if File.exist?(@arquivo_resumo) then
        @artigo['resumo'] = ler_arquivo(@arquivo_resumo)
      end
      @artigo['bibliografia'] = ler_arquivo(@arquivo_bibliografia) if File.exist?(@arquivo_bibliografia)

      #unifica_metadados

    end
201756
public function fetchField()
    {
        $value = $this->getValue();
        if ($this->issetOption('multiple')) {
            $this->setName($this->getName() . '[]');
        }
        unset($this->_options['value']);
        //nagłówek selecta
        $html = '<select ' . $this->_getHtmlOptions() . '>';
        //generowanie opcji
        foreach (($this->getMultioptions() ? $this->getMultioptions() : []) as $key => $caption) {
            $disabled = '';
            //disabled
            if (strpos($key, ':disabled') !== false && !is_array($caption)) {
                $key = '';
                $disabled = ' disabled="disabled"';
            }
            //jeśli wystąpi zagnieżdżenie - generowanie grupy opcji
            if (is_array($caption)) {
                $html .= '<optgroup label="' . $key . '">';
                foreach ($caption as $k => $c) {
                    $html .= '<option value="' . $k . '" ' . $this->_calculateSelected($k, $value) . $disabled . '>' . \App\Registry::$translate->_($c) . '</option>';
                }
                $html .= '</optgroup>';
                continue;
            }
            //dodawanie pojedynczej opcji
            $html .= '<option value="' . $key . '"' . $this->_calculateSelected($key, $value) . $disabled . '>' . \App\Registry::$translate->_($caption) . '</option>';
        }
        $html .= '</select>';
        return $html;
    }
869869
protected static function exeCopy(string $entity, $data, $checkPermission)
    {
        $result = null;
        $dicionario = Metadados::getDicionario($entity);

        if (is_int($data)) {
            $copy = new TableCrud($entity);
            $copy->load($data);
            if ($copy->exist())
                if (Entity::checkPermission($entity, $data, $checkPermission)) {
                    $result = self::copyEntity($entity, $copy->getDados(), $dicionario);
                } else {
                    self::$error[$entity]['id'] = "permissão negada";
                }
            else
                self::$error[$entity]['id'] = "id: {$data} não encontrado para cópia";

        } elseif (is_array($data)) {
            if (Check::isAssoc($data)) {
                $copy = new TableCrud($entity);
                $copy->loadArray($data);
                if ($copy->exist())
                    if (Entity::checkPermission($entity, $data['id'], $checkPermission)) {
                        $result = self::copyEntity($entity, $copy->getDados(), $dicionario);
                    } else {
                        self::$error[$entity]['id'] = "permissão negada";
                    }
                else
                    self::$error[$entity]['id'] = "datas não encontrado em " . $entity . " para cópia";

            } else {
                foreach ($data as $datum) {
                    if (!self::$error)
                        $result[] = self::exeCopy($entity, (int)$datum);
                }
            }
        }
        unset($result['id']);

        return self::$error ? null : $result;
    }