@@ -76,27 +76,27 @@ class FileJournal extends Nette\Object implements IJournal
7676 private $ processIdentifier ;
7777
7878 /** @var array Cache and uncommitted but changed nodes */
79- private $ nodeCache = array () ;
79+ private $ nodeCache = [] ;
8080
8181 /** @var array */
82- private $ nodeChanged = array () ;
82+ private $ nodeChanged = [] ;
8383
8484 /** @var array */
85- private $ toCommit = array () ;
85+ private $ toCommit = [] ;
8686
8787 /** @var array */
88- private $ deletedLinks = array () ;
88+ private $ deletedLinks = [] ;
8989
9090 /** @var array Free space in data nodes */
91- private $ dataNodeFreeSpace = array () ;
91+ private $ dataNodeFreeSpace = [] ;
9292
9393 /** @var array */
94- private static $ startNode = array (
94+ private static $ startNode = [
9595 self ::TAGS => 0 ,
9696 self ::PRIORITY => 1 ,
9797 self ::ENTRIES => 2 ,
9898 self ::DATA => 3 ,
99- ) ;
99+ ] ;
100100
101101
102102 /**
@@ -151,7 +151,7 @@ public function write($key, array $dependencies)
151151 }
152152 $ exists = TRUE ;
153153 } else { // Already exists, but with other tags or priority
154- $ toDelete = array () ;
154+ $ toDelete = [] ;
155155 foreach ($ dataNode [$ link ][self ::TAGS ] as $ tag ) {
156156 $ toDelete [self ::TAGS ][$ tag ][$ link ] = TRUE ;
157157 }
@@ -186,21 +186,21 @@ public function write($key, array $dependencies)
186186 $ data = $ this ->getNode ($ freeDataNode );
187187
188188 if ($ data === FALSE ) {
189- $ data = array (
190- self ::INFO => array (
189+ $ data = [
190+ self ::INFO => [
191191 self ::LAST_INDEX => ($ freeDataNode << self ::BITROT ),
192192 self ::TYPE => self ::DATA ,
193- )
194- ) ;
193+ ]
194+ ] ;
195195 }
196196
197197 $ dataNodeKey = $ this ->findNextFreeKey ($ freeDataNode , $ data );
198- $ data [$ dataNodeKey ] = array (
198+ $ data [$ dataNodeKey ] = [
199199 self ::KEY => $ key ,
200- self ::TAGS => $ tags ? $ tags : array () ,
200+ self ::TAGS => $ tags ? $ tags : [] ,
201201 self ::PRIORITY => $ priority ,
202202 self ::DELETED => FALSE ,
203- ) ;
203+ ] ;
204204
205205 $ this ->saveNode ($ freeDataNode , $ data );
206206
@@ -240,19 +240,19 @@ public function clean(array $conditions)
240240 $ this ->lock ();
241241
242242 if (!empty ($ conditions [Cache::ALL ])) {
243- $ this ->nodeCache = $ this ->nodeChanged = $ this ->dataNodeFreeSpace = array () ;
243+ $ this ->nodeCache = $ this ->nodeChanged = $ this ->dataNodeFreeSpace = [] ;
244244 $ this ->deleteAll ();
245245 $ this ->unlock ();
246246 return NULL ;
247247 }
248248
249- $ toDelete = array (
250- self ::TAGS => array () ,
251- self ::PRIORITY => array () ,
252- self ::ENTRIES => array ()
253- ) ;
249+ $ toDelete = [
250+ self ::TAGS => [] ,
251+ self ::PRIORITY => [] ,
252+ self ::ENTRIES => []
253+ ] ;
254254
255- $ entries = array () ;
255+ $ entries = [] ;
256256
257257 if (!empty ($ conditions [Cache::TAGS ])) {
258258 $ entries = $ this ->cleanTags ((array ) $ conditions [Cache::TAGS ], $ toDelete );
@@ -262,7 +262,7 @@ public function clean(array $conditions)
262262 $ this ->arrayAppend ($ entries , $ this ->cleanPriority ((int ) $ conditions [Cache::PRIORITY ], $ toDelete ));
263263 }
264264
265- $ this ->deletedLinks = array () ;
265+ $ this ->deletedLinks = [] ;
266266 $ this ->cleanFromIndex ($ toDelete );
267267
268268 $ this ->commit ();
@@ -280,7 +280,7 @@ public function clean(array $conditions)
280280 */
281281 private function cleanTags (array $ tags , array & $ toDelete )
282282 {
283- $ entries = array () ;
283+ $ entries = [] ;
284284
285285 foreach ($ tags as $ tag ) {
286286 list (, $ node ) = $ this ->findIndexNode (self ::TAGS , $ tag );
@@ -307,7 +307,7 @@ private function cleanPriority($priority, array & $toDelete)
307307
308308 ksort ($ node );
309309
310- $ allData = array () ;
310+ $ allData = [] ;
311311
312312 foreach ($ node as $ prior => $ data ) {
313313 if ($ prior === self ::INFO ) {
@@ -351,7 +351,7 @@ private function cleanPriority($priority, array & $toDelete)
351351 */
352352 private function cleanLinks (array $ data , array & $ toDelete )
353353 {
354- $ return = array () ;
354+ $ return = [] ;
355355
356356 $ data = array_keys ($ data );
357357 sort ($ data );
@@ -700,7 +700,7 @@ private function commit()
700700 foreach ($ this ->toCommit as $ node => $ str ) {
701701 $ this ->commitNode ($ node , $ str );
702702 }
703- $ this ->toCommit = array () ;
703+ $ this ->toCommit = [] ;
704704 }
705705
706706
@@ -779,23 +779,23 @@ private function findIndexNode($type, $search, $childId = NULL, $prevId = NULL)
779779 $ node = $ this ->getNode ($ nodeId );
780780
781781 if ($ node === FALSE ) {
782- return array (
782+ return [
783783 $ nodeId ,
784- array (
785- self ::INFO => array (
784+ [
785+ self ::INFO => [
786786 self ::TYPE => $ type ,
787787 self ::IS_LEAF => TRUE ,
788788 self ::PREV_NODE => -1 ,
789789 self ::END => -1 ,
790790 self ::MAX => -1 ,
791- )
792- ) ,
791+ ]
792+ ] ,
793793 $ parentId ,
794- ) ; // Init empty node
794+ ] ; // Init empty node
795795 }
796796
797797 if ($ node [self ::INFO ][self ::IS_LEAF ] || $ nodeId === $ childId || $ node [self ::INFO ][self ::PREV_NODE ] === $ prevId ) {
798- return array ( $ nodeId , $ node , $ parentId) ;
798+ return [ $ nodeId , $ node , $ parentId] ;
799799 }
800800
801801 $ parentId = $ nodeId ;
@@ -824,7 +824,7 @@ private function findIndexNode($type, $search, $childId = NULL, $prevId = NULL)
824824 private function findFreeNode ($ count = 1 )
825825 {
826826 $ id = $ this ->lastNode ;
827- $ nodesId = array () ;
827+ $ nodesId = [] ;
828828
829829 do {
830830 if (isset ($ this ->nodeCache [$ id ])) {
@@ -917,12 +917,12 @@ private function bisectNode($id, array $node)
917917 $ key = key ($ node );
918918
919919 $ dataId = $ this ->findFreeDataNode (self ::NODE_SIZE );
920- $ this ->saveNode ($ dataId , array (
920+ $ this ->saveNode ($ dataId , [
921921 self ::INDEX_DATA => $ node [$ key ],
922- self ::INFO => array (
922+ self ::INFO => [
923923 self ::TYPE => self ::DATA ,
924924 self ::LAST_INDEX => ($ dataId << self ::BITROT ),
925- )) );
925+ ]] );
926926
927927 unset($ node [$ key ]);
928928 $ node [$ key ][self ::INDEX_DATA ] = $ dataId ;
@@ -943,54 +943,54 @@ private function bisectNode($id, array $node)
943943 if ($ id <= 2 ) { // Root
944944 list ($ firstId , $ secondId ) = $ this ->findFreeNode (2 );
945945
946- $ first [self ::INFO ] = array (
946+ $ first [self ::INFO ] = [
947947 self ::TYPE => $ nodeInfo [self ::TYPE ],
948948 self ::IS_LEAF => $ nodeInfo [self ::IS_LEAF ],
949949 self ::PREV_NODE => -1 ,
950950 self ::END => -1 ,
951951 self ::MAX => $ halfKey ,
952- ) ;
952+ ] ;
953953 $ this ->saveNode ($ firstId , $ first );
954954
955- $ second [self ::INFO ] = array (
955+ $ second [self ::INFO ] = [
956956 self ::TYPE => $ nodeInfo [self ::TYPE ],
957957 self ::IS_LEAF => $ nodeInfo [self ::IS_LEAF ],
958958 self ::PREV_NODE => $ firstId ,
959959 self ::END => $ nodeInfo [self ::END ],
960960 self ::MAX => -1 ,
961- ) ;
961+ ] ;
962962 $ this ->saveNode ($ secondId , $ second );
963963
964- $ parentNode = array (
965- self ::INFO => array (
964+ $ parentNode = [
965+ self ::INFO => [
966966 self ::TYPE => $ nodeInfo [self ::TYPE ],
967967 self ::IS_LEAF => FALSE ,
968968 self ::PREV_NODE => -1 ,
969969 self ::END => $ secondId ,
970970 self ::MAX => -1 ,
971- ) ,
971+ ] ,
972972 $ halfKey => $ firstId ,
973- ) ;
973+ ] ;
974974 $ this ->saveNode ($ id , $ parentNode );
975975 } else {
976976 $ firstId = $ this ->findFreeNode ();
977977
978- $ first [self ::INFO ] = array (
978+ $ first [self ::INFO ] = [
979979 self ::TYPE => $ nodeInfo [self ::TYPE ],
980980 self ::IS_LEAF => $ nodeInfo [self ::IS_LEAF ],
981981 self ::PREV_NODE => $ nodeInfo [self ::PREV_NODE ],
982982 self ::END => -1 ,
983983 self ::MAX => $ halfKey ,
984- ) ;
984+ ] ;
985985 $ this ->saveNode ($ firstId , $ first );
986986
987- $ second [self ::INFO ] = array (
987+ $ second [self ::INFO ] = [
988988 self ::TYPE => $ nodeInfo [self ::TYPE ],
989989 self ::IS_LEAF => $ nodeInfo [self ::IS_LEAF ],
990990 self ::PREV_NODE => $ firstId ,
991991 self ::END => $ nodeInfo [self ::END ],
992992 self ::MAX => $ nodeInfo [self ::MAX ],
993- ) ;
993+ ] ;
994994 $ this ->saveNode ($ id , $ second );
995995
996996 list (,, $ parent ) = $ this ->findIndexNode ($ nodeInfo [self ::TYPE ], $ halfKey );
@@ -1077,7 +1077,7 @@ private function lock()
10771077
10781078 $ lastProcessIdentifier = stream_get_contents ($ this ->handle , self ::INT32_SIZE , self ::INT32_SIZE * 2 );
10791079 if ($ lastProcessIdentifier !== $ this ->processIdentifier ) {
1080- $ this ->nodeCache = $ this ->dataNodeFreeSpace = array () ;
1080+ $ this ->nodeCache = $ this ->dataNodeFreeSpace = [] ;
10811081
10821082 // Write current processIdentifier to file header
10831083 fseek ($ this ->handle , self ::INT32_SIZE * 2 );
0 commit comments