• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

daycry / cronjob / 15775568161

20 Jun 2025 09:13AM UTC coverage: 69.514% (+4.1%) from 65.424%
15775568161

push

github

daycry
- New Features

130 of 163 new or added lines in 9 files covered. (79.75%)

6 existing lines in 3 files now uncovered.

415 of 597 relevant lines covered (69.51%)

3.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Controllers/Job.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Daycry\CronJob\Controllers;
6

7
use CodeIgniter\Exceptions\PageNotFoundException;
8
use Daycry\CronJob\Config\Services;
9

10
class Job extends BaseCronJob
11
{
12
    /**
13
     * Displays the form the login to the site.
14
     */
15
    public function index(string $jobName)
16
    {
17
        if (! $this->checkCronJobSession()) {
×
18
            return redirect()->to('cronjob');
×
19
        }
20

21
        $scheduler = $this->initializeScheduler();
×
22

23
        $job = $this->findJobByName($scheduler, $jobName);
×
24

25
        if (! $job) {
×
26
            throw new PageNotFoundException();
×
27
        }
28

29
        $this->viewData['logs'] = $job->getLogs();
×
30

31
        return view(config('CronJob')->views['logs'], $this->viewData);
×
32
    }
33

34
    /**
35
     * Initialize the scheduler with the configuration.
36
     */
37
    private function initializeScheduler()
38
    {
NEW
39
        $config    = config('CronJob');
×
40
        $scheduler = Services::scheduler();
×
41
        $config->init($scheduler);
×
42

43
        return $scheduler;
×
44
    }
45

46
    /**
47
     * Find a job by its name from the scheduler.
48
     *
49
     * @param mixed $scheduler
50
     */
51
    private function findJobByName($scheduler, string $jobName)
52
    {
53
        foreach ($scheduler->getTasks() as $job) {
×
54
            if ($job->getName() === $jobName) {
×
55
                return $job;
×
56
            }
57
        }
58

59
        return false;
×
60
    }
61
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc