public function setVersion() {
		$wp_filesystem = self::getWpFilesystem();

		// Get installed composer package data.
		$installedFile = wp_normalize_path( realpath( __DIR__ . '/../../../../' ) ) . '/composer/installed.json';

		if ( 'direct' === get_filesystem_method() ) {
			$file = $wp_filesystem->get_contents(  $installedFile );
		} else {
			$installedUrl = str_replace( ABSPATH, get_site_url() . '/', $installedFile );
			$file = wp_remote_retrieve_body( wp_remote_get( $installedUrl ) );
		}

		$installed = json_decode( $file, true );

		// Check for dep's installed version.
		$version = null;
		if ( $installed ) {
			foreach( $installed as $key => $value ) {
				if ( $value['name'] === $this->getDependency() ) {
					$version = $value['version_normalized'];
					break;
				}
			}
		}

		return $version;
	}
public function setVersion() {
		$wp_filesystem = self::getWpFilesystem();

		// Get installed composer package data.
		$installedFile = wp_normalize_path( realpath( __DIR__ . '/../../../../' ) ) . '/composer/installed.json';

		if ( 'direct' === get_filesystem_method() ) {
			$file = $wp_filesystem->get_contents(  $installedFile );
		} else {
			$installedUrl = str_replace( ABSPATH, get_site_url() . '/', $installedFile );
			$file = wp_remote_retrieve_body( wp_remote_get( $installedUrl ) );
		}

		$installed = json_decode( $file, true );

		// Check for dep's installed version.
		$version = null;
		if ( $installed ) {
			foreach( $installed as $key => $value ) {
				if ( $value['name'] === $this->getDependency() ) {
					$version = $value['version_normalized'];
					break;
				}
			}
		}

		return $version;
	}
public function setVersion ( ) { $ wp_filesystem = self :: getWpFilesystem ( ) ; // Get installed composer package data. $ installedFile = wp_normalize_path ( realpath ( __DIR__ . '/../../../../' ) ) . '/composer/installed.json' ; if ( 'direct' === get_filesystem_method ( ) ) { $ file = $ wp_filesystem -> get_contents ( $ installedFile ) ; } else { $ installedUrl = str_replace ( ABSPATH , get_site_url ( ) . '/' , $ installedFile ) ; $ file = wp_remote_retrieve_body ( wp_remote_get ( $ installedUrl ) ) ; } $ installed = json_decode ( $ file , true ) ; // Check for dep's installed version. $ version = null ; if ( $ installed ) { foreach ( $ installed as $ key => $ value ) { if ( $ value [ 'name' ] === $ this -> getDependency ( ) ) { $ version = $ value [ 'version_normalized' ] ; break ; } } } return $ version ; }
Sets the version of dependency.

@since  1.0.0

@return mixed $version Normalized version number if found or null.
Sets the version of dependency .