Skip to content

Commit

Permalink
Merge pull request #79 from snapshotpl/fix-github-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
basz authored Oct 21, 2021
2 parents 4db51e5 + ea2522b commit b8fccb3
Show file tree
Hide file tree
Showing 31 changed files with 151 additions and 150 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: "Test"

on:
pull_request:
branches:
- "master"
push:
branches:
- "master"

jobs:
unit-tests:
name: "Unit Tests"
runs-on: "ubuntu-latest"
strategy:
matrix:
dependencies:
- "--prefer-lowest"
- ""
php-version:
- "8.0"
- "7.4"
composer:
- "v2"
include:
- php-version: "7.3"
composer: "v1"
dependencies: "--prefer-lowest"
- php-version: "7.3"
composer: "v1"
dependencies: ""

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
tools: "composer:${{ matrix.composer }}"
- name: "Install dependencies"
run: "composer update ${{ matrix.dependencies }} --no-interaction"
- name: "Run tests"
run: "vendor/bin/phpunit"

coverage:
name: "Publish coverage"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.0"
tools: "composer:v2"
coverage: "pcov"
- name: "Install dependencies"
run: "composer update --no-interaction"
- name: "Install coveralls"
run: "composer require --dev php-coveralls/php-coveralls"
- name: "Generate coverage"
run: "vendor/bin/phpunit --coverage-text --coverage-clover ./build/logs/clover.xml --configuration ./phpunit.xml.dist"
- name: "Publish coverage"
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: "vendor/bin/php-coveralls -v"


coding-standard:
name: "Coding standard"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.0"
tools: "composer:v2"
- name: "Install dependencies"
run: "composer update --no-interaction"
- name: "Check coding standard"
run: "vendor/bin/php-cs-fixer fix -v --diff --dry-run"
34 changes: 0 additions & 34 deletions .github/workflows/unit-tests.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

$config->getFinder()->in(__DIR__)->append([__FILE__]);

$cacheDir = \getenv('TRAVIS') ? \getenv('HOME') . '/.php-cs-fixer' : __DIR__;
$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;

$config->setCacheFile($cacheDir . '/.php_cs.cache');

Expand Down
51 changes: 0 additions & 51 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ A simple Laminas module that bridges the Flysystem filesystem.
[![Latest Unstable Version](https://poser.pugx.org/bushbaby/flysystem/v/unstable)](https://packagist.org/packages/bushbaby/flysystem)
[![License](https://poser.pugx.org/bushbaby/flysystem/license)](https://packagist.org/packages/bushbaby/flysystem)

[![Build Status](https://travis-ci.org/bushbaby/BsbFlysystem.svg?branch=master)](https://travis-ci.org/bushbaby/BsbFlysystem)
![Build Status](https://github.com/bushbaby/BsbFlysystem/actions/workflows/test.yml/badge.svg)
[![Code Coverage](https://scrutinizer-ci.com/g/bushbaby/BsbFlysystem/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/bushbaby/BsbFlysystem/?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/bushbaby/BsbFlysystem/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/bushbaby/BsbFlysystem/?branch=master)

Provides a way to configure the various filesystem adapters provided by thephpleague's 'Flysystem'. And allows to retrieve fully configured filesystems by name from the ServiceLocator. Whether the defined filesystems are local- or dropbox filesystems becomes a configuration detail.

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"psr/container": "^1.0"
},
"require-dev": {
"bushbaby/php-cs-fixer-config": "^2.0",
"laminas/laminas-code": "^3.3.1 || ^4.0.0",
"laminas/laminas-config": "^3.1",
"laminas/laminas-filter": "^2.9.1",
Expand All @@ -38,7 +39,7 @@
"league/flysystem-vfs": "^1.0",
"league/flysystem-webdav": "~1.0",
"league/flysystem-ziparchive": "~1.0",
"ocramius/proxy-manager": "~1.0 || ~2.0",
"ocramius/proxy-manager": "~2.0",
"phpunit/phpunit": "^9.4.2",
"spatie/flysystem-dropbox": "~1.0",
"superbalist/flysystem-google-storage": "^7.2"
Expand Down
6 changes: 3 additions & 3 deletions src/Adapter/Factory/AbstractAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o

public function createService(ContainerInterface $container): AdapterInterface
{
if (\method_exists($container, 'getServiceLocator')) {
if (method_exists($container, 'getServiceLocator')) {
$container = $container->getServiceLocator();
}

return $this($container, \func_get_arg(2));
return $this($container, func_get_arg(2));
}

/**
Expand Down Expand Up @@ -125,7 +125,7 @@ public function getLazyFactory(ContainerInterface $container): LazyLoadingValueH
$factoryConfig->setGeneratorStrategy(new EvaluatingGeneratorStrategy());
}

\spl_autoload_register($factoryConfig->getProxyAutoloader());
spl_autoload_register($factoryConfig->getProxyAutoloader());

return new LazyLoadingValueHolderFactory($factoryConfig);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/Factory/AwsS3v3AdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AwsS3v3AdapterFactory extends AbstractAdapterFactory
{
public function doCreateService(ContainerInterface $container): AdapterInterface
{
if (! \class_exists(Adapter::class)) {
if (! class_exists(Adapter::class)) {
throw new RequirementsException(['league/flysystem-aws-s3-v3'], 'AwsS3v3');
}
$config = [
Expand All @@ -53,7 +53,7 @@ public function doCreateService(ContainerInterface $container): AdapterInterface
'key' => $this->options['credentials']['key'],
'secret' => $this->options['credentials']['secret'],
];
$config = \array_merge(\compact('credentials'), $config);
$config = array_merge(compact('credentials'), $config);
}

$adapterOptions = $this->options['options'] ?? [];
Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/Factory/AzureAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class AzureAdapterFactory extends AbstractAdapterFactory
{
public function doCreateService(ContainerInterface $container): AdapterInterface
{
if (! \class_exists(Adapter::class)) {
if (! class_exists(Adapter::class)) {
throw new RequirementsException(['league/flysystem-azure'], 'Azure');
}
$endpoint = \sprintf(
$endpoint = sprintf(
'DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s',
$this->options['account-name'],
$this->options['account-key']
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/DropboxAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DropboxAdapterFactory extends AbstractAdapterFactory
{
public function doCreateService(ContainerInterface $container): AdapterInterface
{
if (! \class_exists(Adapter::class)) {
if (! class_exists(Adapter::class)) {
throw new RequirementsException(['spatie/flysystem-dropbox'], 'Dropbox');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/GoogleCloudDriveAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GoogleCloudDriveAdapterFactory extends AbstractAdapterFactory
{
public function doCreateService(ContainerInterface $container): AdapterInterface
{
if (! \class_exists(Adapter::class)) {
if (! class_exists(Adapter::class)) {
throw new RequirementsException(['superbalist/flysystem-google-storage'], 'GoogleCloudDrive');
}

Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/Factory/RackspaceAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class RackspaceAdapterFactory extends AbstractAdapterFactory
{
public function doCreateService(ContainerInterface $container): AdapterInterface
{
if (! \class_exists(Adapter::class) ||
! \class_exists(LazyLoadingValueHolderFactory::class)
if (! class_exists(Adapter::class) ||
! class_exists(LazyLoadingValueHolderFactory::class)
) {
throw new RequirementsException(['league/flysystem-rackspace', 'ocramius/proxy-manager'], 'Rackspace');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/ReplicateAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ReplicateAdapterFactory extends AbstractAdapterFactory
{
public function doCreateService(ContainerInterface $container): AdapterInterface
{
if (! \class_exists(Adapter::class)) {
if (! class_exists(Adapter::class)) {
throw new RequirementsException(['league/flysystem-replicate-adapter'], 'Replicate');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/SftpAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SftpAdapterFactory extends AbstractAdapterFactory
{
public function doCreateService(ContainerInterface $container): AdapterInterface
{
if (! \class_exists(Adapter::class)) {
if (! class_exists(Adapter::class)) {
throw new RequirementsException(['league/flysystem-sftp'], 'Sftp');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/VfsAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class VfsAdapterFactory extends AbstractAdapterFactory
{
public function doCreateService(ContainerInterface $container): AdapterInterface
{
if (! \class_exists(Adapter::class)) {
if (! class_exists(Adapter::class)) {
throw new RequirementsException(['league/flysystem-vfs'], 'Vfs');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/WebDAVAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class WebDAVAdapterFactory extends AbstractAdapterFactory
{
public function doCreateService(ContainerInterface $container): AdapterInterface
{
if (! \class_exists(Adapter::class)) {
if (! class_exists(Adapter::class)) {
throw new RequirementsException(['league/flysystem-webdav'], 'WebDAV');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Factory/ZipArchiveAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ZipArchiveAdapterFactory extends AbstractAdapterFactory
{
public function doCreateService(ContainerInterface $container): AdapterInterface
{
if (! \class_exists(Adapter::class)) {
if (! class_exists(Adapter::class)) {
throw new RequirementsException(['league/ziparchive'], 'ZipArchive');
}

Expand Down
8 changes: 4 additions & 4 deletions src/Exception/RequirementsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class RequirementsException extends RuntimeException
{
public function __construct(array $requirements, string $for, int $code = 0, Exception $previous = null)
{
$requirements = \array_map(function ($r) {
return \sprintf("'%s'", \trim($r));
$requirements = array_map(function ($r) {
return sprintf("'%s'", trim($r));
}, $requirements);

$message = \sprintf(
$message = sprintf(
"Install %s to use '%s'",
\implode(' & ', $requirements),
implode(' & ', $requirements),
$for
);

Expand Down
12 changes: 6 additions & 6 deletions src/Filesystem/Factory/FilesystemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public function setCreationOptions(array $options): void

public function createService(ContainerInterface $container): FilesystemInterface
{
if (\method_exists($container, 'getServiceLocator')) {
if (method_exists($container, 'getServiceLocator')) {
$serviceLocator = $container->getServiceLocator();
}

$requestedName = \func_get_arg(2);
$requestedName = func_get_arg(2);

return $this($container, $requestedName);
}
Expand All @@ -67,7 +67,7 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o
$config = $container->get('config');
$fsConfig = $config['bsb_flysystem']['filesystems'][$requestedName];
if (! isset($fsConfig['adapter'])) {
throw new UnexpectedValueException(\sprintf("Missing 'adapter' key for the filesystem '%s' configuration", $requestedName));
throw new UnexpectedValueException(sprintf("Missing 'adapter' key for the filesystem '%s' configuration", $requestedName));
}

if (null !== $options) {
Expand All @@ -81,7 +81,7 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o
$options = $fsConfig['options'] ?? [];

if (isset($fsConfig['cache']) && \is_string($fsConfig['cache'])) {
if (! \class_exists(CachedAdapter::class)) {
if (! class_exists(CachedAdapter::class)) {
throw new RequirementsException(['league/flysystem-cached-adapter'], 'CachedAdapter');
}

Expand All @@ -98,8 +98,8 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o
}
}

if (isset($fsConfig['eventable']) && \filter_var($fsConfig['eventable'], FILTER_VALIDATE_BOOLEAN)) {
if (! \class_exists(EventableFilesystem::class)) {
if (isset($fsConfig['eventable']) && filter_var($fsConfig['eventable'], FILTER_VALIDATE_BOOLEAN)) {
if (! class_exists(EventableFilesystem::class)) {
throw new RequirementsException(['league/flysystem-eventable-filesystem'], 'EventableFilesystem');
}

Expand Down
Loading

0 comments on commit b8fccb3

Please sign in to comment.