Code Duplication    Length = 9-14 lines in 7 locations

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

src/Browscap.php 1 location

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

src/BrowscapUpdater.php 1 location

@@ 88-101 (lines=14) @@
85
     *
86
     * @return \BrowscapPHP\Cache\BrowscapCacheInterface
87
     */
88
    public function getCache()
89
    {
90
        if (null === $this->cache) {
91
            $cacheDirectory = __DIR__.'/../resources/';
92
93
            $cacheAdapter = new File(
94
                array(File::DIR => $cacheDirectory)
95
            );
96
97
            $this->cache = new BrowscapCache($cacheAdapter);
98
        }
99
100
        return $this->cache;
101
    }
102
103
    /**
104
     * Sets a cache instance

src/Command/CheckUpdateCommand.php 1 location

@@ 144-152 (lines=9) @@
141
     *
142
     * @return BrowscapCacheInterface
143
     */
144
    private function getCache(InputInterface $input)
145
    {
146
        if (null === $this->cache) {
147
            $cacheAdapter = new File(array(File::DIR => $input->getOption('cache')));
148
            $this->cache  = new BrowscapCache($cacheAdapter);
149
        }
150
151
        return $this->cache;
152
    }
153
}
154

src/Command/ConvertCommand.php 1 location

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

src/Command/LogfileCommand.php 1 location

@@ 524-532 (lines=9) @@
521
     *
522
     * @return BrowscapCacheInterface
523
     */
524
    private function getCache(InputInterface $input)
525
    {
526
        if (null === $this->cache) {
527
            $cacheAdapter = new File(array(File::DIR => $input->getOption('cache')));
528
            $this->cache  = new BrowscapCache($cacheAdapter);
529
        }
530
531
        return $this->cache;
532
    }
533
}
534