<commit_before><?php

namespace VideoPublisher\Tests\Dummy;

use VideoPublisher\Connection\ConnectionInterface;
use VideoPublisher\Connection\Curl\CurlResponse;
use VideoPublisher\Connection\ResponseInterface;
use VideoPublisher\Payload\Payload;

class DummyConnection implements ConnectionInterface
{

    /**
     * @param Payload $payload
     * @return ResponseInterface
     */
    public function sendPayload(Payload $payload)
    {
        switch ($payload->getUrl()) {
            case 'http://my.videopublisher.io/api/published':
                $streams = [];
                $streams[] = [
                    'streamName' => 'test',
                    'uuid' => '00000000-0000-0000-0000-00000000',
                    'status' => 'mock',
                    'enabled' => true
                ];
                $streams[] = [
                    'streamName' => 'test',
                    'uuid' => '00000000-0000-0000-0000-00000000',
                    'status' => 'mock',
                    'enabled' => true
                ];
                $streams[] = [
                    'streamName' => 'test',
                    'uuid' => '00000000-0000-0000-0000-00000000',
                    'status' => 'mock',
                    'enabled' => true
                ];

                return new CurlResponse(200, null, json_encode($streams));
            case 'http://my.videopublisher.io/api/publish/00000000-0000-0000-0000-00000000':
                $stream = [
                    'streamName' => 'test',
                    'uuid' => '00000000-0000-0000-0000-00000000',
                    'status' => 'mock',
                    'enabled' => true,
                    'viewable' => true,
                    'view' => [
                        'playout_url' => 'http://playout.com/video.mp4',
                        'video_player' => 'http://playout.com/player/video.mp4'
                    ]
                ];
                return new CurlResponse(200, null, json_encode($stream));
            case 'http://my.videopublisher.io/exception/api/published':
                return new CurlResponse(400, null, null);
            case 'http://my.videopublisher.io/exception/api/publish/00000000-0000-0000-0000-00000000':
                return new CurlResponse(400, null, null);
        }

        var_dump($payload->getUrl());
        die;
    }
}<commit_msg>- cleaned up DummyConnection<commit_after><?php

namespace VideoPublisher\Tests\Dummy;

use VideoPublisher\Connection\ConnectionInterface;
use VideoPublisher\Connection\Curl\CurlResponse;
use VideoPublisher\Connection\ResponseInterface;
use VideoPublisher\Payload\Payload;

class DummyConnection implements ConnectionInterface
{

    /**
     * @param Payload $payload
     * @return ResponseInterface
     */
    public function sendPayload(Payload $payload)
    {
        switch ($payload->getUrl()) {
            case 'http://my.videopublisher.io/api/published':
                return $this->generateListStreamsResponse();
            case 'http://my.videopublisher.io/api/publish/00000000-0000-0000-0000-00000000':
                return $this->generateGetStreamResponse();
            case 'http://my.videopublisher.io/exception/api/published':
                return new CurlResponse(400, null, null);
            case 'http://my.videopublisher.io/exception/api/publish/00000000-0000-0000-0000-00000000':
                return new CurlResponse(400, null, null);
        }
    }

    /**
     * @return CurlResponse
     */
    private function generateListStreamsResponse()
    {
        $streams = [];
        $streams[] = [
            'streamName' => 'test',
            'uuid' => '00000000-0000-0000-0000-00000000',
            'status' => 'mock',
            'enabled' => true
        ];
        $streams[] = [
            'streamName' => 'test',
            'uuid' => '00000000-0000-0000-0000-00000000',
            'status' => 'mock',
            'enabled' => true
        ];
        $streams[] = [
            'streamName' => 'test',
            'uuid' => '00000000-0000-0000-0000-00000000',
            'status' => 'mock',
            'enabled' => true
        ];

        return new CurlResponse(200, null, json_encode($streams));
    }

    /**
     * @return CurlResponse
     */
    private function generateGetStreamResponse()
    {
        $stream = [
            'streamName' => 'test',
            'uuid' => '00000000-0000-0000-0000-00000000',
            'status' => 'mock',
            'enabled' => true,
            'viewable' => true,
            'view' => [
                'playout_url' => 'http://playout.com/video.mp4',
                'video_player' => 'http://playout.com/player/video.mp4'
            ]
        ];
        return new CurlResponse(200, null, json_encode($stream));
    }
}
{'fraction_non_alphanumeric': 0.13818938605619147, 'fraction_numerical': 0.07575442247658688, 'mean_word_length': 1.674457429048414, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 48, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 24, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2007278', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1286, 'n_words': 215}