Code Duplication    Length = 9-14 lines in 7 locations

src/Browscap.php 1 location

@@ 115-128 (lines=14) @@
112
     *
113
     * @return \BrowscapPHP\Cache\BrowscapCacheInterface
114
     */
115
    public function getCache()
116
    {
117
        if (null === $this->cache) {
118
            $cacheDirectory = __DIR__.'/../resources/';
119
120
            $cacheAdapter = new File(
121
                array(File::DIR => $cacheDirectory)
122
            );
123
124
            $this->cache = new BrowscapCache($cacheAdapter);
125
        }
126
127
        return $this->cache;
128
    }
129
130
    /**
131
     * Sets a cache instance

src/BrowscapUpdater.php 1 location

@@ 95-108 (lines=14) @@
92
     *
93
     * @return \BrowscapPHP\Cache\BrowscapCacheInterface
94
     */
95
    public function getCache()
96
    {
97
        if (null === $this->cache) {
98
            $cacheDirectory = __DIR__.'/../resources/';
99
100
            $cacheAdapter = new File(
101
                array(File::DIR => $cacheDirectory)
102
            );
103
104
            $this->cache = new BrowscapCache($cacheAdapter);
105
        }
106
107
        return $this->cache;
108
    }
109
110
    /**
111
     * Sets a cache instance

src/Command/CheckUpdateCommand.php 1 location

@@ 152-160 (lines=9) @@
149
     *
150
     * @return BrowscapCacheInterface
151
     */
152
    private function getCache(InputInterface $input)
153
    {
154
        if (null === $this->cache) {
155
            $cacheAdapter = new File(array(File::DIR => $input->getOption('cache')));
156
            $this->cache  = new BrowscapCache($cacheAdapter);
157
        }
158
159
        return $this->cache;
160
    }
161
}
162

src/Command/ConvertCommand.php 1 location

@@ 167-175 (lines=9) @@
164
     *
165
     * @return BrowscapCacheInterface
166
     */
167
    private function getCache(InputInterface $input)
168
    {
169
        if (null === $this->cache) {
170
            $cacheAdapter = new File(array(File::DIR => $input->getOption('cache')));
171
            $this->cache  = new BrowscapCache($cacheAdapter);
172
        }
173
174
        return $this->cache;
175
    }
176
}
177

src/Command/LogfileCommand.php 1 location

@@ 550-558 (lines=9) @@
547
     *
548
     * @return BrowscapCacheInterface
549
     */
550
    private function getCache(InputInterface $input)
551
    {
552
        if (null === $this->cache) {
553
            $cacheAdapter = new File(array(File::DIR => $input->getOption('cache')));
554
            $this->cache  = new BrowscapCache($cacheAdapter);
555
        }
556
557
        return $this->cache;
558
    }
559
}
560

src/Command/ParserCommand.php 1 location

@@ 153-161 (lines=9) @@
150
     *
151
     * @return BrowscapCacheInterface
152
     */
153
    private function getCache(InputInterface $input)
154
    {
155
        if (null === $this->cache) {
156
            $cacheAdapter = new File(array(File::DIR => $input->getOption('cache')));
157
            $this->cache  = new BrowscapCache($cacheAdapter);
158
        }
159
160
        return $this->cache;
161
    }
162
}
163

src/Command/UpdateCommand.php 1 location

@@ 158-166 (lines=9) @@
155
     *
156
     * @return BrowscapCacheInterface
157
     */
158
    private function getCache(InputInterface $input)
159
    {
160
        if (null === $this->cache) {
161
            $cacheAdapter = new File(array(File::DIR => $input->getOption('cache')));
162
            $this->cache  = new BrowscapCache($cacheAdapter);
163
        }
164
165
        return $this->cache;
166
    }
167
}
168