<?php

namespace FernleafSystems\Wordpress\Services\Utilities\WpOrg\Hashes;

use FernleafSystems\Wordpress\Services;

/**
 * Class Plugin
 * @package FernleafSystems\Wordpress\Services\Utilities\WpOrg\Hashes
 */
class Plugin extends Base {

	const API_ENDPOINT = 'plugin';

	/**
	 * @param string $sSlug
	 * @param string $sVersion
	 * @param string $sHashAlgo
	 * @return array|null
	 */
	public function getHashes( $sSlug, $sVersion, $sHashAlgo = null ) {
		$oReq = new HashesRequestVO();
		$oReq->version = $sVersion;
		$oReq->hash = $sHashAlgo;
		$oReq->slug = $sSlug;
		return $this->queryHashes( $oReq );
	}

	/**
	 * @param Services\Core\VOs\WpPluginVo $oPluginVO
	 * @return array|null
	 */
	public function getHashesFromVO( Services\Core\VOs\WpPluginVo $oPluginVO ) {
		return $this->getHashes( $oPluginVO->slug, $oPluginVO->Version, $this->getHashAlgo() );
	}
}