setSilent example

/** * Calculating the current page * * @return void */
    protected function calculateCurrentPage(string $group)
    {
        if (array_key_exists($group$this->segment)) {
            try {
                $this->groups[$group]['currentPage'] = (int) $this->groups[$group]['currentUri']
                    ->setSilent(false)->getSegment($this->segment[$group]);
            } catch (HTTPException $e) {
                $this->groups[$group]['currentPage'] = 1;
            }
        } else {
            $pageSelector = $this->groups[$group]['pageSelector'];

            $page = (int) ($_GET[$pageSelector] ?? 1);

            $this->groups[$group]['currentPage'] = $page < 1 ? 1 : $page;
        }
    }
}
            // @codeCoverageIgnoreStart             $class = APP_NAMESPACE . '\Database\Seeds\\' . $class;

            if (class_exists($class, false)) {
                require_once $path;
            }
            // @codeCoverageIgnoreEnd         }

        /** @var Seeder $seeder */
        $seeder = new $class($this->config);
        $seeder->setSilent($this->silent)->run();

        unset($seeder);

        if (is_cli() && ! $this->silent) {
            CLI::write("Seeded: {$class}", 'green');
        }
    }

    /** * Sets the location of the directory that seed files can be located in. * * @return $this */
if ($this->db === null) {
            $this->db = Database::connect($this->DBGroup);
            $this->db->initialize();
        }

        if ($this->migrations === null) {
            // Ensure that we can run migrations             $config          = new Migrations();
            $config->enabled = true;

            $this->migrations = Services::migrations($config$this->db);
            $this->migrations->setSilent(false);
        }

        if ($this->seeder === null) {
            $this->seeder = Database::seeder($this->DBGroup);
            $this->seeder->setSilent(true);
        }
    }

    // --------------------------------------------------------------------     // Migrations     // --------------------------------------------------------------------
Home | Imprint | This part of the site doesn't use cookies.