public function find($keyword, $comp = null, $type = self::FIND_TYPE_KEY_ONLY){
        $this->_targetLineNumber = null;
        $items = $this->getTargetLines();
        foreach ($items as $lineNumber => $line){
            $line = trim(trim($line),',');
            $arr = explode('=>', $line);
            foreach ($arr as $idx => $item){
                $arr[$idx] = trim($item);
            }
            $key = $arr[0];
            if(count($arr)>1){
                $val = $arr[1];
            } else{
                $val = $arr[0];
            }
            $key = str_replace("'","", $key);
            $val = str_replace("'","", $val);
//            echo '     '.__method__.'() line:'.__line__.'   $key  = '.print_r($key, true).PHP_EOL;
//            echo '     '.__method__.'() line:'.__line__.'   $val  = '.print_r($val, true).PHP_EOL;
            $ret = null;
            switch ($type){
                case self::FIND_TYPE_ALL:
                    if($key == $keyword || $val == $comp ){
                        $this->_targetLineNumber = $lineNumber;
                        return $val;
                    }
                    break;

                case self::FIND_TYPE_KEY_ONLY:
                    if($key == $keyword){
                        $this->_targetLineNumber = $lineNumber;
                        return $val;
                    }
                    break;
                case self::FIND_TYPE_VALUE_ONLY:
                    if($val == $keyword){
                        $this->_targetLineNumber = $lineNumber;
                        return $val;
                    }
                    break;
            }
        }
        return null;
    }
public function find($keyword, $comp = null, $type = self::FIND_TYPE_KEY_ONLY){
        $this->_targetLineNumber = null;
        $items = $this->getTargetLines();
        foreach ($items as $lineNumber => $line){
            $line = trim(trim($line),',');
            $arr = explode('=>', $line);
            foreach ($arr as $idx => $item){
                $arr[$idx] = trim($item);
            }
            $key = $arr[0];
            if(count($arr)>1){
                $val = $arr[1];
            } else{
                $val = $arr[0];
            }
            $key = str_replace("'","", $key);
            $val = str_replace("'","", $val);
//            echo '     '.__method__.'() line:'.__line__.'   $key  = '.print_r($key, true).PHP_EOL;
//            echo '     '.__method__.'() line:'.__line__.'   $val  = '.print_r($val, true).PHP_EOL;
            $ret = null;
            switch ($type){
                case self::FIND_TYPE_ALL:
                    if($key == $keyword || $val == $comp ){
                        $this->_targetLineNumber = $lineNumber;
                        return $val;
                    }
                    break;

                case self::FIND_TYPE_KEY_ONLY:
                    if($key == $keyword){
                        $this->_targetLineNumber = $lineNumber;
                        return $val;
                    }
                    break;
                case self::FIND_TYPE_VALUE_ONLY:
                    if($val == $keyword){
                        $this->_targetLineNumber = $lineNumber;
                        return $val;
                    }
                    break;
            }
        }
        return null;
    }
public function find ( $ keyword , $ comp = null , $ type = self :: FIND_TYPE_KEY_ONLY ) { $ this -> _targetLineNumber = null ; $ items = $ this -> getTargetLines ( ) ; foreach ( $ items as $ lineNumber => $ line ) { $ line = trim ( trim ( $ line ) , ',' ) ; $ arr = explode ( '=>' , $ line ) ; foreach ( $ arr as $ idx => $ item ) { $ arr [ $ idx ] = trim ( $ item ) ; } $ key = $ arr [ 0 ] ; if ( count ( $ arr ) > 1 ) { $ val = $ arr [ 1 ] ; } else { $ val = $ arr [ 0 ] ; } $ key = str_replace ( "'" , "" , $ key ) ; $ val = str_replace ( "'" , "" , $ val ) ; //            echo '     '.__method__.'() line:'.__line__.'   $key  = '.print_r($key, true).PHP_EOL; //            echo '     '.__method__.'() line:'.__line__.'   $val  = '.print_r($val, true).PHP_EOL; $ ret = null ; switch ( $ type ) { case self :: FIND_TYPE_ALL : if ( $ key == $ keyword || $ val == $ comp ) { $ this -> _targetLineNumber = $ lineNumber ; return $ val ; } break ; case self :: FIND_TYPE_KEY_ONLY : if ( $ key == $ keyword ) { $ this -> _targetLineNumber = $ lineNumber ; return $ val ; } break ; case self :: FIND_TYPE_VALUE_ONLY : if ( $ val == $ keyword ) { $ this -> _targetLineNumber = $ lineNumber ; return $ val ; } break ; } } return null ; }
if the target array contains a key or value
if the target array contains a key or value