-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
1,267 additions
and
775 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
*~ | ||
/vendor/ | ||
/build/ | ||
/composer.lock | ||
/mouf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
language: php | ||
matrix: | ||
include: | ||
- php: 7.2 | ||
env: PREFER_LOWEST="" | ||
- php: 7.1 | ||
env: PREFER_LOWEST="" | ||
- php: 7.1 | ||
env: PREFER_LOWEST="--prefer-lowest" | ||
|
||
before_script: | ||
- composer update $PREFER_LOWEST --no-interaction | ||
- mkdir -p build/logs | ||
script: | ||
- "./vendor/bin/phpunit" | ||
- "./vendor/bin/composer-require-checker" | ||
- composer cs-check | ||
- composer phpstan | ||
after_script: | ||
- php vendor/bin/coveralls -v | ||
- if [ "$COUSCOUS" = "true" ] ; then vendor/bin/couscous travis-auto-deploy --php-version=7.1 -vvv; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="Expressive Skeleton coding standard"> | ||
<description>Expressive Skeleton coding standard</description> | ||
|
||
<!-- display progress --> | ||
<arg value="p"/> | ||
<arg name="colors"/> | ||
|
||
<!-- inherit rules from: --> | ||
<rule ref="PSR2"/> | ||
|
||
<!-- Paths to check --> | ||
<file>src</file> | ||
|
||
<rule ref="Generic.Files.LineLength"> | ||
<properties> | ||
<property name="lineLimit" value="300"/> | ||
<property name="absoluteLineLimit" value="500"/> | ||
</properties> | ||
</rule> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#parameters: | ||
# ignoreErrors: | ||
# - "#Instantiated class WeakRef not found.#" | ||
includes: | ||
- vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
bootstrap="vendor/autoload.php" | ||
> | ||
<testsuites> | ||
<testsuite name="Test Suite"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist processUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php">src/</directory> | ||
</whitelist> | ||
</filter> | ||
<logging> | ||
<log type="coverage-html" target="build/coverage"/> | ||
<log type="coverage-clover" target="build/logs/clover.xml"/> | ||
</logging> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
|
||
|
||
namespace Mouf\Html\Renderer; | ||
|
||
use Interop\Container\ServiceProviderInterface; | ||
use Psr\Container\ContainerInterface; | ||
use Psr\SimpleCache\CacheInterface; | ||
|
||
/** | ||
* This class can be extended to implement easily a service provider that creates "package level" renderers. | ||
*/ | ||
abstract class AbstractPackageRendererServiceProvider implements ServiceProviderInterface | ||
{ | ||
/** | ||
* Returns the path to the templates directory. | ||
* | ||
* @return string | ||
*/ | ||
abstract public static function getTemplateDirectory(): string; | ||
|
||
public static function getPriority(): int | ||
{ | ||
return 0; | ||
} | ||
|
||
/** | ||
* Returns a list of all container entries registered by this service provider. | ||
* | ||
* - the key is the entry name | ||
* - the value is a callable that will return the entry, aka the **factory** | ||
* | ||
* Factories have the following signature: | ||
* function(\Psr\Container\ContainerInterface $container) | ||
* | ||
* @return callable[] | ||
*/ | ||
public function getFactories() | ||
{ | ||
return [ | ||
'packageRenderer_'.static::getTemplateDirectory() => [static::class, 'createRenderer'] | ||
]; | ||
} | ||
|
||
public static function createRenderer(ContainerInterface $container): FileBasedRenderer | ||
{ | ||
return new FileBasedRenderer(static::getTemplateDirectory(), $container->get(CacheInterface::class), $container, $container->get(\Twig_Environment::class)); | ||
} | ||
|
||
/** | ||
* Returns a list of all container entries extended by this service provider. | ||
* | ||
* - the key is the entry name | ||
* - the value is a callable that will return the modified entry | ||
* | ||
* Callables have the following signature: | ||
* function(Psr\Container\ContainerInterface $container, $previous) | ||
* or function(Psr\Container\ContainerInterface $container, $previous = null) | ||
* | ||
* About factories parameters: | ||
* | ||
* - the container (instance of `Psr\Container\ContainerInterface`) | ||
* - the entry to be extended. If the entry to be extended does not exist and the parameter is nullable, `null` will be passed. | ||
* | ||
* @return callable[] | ||
*/ | ||
public function getExtensions() | ||
{ | ||
return [ | ||
'packageRenderers' => [static::class, 'extendPackageRenderersList'] | ||
]; | ||
} | ||
|
||
public static function extendPackageRenderersList(ContainerInterface $container, \SplPriorityQueue $priorityQueue): \SplPriorityQueue | ||
{ | ||
$priorityQueue->insert('packageRenderer_'.static::getTemplateDirectory(), static::getPriority()); | ||
return $priorityQueue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/* | ||
* Copyright (c) 2013 David Negrier | ||
* | ||
* See the file LICENSE.txt for copying permission. | ||
*/ | ||
|
||
namespace Mouf\Html\Renderer; | ||
|
||
/** | ||
* Classes implementing this interface are renderer system that can accept an additional renderer | ||
* (for the template renderer) | ||
* | ||
* @author David Négrier <david@mouf-php.com> | ||
*/ | ||
interface CanSetTemplateRendererInterface extends RendererInterface | ||
{ | ||
/** | ||
* Sets the renderer associated to the template. | ||
* There should be only one if these renderers. | ||
* It is the role of the template to subscribe to this renderer. | ||
* | ||
* @param string $templateRendererInstanceName The name of the template renderer in the container | ||
*/ | ||
public function setTemplateRendererInstanceName(string $templateRendererInstanceName): void; | ||
} |
Oops, something went wrong.