Code Duplication    Length = 9-14 lines in 7 locations

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
                [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/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/CheckUpdateCommand.php 1 location

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

src/Command/ConvertCommand.php 1 location

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

src/Command/LogfileCommand.php 1 location

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

src/Command/UpdateCommand.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([File::DIR => $input->getOption('cache')]);
157
            $this->cache  = new BrowscapCache($cacheAdapter);
158
        }
159
160
        return $this->cache;
161
    }
162
}
163