1<?php
2/**
3 * FarmSync DokuWiki Plugin
4 *
5 * @author Michael Große <grosse@cosmocode.de>
6 * @license GPL 2
7 */
8
9namespace dokuwiki\plugin\farmsync\meta;
10
11/**
12 * Base class to hold the results of a single update operation
13 */
14class UpdateResults {
15
16    private $_finalText = "";
17    private $_mergeResult;
18    private $_animal;
19    private $_item;
20
21    /** @var \helper_plugin_farmsync helper */
22    protected $helper;
23    /** @var FarmSyncUtil */
24    protected $_farm_util;
25
26    /**
27     * UpdateResults constructor.
28     *
29     * @param string $item ID of the item that was updated
30     * @param string $animal the animal that was updated
31     */
32    function __construct($item, $animal) {
33        $this->_item = $item;
34        $this->_animal = $animal;
35        $this->_farm_util = new FarmSyncUtil();
36
37        $this->helper = plugin_load('helper', 'farmsync');
38    }
39
40    /**
41     * @return string
42     */
43    public function getFinalText() {
44        return $this->_finalText;
45    }
46
47    /**
48     * @param string $finalText
49     */
50    public function setFinalText($finalText) {
51        $this->_finalText = $finalText;
52    }
53
54    /**
55     * @return string
56     */
57    public function getMergeResult() {
58        return $this->_mergeResult;
59    }
60
61    /**
62     * @param string $mergeResult
63     */
64    public function setMergeResult($mergeResult) {
65        $this->_mergeResult = $mergeResult;
66    }
67
68    /**
69     * Return the result as formatted HTML
70     *
71     * @return string
72     */
73    public function getResultLine() {
74        $text = $this->helper->getLang('mergeresult:' . $this->getMergeResult());
75
76        return '<code>' . $this->getItem() . '</code> ' . $text;
77    }
78
79    /**
80     * @return string
81     */
82    public function getAnimal() {
83        return $this->_animal;
84    }
85
86    /**
87     * @param string $animal
88     */
89    public function setAnimal($animal) {
90        $this->_animal = $animal;
91    }
92
93    /**
94     * @return string
95     */
96    public function getItem() {
97        return $this->_item;
98    }
99
100}
101
102
103
104
105
106
107