Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Smeagolworms4 committed Apr 11, 2019
1 parent 6a3426b commit 7f0c26e
Show file tree
Hide file tree
Showing 9 changed files with 896 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/vendor/
composer.lock
26 changes: 26 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
language: php

php:
- 7.1

matrix:
fast_finish: true

before_install:
- mkdir ~/bin; wget -O ~/bin/phpunit https://phar.phpunit.de/phpunit-6.1.3.phar; chmod +x ~/bin/phpunit

install: composer update --prefer-dist --no-interaction $COMPOSER_FLAGS

script: ~/bin/phpunit --coverage-text

notifications:
discord:
channels:
- 312160566291971:V7pRJV-3rzpjDuYxKIlbQ7Eihfg4PlIUShhesTdyg4IlRK0G7Akr_jm7SjzK-oqgFc6N
pull_request_template:
- 'Build [#%{build_number}](%{build_url}) ([%{commit}](%{compare_url})) of %{repository}@%{branch} in PR [#%{pull_request_number}](%{pull_request_url}) by %{author} %{result} in %{duration}'
branch_template:
- 'Build [#%{build_number}](%{build_url}) ([%{commit}](%{compare_url})) of %{repository}@%{branch} by %{author} %{result} in %{duration}'
slack: redori:zPaW8aAbTCF9NJh13BtWq9UV
email:
- [email protected]
22 changes: 22 additions & 0 deletions Annotation/SerializerDescribe.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace GollumSF\SerializerDescribeAnnotationBundle\Annotation;

/**
* @Annotation
* @Target({"CLASS"})
*/
class SerializerDescribe {

/** @var array */
private $properties = [];

public function __construct ($param) {
$this->properties = isset($param['value']) ? $param['value'] : [];
}

public function getProperties(): array {
return $this->properties;
}

}
28 changes: 28 additions & 0 deletions DependencyInjection/SerializerPass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace GollumSF\SerializerDescribeAnnotationBundle\DependencyInjection;

use GollumSF\SerializerDescribeAnnotationBundle\Mapping\Loader\AnnotationClassLoader;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

class SerializerPass implements CompilerPassInterface {

public function process(ContainerBuilder $container) {

$container->setDefinition(
AnnotationClassLoader::class,
new Definition(AnnotationClassLoader::class, [
new Reference('annotation_reader')
])
);

$chainLoader = $container->getDefinition('serializer.mapping.chain_loader');
/** @var array $loaders */
$loaders = $chainLoader->getArgument(0);
$loaders[] = $container->getDefinition(AnnotationClassLoader::class);
$loaders = $chainLoader->setArgument(0, $loaders);
}
}
19 changes: 19 additions & 0 deletions GollumSFSerializerDescribeAnnotationBundle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace GollumSF\SerializerDescribeAnnotationBundle;

use GollumSF\SerializerDescribeAnnotationBundle\DependencyInjection\SerializerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
* GollumSFSerializerDescribeAnnotationBundle
*
* @author Damien Duboeuf <[email protected]>
*/
class GollumSFSerializerDescribeAnnotationBundle extends Bundle {

public function build(ContainerBuilder $container) {
$container->addCompilerPass(new SerializerPass());
}
}
Loading

0 comments on commit 7f0c26e

Please sign in to comment.