Code Duplication    Length = 9-9 lines in 2 locations

packages/analyzer/src/Declarations.php 1 location

@@ 26-34 (lines=9) @@
23
	/**
24
	 * Scan every PHP in the root
25
	 */
26
	public function scan( $root, $exclude = array() ) {
27
		if ( is_dir( $root ) ) {
28
			return $this->scan_dir( $this->slashit( $root ), $exclude );
29
		} elseif ( is_file( $root ) ) {
30
			return $this->scan_file( $this->slashit( dirname( $root ) ), $root );
31
		} else {
32
			throw new \Exception( "Expected $root to be a file or directory" );
33
		}
34
	}
35
36
	public function scan_dir( $root, $exclude = array() ) {
37

packages/analyzer/src/Invocations.php 1 location

@@ 30-38 (lines=9) @@
27
	/**
28
	 * Scan every PHP in the root
29
	 */
30
	public function scan( $root, $exclude = array() ) {
31
		if ( is_dir( $root ) ) {
32
			return $this->scan_dir( $this->slashit( $root ), $exclude );
33
		} elseif ( is_file( $root ) ) {
34
			return $this->scan_file( $this->slashit( dirname( $root ) ), $root );
35
		} else {
36
			throw new \Exception( "Expected $root to be a file or directory" );
37
		}
38
	}
39
40
	public function scan_dir( $root, $exclude = array() ) {
41
		$filter = function ( $file, $key, $iterator ) use ( $exclude ) {