Code Duplication    Length = 25-28 lines in 2 locations

lib/ar/store.php 2 locations

@@ 315-342 (lines=28) @@
312
			if ( $template instanceof ar_listExpression_Pattern ) {
313
				$template = ar::listExpression( $this->count() )->pattern( $template );
314
			}
315
			if ( ar_store::$rememberShortcuts) {
316
				$path     = ar_store::makePath( $this->path );
317
				$realpath = ar_store::makeRealPath( $this->path );
318
				if ($realpath != $path ) {
319
					// must do a call for each seperate path.
320
					$list   = array();
321
					$parent = $path;
322
					while ( $realpath != $this->top && $parent != $this->top && end( $list ) != $realpath ) {
323
						$list[$parent] = $realpath;
324
						$parent        = ar_store::makePath( $parent . '../' );
325
						$realpath      = ar_store::makeRealPath( $parent );
326
					}
327
					if ( ( $realpath == $this->top ) || ( $parent == $this->top ) ) {
328
						$list[$parent] = $realpath;
329
					}
330
					$list = array_reverse( $list );
331
					$result = array();
332
					foreach ( $list as $virtualpath => $path ) {
333
						$result[$virtualpath] = current( $store->call( $template, $args,
334
							$store->get( $path ),
335
							array(
336
								'usePathAsKey' => true
337
							)
338
						) );
339
					}
340
					return $result;
341
				}
342
			}
343
			return $store->call( $template, $args,
344
				$store->parents( $this->path, $this->top ),
345
				array( 'usePathAsKey' => true )
@@ 352-376 (lines=25) @@
349
		public function info(){
350
			global $store;
351
352
			if ( ar_store::$rememberShortcuts) {
353
				$path     = ar_store::makePath( $this->path );
354
				$realpath = ar_store::makeRealPath( $this->path );
355
				if ($realpath != $path ) {
356
					// must do a call for each seperate path.
357
					$list   = array();
358
					$parent = $path;
359
					while ( $realpath != $this->top && $parent != $this->top && end( $list ) != $realpath ) {
360
						$list[$parent] = $realpath;
361
						$parent        = ar_store::makePath( $parent . '../' );
362
						$realpath      = ar_store::makeRealPath( $parent );
363
					}
364
					if ( ( $realpath == $this->top ) || ( $parent == $this->top ) ) {
365
						$list[$parent] = $realpath;
366
					}
367
					$list = array_reverse( $list );
368
					$result = array();
369
					foreach ( $list as $virtualpath => $path ) {
370
						$result[$virtualpath] = current( $store->info(
371
							$store->get( $path )
372
						));
373
					}
374
					return $result;
375
				}
376
			}
377
378
			return $store->info(
379
				$store->parents( $this->path, $this->top ), array( 'usePathAsKey' => true )