Code Duplication    Length = 9-14 lines in 7 locations

src/Browscap.php 1 location

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

src/Command/ParserCommand.php 1 location

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

src/Command/UpdateCommand.php 1 location

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

src/Command/ConvertCommand.php 1 location

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

src/Command/LogfileCommand.php 1 location

@@ 520-528 (lines=9) @@
517
     *
518
     * @return BrowscapCacheInterface
519
     */
520
    private function getCache(InputInterface $input)
521
    {
522
        if (null === $this->cache) {
523
            $cacheAdapter = new File([File::DIR => $input->getOption('cache')]);
524
            $this->cache  = new BrowscapCache($cacheAdapter);
525
        }
526
527
        return $this->cache;
528
    }
529
}
530

src/BrowscapUpdater.php 1 location

@@ 81-94 (lines=14) @@
78
     *
79
     * @return \BrowscapPHP\Cache\BrowscapCacheInterface
80
     */
81
    public function getCache()
82
    {
83
        if (null === $this->cache) {
84
            $cacheDirectory = __DIR__ . '/../resources/';
85
86
            $cacheAdapter = new File(
87
                [File::DIR => $cacheDirectory]
88
            );
89
90
            $this->cache = new BrowscapCache($cacheAdapter);
91
        }
92
93
        return $this->cache;
94
    }
95
96
    /**
97
     * Sets a cache instance

src/Command/CheckUpdateCommand.php 1 location

@@ 139-147 (lines=9) @@
136
     *
137
     * @return BrowscapCacheInterface
138
     */
139
    private function getCache(InputInterface $input)
140
    {
141
        if (null === $this->cache) {
142
            $cacheAdapter = new File([File::DIR => $input->getOption('cache')]);
143
            $this->cache  = new BrowscapCache($cacheAdapter);
144
        }
145
146
        return $this->cache;
147
    }
148
}
149