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

pmvc-plugin / controller / d3daa4f5-0dfc-4e7c-8946-babc8f2c80a4

09 Sep 2023 06:52AM UTC coverage: 62.987% (-2.5%) from 65.484%
d3daa4f5-0dfc-4e7c-8946-babc8f2c80a4

push

circleci

HillLiu
reduce error

19 of 19 new or added lines in 1 file covered. (100.0%)

388 of 616 relevant lines covered (62.99%)

3.78 hits per line

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

43.33
/src/_app_not_found.php
1
<?php
2
/**
3
 * PMVC.
4
 *
5
 * PHP version 5
6
 *
7
 * @category CategoryName
8
 *
9
 * @package PMVC
10
 *
11
 * @author  Hill <hill@kimo.com>
12
 * @license http://opensource.org/licenses/MIT MIT
13
 *
14
 * @version GIT: <git_id>
15
 *
16
 * @link https://packagist.org/packages/pmvc/pmvc
17
 */
18

19
namespace PMVC;
20

21
use DomainException;
22

23
/*
24
 * App Not Found Notice.
25
 *
26
 * @category CategoryName
27
 *
28
 * @package PMVC
29
 *
30
 * @author  Hill <hill@kimo.com>
31
 * @license http://opensource.org/licenses/MIT MIT
32
 *
33
 * @link https://packagist.org/packages/pmvc/pmvc
34
 */
35
// @codingStandardsIgnoreStart
36
${_INIT_CONFIG}[_CLASS] = __NAMESPACE__ . '\app_not_found';
1✔
37
class app_not_found // @codingStandardsIgnoreEnd
38
{
39
    public $caller;
40

41
    /**
42
     * App not found invoke.
43
     *
44
     * @param array  $parents   Parents folders.
45
     * @param string $indexFile Index file name
46
     * @param array  $folders   For pass alias information.
47
     *
48
     * @return void
49
     */
50
    public function __invoke($parents, $indexFile, $folders)
51
    {
52
        if (\PMVC\isDev('help')) {
2✔
53
            return;
×
54
        }
55
        $alias = $folders['alias'];
2✔
56
        option('set', 'httpResponseCode', 404);
2✔
57
        $caller = $this->caller;
2✔
58
        $caller[_REAL_APP] = $caller[_DEFAULT_APP];
2✔
59
        $path = $caller->getAppFile($parents, $indexFile);
2✔
60
        if (!$path) {
2✔
61
            throw new DomainException(
2✔
62
                'Default app setting is not correct. [' .
2✔
63
                    $caller[_DEFAULT_APP] .
2✔
64
                    ']'
2✔
65
            );
2✔
66
        } else {
67
            trigger_error(
×
68
                json_encode([
×
69
                    'Error' =>
×
70
                        'No app found with routers, ' .
×
71
                        'Please check following debug message.',
×
72
                    'Debug' => [
×
73
                        'Parent' => $parents,
×
74
                        'App' => $caller[_REAL_APP],
×
75
                        'Index' => $indexFile,
×
76
                        'Alias' => $alias ?: '',
×
77
                    ],
×
78
                ]),
×
79
                E_USER_WARNING
×
80
            );
×
81
        }
82
        $caller->setApp($caller[_REAL_APP]);
×
83

84
        return $path;
×
85
    }
86
}
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