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

mixerapi / mixerapi-dev / 7800771005

06 Feb 2024 01:54PM UTC coverage: 94.685% (-1.1%) from 95.793%
7800771005

Pull #141

github

web-flow
Merge 3ca040ba2 into 39576a822
Pull Request #141: MixerAPI v2.0.0 - CakePHP 5 support

48 of 52 new or added lines in 15 files covered. (92.31%)

13 existing lines in 3 files now uncovered.

962 of 1016 relevant lines covered (94.69%)

4.4 hits per line

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

91.67
/plugins/json-ld-view/src/Controller/JsonLdController.php
1
<?php
2
declare(strict_types=1);
3

4
namespace MixerApi\JsonLdView\Controller;
5

6
use MixerApi\JsonLdView\View\JsonLdView;
7

8
/**
9
 * @property \MixerApi\JsonLdView\Controller\Component\JsonLdContextComponent $JsonLdContext
10
 * @property \MixerApi\JsonLdView\Controller\Component\JsonLdVocabComponent $JsonLdVocab
11
 */
12
class JsonLdController extends AppController
13
{
14
    /**
15
     * @return void
16
     * @throws \Exception
17
     */
18
    public function initialize(): void
19
    {
20
        parent::initialize();
3✔
21
        $this->loadComponent('MixerApi/JsonLdView.JsonLdContext');
3✔
22
        $this->loadComponent('MixerApi/JsonLdView.JsonLdVocab');
3✔
23
    }
24

25
    /**
26
     * @inheritDoc
27
     */
28
    public function viewClasses(): array
29
    {
NEW
30
        return [JsonLdView::class];
×
31
    }
32

33
    /**
34
     * Displays JSON-LD context for the given entity.
35
     *
36
     * @link https://json-ld.org/learn.html
37
     * @param string|null $entity Entity name
38
     * @return \Cake\Http\Response
39
     */
40
    public function contexts(?string $entity = null): \Cake\Http\Response
41
    {
42
        $context = $this->JsonLdContext->build($entity);
2✔
43

44
        return $this->getResponse()
2✔
45
                ->withType('application/ld+json')
2✔
46
                ->withStringBody(json_encode($context, JSON_PRETTY_PRINT));
2✔
47
    }
48

49
    /**
50
     * Displays JSON-LD vocab for entities in your API.
51
     *
52
     * @link https://json-ld.org/learn.html
53
     * @return \Cake\Http\Response
54
     * @throws \ReflectionException
55
     */
56
    public function vocab(): \Cake\Http\Response
57
    {
58
        $vocab = $this->JsonLdVocab->build();
1✔
59

60
        return $this->getResponse()
1✔
61
            ->withType('application/ld+json')
1✔
62
            ->withStringBody(json_encode($vocab, JSON_PRETTY_PRINT));
1✔
63
    }
64
}
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