Code Duplication    Length = 17-19 lines in 2 locations

lib/Command/Queue.php 1 location

@@ 143-159 (lines=17) @@
140
	 * @param Folder $folder
141
	 * TODO: It is inefficient since it copies the array recursively.
142
	 */
143
	private function getPicturesFromFolder(Folder $folder, $results = array()) {
144
		//$this->output->writeln('Scanning folder ' . $folder->getPath());
145
146
		$nodes = $folder->getDirectoryListing();
147
148
		foreach ($nodes as $node) {
149
			//if ($node->isHidden())
150
			//	continue;
151
			if ($node instanceof Folder and !$node->nodeExists('.nomedia')) {
152
				$results = $this->getPicturesFromFolder($node, $results);
153
			} else if ($node instanceof File and Requirements::isImageTypeSupported($node->getMimeType())) {
154
				$results[] = $node;
155
			}
156
		}
157
158
		return $results;
159
	}
160
161
162
	/**

lib/BackgroundJob/Tasks/AddMissingImagesTask.php 1 location

@@ 154-172 (lines=19) @@
151
	 * @param Folder $folder Folder to get images from
152
	 * @return array List of all images and folders to continue recursive crawling
153
	 */
154
	private function getPicturesFromFolder(Folder $folder, $results = array()) {
155
		$nodes = $folder->getDirectoryListing();
156
157
		foreach ($nodes as $node) {
158
			//if ($node->isHidden())
159
			//	continue;
160
			// $previewImage = new \OC_Image();
161
			// $previewImage->loadFromData($preview->getContent());
162
			if ($node instanceof Folder and !$node->nodeExists('.nomedia')) {
163
				$results = $this->getPicturesFromFolder($node, $results);
164
			} else if ($node instanceof File) {
165
				if (Requirements::isImageTypeSupported($node->getMimeType())) {
166
					$results[] = $node;
167
				}
168
			}
169
		}
170
171
		return $results;
172
	}
173
}
174