add method getFromWithTo()

This commit is contained in:
Uwe Steinmann 2023-04-13 09:05:03 +02:00
parent 762ccbb373
commit a067cc9949

View File

@ -38,23 +38,39 @@ class SeedDMS_ConversionMgr {
*/
protected $success;
public function __construct() {
public function __construct() { /* {{{ */
$this->services = array();
$this->success = true;
}
} /* }}} */
public function addService($service) {
public function addService($service) { /* {{{ */
$service->setConversionMgr($this);
$this->services[$service->from][$service->to][] = $service;
return $service;
}
} /* }}} */
public function hasService($from, $to) {
public function hasService($from, $to) { /* {{{ */
if(!empty($this->services[$from][$to]))
return true;
else
return false;
}
} /* }}} */
/**
* Return the list of mimetypes which can be converted
* into the given mimetype
*
* @param string $askto mimetype to be converted into
* @return array list of from mimetypes
*/
public function getFromWithTo($askto) { /* {{{ */
$fromret = [];
foreach($this->services as $from=>$toservices)
foreach($toservices as $to=>$service)
if($to == $askto)
$fromret[] = $from;
return $fromret;
} /* }}} */
/**
* Return the service that would be tried first for converting