<?php
/**
 * Created by PhpStorm.
 * User: sunmoon<i@liming.me>
 * Date: 2019/07/29
 * Time: 上午9:39
 */


namespace common\libs\logging\operate\valueType;

class MapData extends AbstractValueType {
    public function result(){
        if(!$this->data || !$this->mapLabel){
            return $this->defaultText;
        }
        $value = $this->handleValue();
        $result = '';
        foreach($value as $id){
            if(isset($this->data[$id]) && !empty($this->data[$id]) && isset($this->data[$id][$this->mapLabel]) && !empty($this->data[$id][$this->mapLabel])){
                $result .= $this->data[$id][$this->mapLabel];
            }
        }
        unset($value);
        return $result;
    }
}