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

miaoxing / services / 6801533350

08 Nov 2023 04:34PM UTC coverage: 10.534% (-0.8%) from 11.327%
6801533350

push

github

twinh
ci: add PHP 8, remove PHP 7.2, 7.3

69 of 655 relevant lines covered (10.53%)

2.09 hits per line

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

0.0
/src/Service/ShowAction.php
1
<?php
2

3
namespace Miaoxing\Services\Service;
4

5
use Exception;
6
use Miaoxing\Plugin\BaseModel;
7
use Miaoxing\Services\Action\BaseAction;
8
use Wei\BaseController;
9
use Wei\Ret;
10

11
class ShowAction extends BaseAction
12
{
13
    /**
14
     * @param BaseController $controller
15
     * @return Ret
16
     * @throws Exception
17
     * @svc
18
     */
19
    protected function exec(BaseController $controller)
20
    {
21
        $model = $this->convention->createModel($controller);
×
22

23
        $this->triggerRet('beforeFind', [$model, $this->req]);
×
24

25
        $model->findOrFail($this->req['id']);
×
26

27
        $this->triggerRet('afterFind', [$model, $this->req]);
×
28

29
        $this->includeModel($controller, $model);
×
30

31
        return $model->toRet([
×
32
            'data' => array_merge($model->toArray(), $this->triggerBuildData($model)),
×
33
        ]);
×
34
    }
35

36
    /**
37
     * @param callable $callable
38
     * @return $this
39
     * @svc
40
     */
41
    protected function beforeFind(callable $callable)
42
    {
43
        return $this->on(__FUNCTION__, $callable);
×
44
    }
45

46
    /**
47
     * @param callable $callable
48
     * @return $this
49
     * @svc
50
     */
51
    protected function afterFind(callable $callable)
52
    {
53
        return $this->on(__FUNCTION__, $callable);
×
54
    }
55

56
    /**
57
     * @param callable $callable
58
     * @return $this
59
     * @svc
60
     */
61
    protected function buildData(callable $callable)
62
    {
63
        return $this->on(__FUNCTION__, $callable);
×
64
    }
65

66
    private function triggerBuildData($model)
67
    {
68
        return $this->trigger('buildData', [$model]) ?: [];
×
69
    }
70

71
    private function includeModel(BaseController $controller, BaseModel $model)
72
    {
73
        $model->load($controller->getOption('include'));
×
74
    }
75
}
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

© 2025 Coveralls, Inc