@@ -20,9 +20,9 @@ class AlgoliaIndexListener implements EventSubscriberInterface
20
20
*/
21
21
public static function getSubscribedEvents ()
22
22
{
23
- return array (
23
+ return [
24
24
Sculpin::EVENT_AFTER_RUN => 'afterRun ' ,
25
- ) ;
25
+ ] ;
26
26
}
27
27
28
28
/**
@@ -32,18 +32,18 @@ public static function getSubscribedEvents()
32
32
public function __construct (Client $ client , $ indexName )
33
33
{
34
34
$ this ->index = $ client ->initIndex ($ indexName );
35
- $ this ->index ->setSettings (array (
36
- " attributesToIndex " => array ( " title " , " tags " , " unordered(body) " ) ,
37
- 'attributesForFaceting ' => array ( 'tags ' )
38
- ) );
35
+ $ this ->index ->setSettings ([
36
+ ' attributesToIndex ' => [ ' title ' , ' tags ' , ' unordered(body) ' ] ,
37
+ 'attributesForFaceting ' => [ 'tags ' ]
38
+ ] );
39
39
}
40
40
41
41
/**
42
- * @param \Sculpin\Core\Event\ SourceSetEvent $event
42
+ * @param SourceSetEvent $event
43
43
*/
44
44
public function afterRun (SourceSetEvent $ event )
45
45
{
46
- $ documents = array () ;
46
+ $ documents = [] ;
47
47
/** @var AbstractSource $item */
48
48
foreach ($ event ->allSources () as $ item ) {
49
49
if ($ item ->data ()->get ('indexed ' )) {
@@ -65,15 +65,15 @@ public function afterRun(SourceSetEvent $event)
65
65
*/
66
66
private function parseSource (AbstractSource $ source )
67
67
{
68
- $ document = array (
68
+ $ document = [
69
69
'objectID ' => sha1 ($ source ->sourceId ()),
70
70
'title ' => $ source ->data ()->get ('title ' ),
71
71
'body ' => strip_tags ($ source ->content ()),
72
72
'url ' => rtrim ($ source ->permalink ()->relativeUrlPath (), '/ ' ).'/ ' ,
73
73
'date ' => $ source ->data ()->get ('calculated_date ' ),
74
- ) ;
74
+ ] ;
75
75
76
- $ tags = ( is_array ($ source ->data ()->get ('tags ' ))) ? $ source ->data ()->get ('tags ' ) : array () ;
76
+ $ tags = is_array ($ source ->data ()->get ('tags ' )) ? $ source ->data ()->get ('tags ' ) : [] ;
77
77
if ($ tags ) {
78
78
$ document ['tags ' ] = $ tags ;
79
79
}
0 commit comments