Completed
Push — try/composer-jetpack-logo-depe... ( 8eeb81 )
by
unknown
07:25
created

Assets_Manager::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Jetpack\Assets;
4
5
class Assets_Manager implements Assets_Manager_Interface {
6
7
	private $image_directory_path = '';
8
9
	public function __construct( $assets_directory = array() ) {
10
11
		if ( isset( $assets_directory['images'] ) ) {
12
			$image_path_relative_to_wp_content = \substr( realpath( $assets_directory['images'] ), strlen( WP_CONTENT_DIR ) );
13
			$this->image_directory_path        = '/' . \trim( $image_path_relative_to_wp_content, '/' ) . '/';
14
		}
15
	}
16
17
	public function get_image_url( $image ) {
18
		return \content_url( $this->image_directory_path . $image );
19
	}
20
}
21