11
11
12
12
namespace Symfony \Cmf \Bundle \ResourceRestBundle \Serializer \Jms \Handler ;
13
13
14
- use JMS \Serializer \Handler \ SubscribingHandlerInterface ;
14
+ use JMS \Serializer \Context ;
15
15
use JMS \Serializer \GraphNavigator ;
16
+ use JMS \Serializer \Handler \SubscribingHandlerInterface ;
16
17
use JMS \Serializer \JsonSerializationVisitor ;
17
- use JMS \Serializer \Context ;
18
18
use PHPCR \NodeInterface ;
19
19
use PHPCR \Util \PathHelper ;
20
+ use Symfony \Cmf \Bundle \ResourceRestBundle \Registry \PayloadAliasRegistry ;
20
21
use Symfony \Cmf \Component \Resource \Description \DescriptionFactory ;
21
22
use Symfony \Cmf \Component \Resource \Puli \Api \PuliResource ;
22
- use Symfony \Cmf \Component \Resource \RepositoryRegistryInterface ;
23
23
use Symfony \Cmf \Component \Resource \Repository \Resource \CmfResource ;
24
- use Symfony \Cmf \Bundle \ ResourceRestBundle \ Registry \ PayloadAliasRegistry ;
24
+ use Symfony \Cmf \Component \ Resource \ RepositoryRegistryInterface ;
25
25
26
26
/**
27
27
* Handle PHPCR resource serialization.
@@ -52,14 +52,14 @@ public function __construct(
52
52
53
53
public static function getSubscribingMethods ()
54
54
{
55
- return array (
56
- array (
55
+ return [
56
+ [
57
57
'event ' => GraphNavigator::DIRECTION_SERIALIZATION ,
58
58
'format ' => 'json ' ,
59
59
'type ' => 'Puli\Repository\Api\Resource\PuliResource ' ,
60
60
'method ' => 'serializeResource ' ,
61
- ) ,
62
- ) ;
61
+ ] ,
62
+ ] ;
63
63
}
64
64
65
65
/**
@@ -85,7 +85,7 @@ public function setMaxDepth($maxDepth)
85
85
86
86
private function doSerializeResource (PuliResource $ resource , $ depth = 0 )
87
87
{
88
- $ data = array () ;
88
+ $ data = [] ;
89
89
$ repositoryAlias = $ this ->registry ->getRepositoryName ($ resource ->getRepository ());
90
90
91
91
$ data ['repository_alias ' ] = $ repositoryAlias ;
@@ -105,9 +105,9 @@ private function doSerializeResource(PuliResource $resource, $depth = 0)
105
105
$ data ['label ' ] = $ data ['node_name ' ] = PathHelper::getNodeName ($ data ['path ' ]);
106
106
$ data ['repository_path ' ] = $ resource ->getRepositoryPath ();
107
107
108
- $ children = array () ;
108
+ $ children = [] ;
109
109
foreach ($ resource ->listChildren () as $ name => $ childResource ) {
110
- $ children [$ name ] = array () ;
110
+ $ children [$ name ] = [] ;
111
111
112
112
if ($ depth < $ this ->maxDepth ) {
113
113
$ children [$ name ] = $ this ->doSerializeResource ($ childResource , $ depth + 1 );
0 commit comments