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

mixerapi / core / 18715982638

22 Oct 2025 12:21PM UTC coverage: 89.922%. Remained the same
18715982638

Pull #9

github

web-flow
Merge e9e769e2d into 4ddf2a5a5
Pull Request #9: Upgrade kcs/class-finder and more!

4 of 5 new or added lines in 3 files covered. (80.0%)

116 of 129 relevant lines covered (89.92%)

1.81 hits per line

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

40.0
/src/Response/ResponseModifier.php
1
<?php
2
declare(strict_types=1);
3

4
namespace MixerApi\Core\Response;
5

6
use Cake\Event\Event;
7
use Cake\Event\EventManager;
8

9
class ResponseModifier
10
{
11
    /**
12
     * @param string $type Type Alias that will be used to modify the response e.g. jsonld or hal+json
13
     * @param string $viewClass The View Class associated with $this->type alias
14
     */
15
    public function __construct(private string $type, private string $viewClass)
16
    {
17
    }
1✔
18

19
    /**
20
     * Registers Controller.initialize listener which performs the following actions:
21
     * - Modifies the CakePHP Response type map if necessary to add additional mime types (note: this will be removed
22
     * in a future version of the application).
23
     * - Sets the view class map to render responses in the requested mime type.
24
     *
25
     * @return void
26
     */
27
    public function listen(): void
28
    {
29
        EventManager::instance()
1✔
30
            ->on('Controller.initialize', function (Event $event): void {
1✔
31

32
                /** @var \Cake\Controller\Controller $controller */
33
                $controller = $event->getSubject();
×
34
                if ($controller->components()->has('RequestHandler')) {
×
35
                    $controller->RequestHandler->setConfig(
×
36
                        'viewClassMap.' . $this->type,
×
NEW
37
                        $this->viewClass,
×
38
                    );
×
39
                }
40
            });
1✔
41
    }
42
}
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