1.0.0 Alpha Release #59
1 changed files with 26 additions and 1 deletions
|
@ -4,8 +4,12 @@
|
||||||
|
|
||||||
namespace ncc\Utilities;
|
namespace ncc\Utilities;
|
||||||
|
|
||||||
|
use ncc\Abstracts\BuiltinRemoteSourceType;
|
||||||
|
use ncc\Abstracts\DefinedRemoteSourceType;
|
||||||
use ncc\Abstracts\LogLevel;
|
use ncc\Abstracts\LogLevel;
|
||||||
|
use ncc\Abstracts\RemoteSourceType;
|
||||||
use ncc\Abstracts\Scopes;
|
use ncc\Abstracts\Scopes;
|
||||||
|
use ncc\Managers\RemoteSourcesManager;
|
||||||
|
|
||||||
class Resolver
|
class Resolver
|
||||||
{
|
{
|
||||||
|
@ -241,4 +245,25 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detects the remote source type, can also accept defined remote
|
||||||
|
* sources as the input, the function will look for the source
|
||||||
|
* type and return it
|
||||||
|
*
|
||||||
|
* @param string $input
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function detectRemoteSourceType(string $input): string
|
||||||
|
{
|
||||||
|
if(in_array($input, BuiltinRemoteSourceType::All))
|
||||||
|
return RemoteSourceType::Builtin;
|
||||||
|
|
||||||
|
$source_manager = new RemoteSourcesManager();
|
||||||
|
$defined_source = $source_manager->getRemoteSource($input);
|
||||||
|
if($defined_source == null)
|
||||||
|
return RemoteSourceType::Unknown;
|
||||||
|
|
||||||
|
return $defined_source->Type;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue