/**
  * Parse a block from an array
  * @param array $data
  *
  * @return Block|null
  */
 private function parseBlock(array $data)
 {
     $block = new Block();
     $block->setItemSet($this->itemSet);
     //Type
     if (isset($data['type'])) {
         $block->setType($data['type']);
     } else {
         $block->setType("Block");
     }
     //RecMath
     if (isset($data['recMath'])) {
         $block->setRecMath(new \SplBool(@(bool) $data['recMath']));
     }
     //MinSummonerLevel
     if (isset($data['minSummonerLevel'])) {
         $block->setMinSummonerLevel(new \SplInt(@(int) $data['minSummonerLevel']));
     }
     //MaxSummonerLevel
     if (isset($data['maxSummonerLevel'])) {
         $block->setMaxSummonerLevel(new \SplInt(@(int) $data['maxSummonerLevel']));
     }
     //showIfSummonerSpell
     if (isset($data['showIfSummonerSpell'])) {
         $spell = $this->summonerSpellList->getSpell($data['showIfSummonerSpell']);
         if ($spell != null) {
             $block->setShowIfSummonerSpell($spell);
         }
     }
     //hideIfSummonerSpell
     if (isset($data['hideIfSummonerSpell'])) {
         $spell = $this->summonerSpellList->getSpell($data['hideIfSummonerSpell']);
         if ($spell != null) {
             $block->setHideIfSummonerSpell($spell);
         }
     }
     //Comments
     if (isset($data['comment'])) {
         $block->setComment($data['comment']);
     }
     if (isset($data['items'])) {
         ksort($data['items']);
         $block->setItems($this->parseItems($data['items'], $block));
     }
     if (empty($block->getItems())) {
         return null;
     }
     return $block;
 }
 /**
  * Parse a block from an array
  * @param array $json
  *
  * @return Block|null null if empty
  */
 private function parseBlock(array $json)
 {
     $block = new Block();
     $block->setItemSet($this->itemSet);
     //Type
     if (isset($json['type'])) {
         $block->setType($json['type']);
     } else {
         $block->setType("Block");
     }
     //RecMath
     if (isset($json['recMath'])) {
         $block->setRecMath(new \SplBool(@(bool) $json['recMath']));
     }
     //MinSummonerLevel
     if (isset($json['minSummonerLevel'])) {
         $block->setMinSummonerLevel(new \SplInt(@(int) $json['minSummonerLevel']));
     }
     //MaxSummonerLevel
     if (isset($json['maxSummonerLevel'])) {
         $block->setMaxSummonerLevel(new \SplInt(@(int) $json['maxSummonerLevel']));
     }
     //showIfSummonerSpell
     if (isset($json['showIfSummonerSpell'])) {
         $spell = $this->summonerSpellList->getSpellFromKey($json['showIfSummonerSpell']);
         if ($spell != null) {
             $block->setShowIfSummonerSpell($spell);
         }
     }
     //hideIfSummonerSpell
     if (isset($json['hideIfSummonerSpell'])) {
         $spell = $this->summonerSpellList->getSpellFromKey($json['hideIfSummonerSpell']);
         if ($spell != null) {
             $block->setHideIfSummonerSpell($spell);
         }
     }
     foreach ($json['items'] as $item) {
         $i = $this->parseItem($item, $block);
         if ($i != null) {
             $block->addItem($i);
         }
     }
     if (empty($block->getItems())) {
         return null;
     }
     return $block;
 }