Code Duplication    Length = 16-16 lines in 3 locations

src/Content/CPageContent.php 1 location

@@ 96-111 (lines=16) @@
93
     *
94
     * @return array as table of content.
95
     */
96
    public function getTableOfContent($id)
97
    {
98
        if ($this->toc) {
99
            return $this->toc;
100
        }
101
102
        $key = $this->di->cache->createKey(__CLASS__, 'toc-' . $id);
103
        $this->toc = $this->di->cache->get($key);
104
105
        if (!$this->toc) {
106
            $this->toc = $this->createTableOfContent();
107
            $this->di->cache->put($key, $this->toc);
108
        }
109
110
        return $this->toc;
111
    }
112
113
114

src/Content/CFileBasedContent.php 2 locations

@@ 73-88 (lines=16) @@
70
     *
71
     * @return array as index.
72
     */
73
    private function loadIndex()
74
    {
75
        if ($this->index) {
76
            return $this->index;
77
        }
78
79
        $key = $this->di->cache->createKey(__CLASS__, "index");
80
        $this->index = $this->di->cache->get($key);
81
82
        if (!$this->index || $this->ignoreCache) {
83
            $this->index = $this->createIndex();
84
            $this->di->cache->put($key, $this->index);
85
        }
86
87
        return $this->index;
88
    }
89
90
91
@@ 142-157 (lines=16) @@
139
     *
140
     * @return array as index.
141
     */
142
    private function loadMetaIndex()
143
    {
144
        if ($this->meta) {
145
            return $this->meta;
146
        }
147
148
        $key = $this->di->cache->createKey(__CLASS__, "meta");
149
        $this->meta = $this->di->cache->get($key);
150
151
        if (!$this->meta || $this->ignoreCache) {
152
            $this->meta = $this->createMetaIndex();
153
            $this->di->cache->put($key, $this->meta);
154
        }
155
156
        return $this->meta;
157
    }
158
159
160