Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4793797
Solver.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
Solver.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Keruald\OmniTools\Registration\PSR4
;
final
class
Solver
{
/**
* @var string
*/
private
$namespace
;
/**
* @var string The base path for the namespace
*/
private
$path
;
/**
* @var string The fully qualified class name
*/
private
$class
;
///
/// Constructors
///
public
function
__construct
(
string
$namespace
,
string
$path
,
string
$class
)
{
$this
->
namespace
=
$namespace
;
$this
->
path
=
$path
;
$this
->
class
=
$class
;
}
///
/// Resolve methods
///
public
function
resolve
()
:
string
{
return
$this
->
path
.
'/'
.
$this
->
getRelativePath
();
}
public
function
canResolve
()
:
bool
{
return
str_starts_with
(
$this
->
class
,
$this
->
namespace
);
}
public
static
function
getPathFor
(
string
$name
)
:
string
{
return
str_replace
(
"
\\
"
,
"/"
,
$name
)
.
'.php'
;
}
///
/// Helper methods
///
private
function
getRelativePath
()
:
string
{
return
self
::
getPathFor
(
$this
->
getLocalClassName
());
}
private
function
getLocalClassName
()
:
string
{
$len
=
strlen
(
$this
->
namespace
);
return
substr
(
$this
->
class
,
$len
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Feb 28, 22:47 (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2436129
Default Alt Text
Solver.php (1 KB)
Attached To
Mode
rKOT Keruald OmniTools
Attached
Detach File
Event Timeline
Log In to Comment