Skip to content

Commit ccb4a59

Browse files
authored
Merge pull request #78 from daun/chore/namespaces
Refactor to strict namespaces
2 parents b667752 + 290a528 commit ccb4a59

File tree

17 files changed

+41
-27
lines changed

17 files changed

+41
-27
lines changed

src/Facades/Log.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @method static void debug(\Stringable|string $message, mixed[] $context = [])
1717
* @method static void log(mixed $level, \Stringable|string $message, mixed[] $context = [])
1818
*
19-
* @see \Daun\StatamicMux\Support\Logging\LoggerInterface
19+
* @see LoggerInterface
2020
*/
2121
class Log extends Facade
2222
{

src/Facades/Mux.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* @method static array getDefaultPlaybackModifiers()
2727
* @method static void hook(string $name, \Closure $hook)
2828
*
29-
* @see \Daun\StatamicMux\Mux\MuxService
29+
* @see MuxService
3030
*/
3131
class Mux extends Facade
3232
{

src/GraphQL/MuxMirrorType.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
use Daun\StatamicMux\Facades\Mux;
88
use Daun\StatamicMux\Mux\Enums\MuxPlaybackPolicy;
99
use Illuminate\Support\Facades\Validator;
10+
use Rebing\GraphQL\Support\Type;
1011
use Statamic\Facades\GraphQL;
1112
use Statamic\GraphQL\Types\JsonArgument;
1213

13-
class MuxMirrorType extends \Rebing\GraphQL\Support\Type
14+
class MuxMirrorType extends Type
1415
{
1516
const NAME = 'MuxMirror';
1617

src/GraphQL/MuxPlaybackIdType.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
namespace Daun\StatamicMux\GraphQL;
44

55
use Daun\StatamicMux\Data\MuxPlaybackId;
6+
use Rebing\GraphQL\Support\Type;
67
use Statamic\Facades\GraphQL;
78

8-
class MuxPlaybackIdType extends \Rebing\GraphQL\Support\Type
9+
class MuxPlaybackIdType extends Type
910
{
1011
const NAME = 'MuxPlaybackId';
1112

src/Mux/Actions/CreateProxyVersion.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Daun\StatamicMux\Mux\MuxApi;
88
use Daun\StatamicMux\Mux\MuxService;
99
use Illuminate\Foundation\Application;
10+
use MuxPhp\Models\StaticRendition;
1011
use Statamic\Assets\Asset;
1112

1213
class CreateProxyVersion
@@ -112,7 +113,7 @@ protected function createClipFromAsset(Asset $asset, float $start, float $length
112113
'end_time' => $start + $length,
113114
]),
114115
'static_renditions' => [
115-
['resolution' => \MuxPhp\Models\StaticRendition::RESOLUTION_HIGHEST],
116+
['resolution' => StaticRendition::RESOLUTION_HIGHEST],
116117
],
117118
'passthrough' => $this->getPassthroughData($muxId),
118119
];

src/Mux/MuxApi.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use MuxPhp\Api\URLSigningKeysApi;
1515
use MuxPhp\ApiException;
1616
use MuxPhp\Configuration;
17+
use MuxPhp\Models\Asset;
18+
use MuxPhp\Models\AssetStaticRenditions;
1719
use MuxPhp\Models\CreateAssetRequest;
1820
use MuxPhp\Models\CreatePlaybackIDRequest;
1921
use MuxPhp\Models\CreateUploadRequest;
@@ -233,7 +235,7 @@ public function assetIsReady(string $muxId): bool
233235
try {
234236
$response = $this->assets()->getAsset($muxId)->getData();
235237
$status = $response?->getStatus();
236-
$expected = \MuxPhp\Models\Asset::STATUS_READY;
238+
$expected = Asset::STATUS_READY;
237239

238240
Log::debug(
239241
'Checking Mux asset status: '.($status === $expected ? 'ready' : 'not ready'),
@@ -264,7 +266,7 @@ public function assetRenditionsAreReady(string $muxId): bool
264266
$files = $response?->getStaticRenditions()?->getFiles() ?? [];
265267

266268
$ready = array_reduce($files, function ($carry, $file) {
267-
return $carry && $file->getStatus() === \MuxPhp\Models\AssetStaticRenditions::STATUS_READY;
269+
return $carry && $file->getStatus() === AssetStaticRenditions::STATUS_READY;
268270
}, count($files) > 0);
269271

270272
Log::debug(

src/Support/Logging/Processors/ContextScrubber.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Daun\StatamicMux\Support\Logging\Processors;
44

5+
use Monolog\Logger;
56
use RedactSensitive\RedactSensitiveProcessor;
67

78
final class ContextScrubber
@@ -14,7 +15,7 @@ final class ContextScrubber
1415
];
1516

1617
/**
17-
* @param \Monolog\Logger $logger
18+
* @param Logger $logger
1819
*/
1920
public function __invoke($logger): void
2021
{

tests/Concerns/InteractsWithAntlersViews.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Tests\Concerns;
44

5+
use Illuminate\Contracts\Support\Arrayable;
56
use Illuminate\Support\Facades\View as ViewFacade;
67
use Illuminate\Testing\TestView;
78

@@ -10,7 +11,7 @@ trait InteractsWithAntlersViews
1011
/**
1112
* Render the contents of the given Antlers template string.
1213
*
13-
* @param \Illuminate\Contracts\Support\Arrayable|array $data
14+
* @param Arrayable|array $data
1415
*/
1516
protected function antlers(string $template, $data = []): TestView
1617
{

tests/Feature/AssetsControllerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Illuminate\Support\Facades\Auth;
66
use Statamic\Facades\Stache;
77
use Statamic\Facades\User;
8+
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
89

910
beforeEach(function () {
1011
config([
@@ -68,7 +69,7 @@
6869
$id = base64_encode('test_container_assets::nonexistent.mp4');
6970

7071
$this->app->make(AssetsController::class)->thumbnail($id);
71-
})->throws(Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class);
72+
})->throws(NotFoundHttpException::class);
7273

7374
test('returns 404 for invalid base64 id', function () {
7475
$this->app->make(AssetsController::class)->thumbnail('!!!invalid!!!');
@@ -79,7 +80,7 @@
7980
$id = base64_encode($asset->id());
8081

8182
$this->app->make(AssetsController::class)->thumbnail($id);
82-
})->throws(Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class);
83+
})->throws(NotFoundHttpException::class);
8384

8485
test('returns 404 when thumbnail service returns null', function () {
8586
$service = Mockery::mock(ThumbnailService::class);
@@ -90,7 +91,7 @@
9091
$id = base64_encode($asset->id());
9192

9293
$this->app->make(AssetsController::class)->thumbnail($id);
93-
})->throws(Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class);
94+
})->throws(NotFoundHttpException::class);
9495

9596
test('returns 404 for empty id', function () {
9697
$this->app->make(AssetsController::class)->thumbnail(base64_encode(''));

tests/Feature/Commands/PruneCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
->assertSuccessful();
8080

8181
Queue::assertPushed(DeleteMuxAssetJob::class, function ($job) {
82-
$class = new \ReflectionClass($job);
82+
$class = new ReflectionClass($job);
8383
$asset = $class->getProperty('asset')->getValue($job);
8484

8585
return $asset === 'orphan-mux-id';

0 commit comments

Comments
 (0)