Skip to content

Commit 73bcfe6

Browse files
committed
Merge pull request #26 from BackEndTea/patch-1
1 parent 150fa0a commit 73bcfe6

File tree

8 files changed

+158
-51
lines changed

8 files changed

+158
-51
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ composer require boson-php/runtime
2626

2727
## Documentation
2828

29-
- You can learn more [about what a Boson is](https://bosonphp.com/doc/0.17/introduction).
30-
- Information [about the configs](https://bosonphp.com/doc/0.17/configuration) is
31-
available on the [corresponding pages](https://bosonphp.com/doc/0.17/application-configuration).
32-
- A more detailed description of working with the [application](https://bosonphp.com/doc/0.17/application),
33-
[windows](https://bosonphp.com/doc/0.17/window) and [webview](https://bosonphp.com/doc/0.17/webview)
29+
- You can learn more [about what a Boson is](https://bosonphp.com/doc/0.19/introduction).
30+
- Information [about the configs](https://bosonphp.com/doc/0.19/configuration) is
31+
available on the [corresponding pages](https://bosonphp.com/doc/0.19/application-configuration).
32+
- A more detailed description of working with the [application](https://bosonphp.com/doc/0.19/application),
33+
[windows](https://bosonphp.com/doc/0.19/window) and [webview](https://bosonphp.com/doc/0.19/webview)
3434
is also available.
3535
- Also, do not miss the detailed guide on additional apps for working with
36-
[function bindings](https://bosonphp.com/doc/0.17/bindings-api),
37-
[scripts](https://bosonphp.com/doc/0.17/scripts-api),
38-
[request interception](https://bosonphp.com/doc/0.17/schemes-api), and more.
36+
[function bindings](https://bosonphp.com/doc/0.19/bindings-api),
37+
[scripts](https://bosonphp.com/doc/0.19/scripts-api),
38+
[request interception](https://bosonphp.com/doc/0.19/schemes-api), and more.
3939
- If you want to build an application based on
40-
[Symfony](https://bosonphp.com/doc/0.17/symfony-adapter),
41-
[Laravel](https://bosonphp.com/doc/0.17/laravel-adapter) and
42-
[others](https://bosonphp.com/doc/0.17/psr7-adapter),
40+
[Symfony](https://bosonphp.com/doc/0.19/symfony-adapter),
41+
[Laravel](https://bosonphp.com/doc/0.19/laravel-adapter) and
42+
[others](https://bosonphp.com/doc/0.19/psr7-adapter),
4343
then similar functionality is also available.
4444

4545
## Community
@@ -50,5 +50,5 @@ composer require boson-php/runtime
5050
## Contributing
5151

5252
Boson is an Open Source, [community-driven project](https://github.com/boson-php/boson/graphs/contributors).
53-
Join them [contributing code](https://bosonphp.com/doc/0.17/contribution).
53+
Join them [contributing code](https://bosonphp.com/doc/0.19/contribution).
5454

composer.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@
1818
"php": "^8.4",
1919
"ext-ffi": "*",
2020
"ext-iconv": "*",
21-
"boson-php/cpu-info": "^0.18",
22-
"boson-php/event-listener-contracts": "^0.18",
23-
"boson-php/http": "^0.18",
24-
"boson-php/http-contracts": "^0.18",
25-
"boson-php/id-contracts": "^0.18",
26-
"boson-php/value-object-contracts": "^0.18",
27-
"boson-php/os-info": "^0.18",
28-
"boson-php/saucer": "^0.18",
29-
"boson-php/uri": "^0.18",
30-
"boson-php/uri-contracts": "^0.18",
31-
"boson-php/uri-factory": "^0.18",
32-
"boson-php/uri-factory-contracts": "^0.18",
33-
"boson-php/weak-types": "^0.18",
21+
"boson-php/cpu-info": "^0.19",
22+
"boson-php/event-listener-contracts": "^0.19",
23+
"boson-php/http": "^0.19",
24+
"boson-php/http-contracts": "^0.19",
25+
"boson-php/id-contracts": "^0.19",
26+
"boson-php/value-object-contracts": "^0.19",
27+
"boson-php/os-info": "^0.19",
28+
"boson-php/saucer": "^0.19",
29+
"boson-php/uri": "^0.19",
30+
"boson-php/uri-contracts": "^0.19",
31+
"boson-php/uri-factory": "^0.19",
32+
"boson-php/uri-factory-contracts": "^0.19",
33+
"boson-php/weak-types": "^0.19",
3434
"psr/container": "^2.0",
3535
"psr/event-dispatcher": "^1.0",
3636
"react/promise": "^3.0"
@@ -50,8 +50,8 @@
5050
},
5151
"extra": {
5252
"branch-alias": {
53-
"dev-master": "0.18.x-dev",
54-
"dev-main": "0.18.x-dev"
53+
"dev-master": "0.19.x-dev",
54+
"dev-main": "0.19.x-dev"
5555
}
5656
},
5757
"config": {

src/Api/CentralProcessor/CentralProcessorExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Boson\Api\CentralProcessor;
66

77
use Boson\Application;
8-
use Boson\Component\CpuInfo\CentralProcessorInterface;
98
use Boson\Contracts\Id\IdentifiableInterface;
109
use Boson\Dispatcher\EventListener;
1110
use Boson\Extension\Attribute\AvailableAs;
@@ -14,7 +13,7 @@
1413
/**
1514
* @template-extends Extension<Application>
1615
*/
17-
#[AvailableAs('cpu', CentralProcessorInfoInterface::class, CentralProcessorInterface::class)]
16+
#[AvailableAs('cpu', CentralProcessorInfoInterface::class)]
1817
final class CentralProcessorExtension extends Extension
1918
{
2019
public function load(IdentifiableInterface $ctx, EventListener $listener): CentralProcessorInfo

src/Api/CentralProcessor/CentralProcessorInfo.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,44 @@
66

77
use Boson\Component\CpuInfo\ArchitectureInterface;
88
use Boson\Component\CpuInfo\CentralProcessor;
9-
use Boson\Component\CpuInfo\CentralProcessorInterface;
9+
use Boson\Component\CpuInfo\InstructionSetInterface;
1010

1111
/**
1212
* @internal this is an internal library class, please do not use it in your code
1313
* @psalm-internal Boson\Api\CentralProcessor
1414
*/
1515
final class CentralProcessorInfo implements CentralProcessorInfoInterface
1616
{
17-
private CentralProcessorInterface $cpu {
17+
private CentralProcessor $cpu {
1818
get => $this->cpu ??= CentralProcessor::createFromGlobals();
1919
}
2020

2121
public ArchitectureInterface $arch {
2222
get => $this->cpu->arch;
2323
}
2424

25-
public string $name {
26-
get => $this->cpu->name;
25+
public string $vendor {
26+
get => $this->cpu->vendor;
2727
}
2828

29-
public ?string $vendor {
30-
get => $this->cpu->vendor;
29+
public ?string $name {
30+
get => $this->cpu->name;
3131
}
3232

33-
public int $physicalCores {
34-
get => $this->cpu->physicalCores;
33+
public int $cores {
34+
get => $this->cpu->cores;
3535
}
3636

37-
public int $logicalCores {
38-
get => $this->cpu->logicalCores;
37+
public int $threads {
38+
get => $this->cpu->threads;
3939
}
4040

4141
public iterable $instructionSets {
4242
get => $this->cpu->instructionSets;
4343
}
44+
45+
public function isSupports(InstructionSetInterface $instructionSet): bool
46+
{
47+
return $this->cpu->isSupports($instructionSet);
48+
}
4449
}

src/Api/CentralProcessor/CentralProcessorInfoInterface.php

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,61 @@
44

55
namespace Boson\Api\CentralProcessor;
66

7-
use Boson\Component\CpuInfo\CentralProcessorInterface;
7+
use Boson\Component\CpuInfo\ArchitectureInterface;
8+
use Boson\Component\CpuInfo\InstructionSetInterface;
89

910
/**
1011
* Provides information about the main CPU.
1112
*/
12-
interface CentralProcessorInfoInterface extends
13-
CentralProcessorInterface {}
13+
interface CentralProcessorInfoInterface
14+
{
15+
/**
16+
* Gets current CPU architecture type
17+
*/
18+
public ArchitectureInterface $arch { get; }
19+
20+
/**
21+
* Gets current CPU generic vendor name.
22+
*
23+
* @var non-empty-string
24+
*/
25+
public string $vendor { get; }
26+
27+
/**
28+
* Gets current CPU name.
29+
*
30+
* @var non-empty-string|null
31+
*/
32+
public ?string $name { get; }
33+
34+
/**
35+
* Gets the number of physical CPU cores.
36+
*
37+
* @var int<1, max>
38+
*/
39+
public int $cores { get; }
40+
41+
/**
42+
* Gets the number of logical CPU cores.
43+
*
44+
* Note: The number of logical cores can be equal to or greater
45+
* than the number of physical cores ({@see $cores}).
46+
*
47+
* @var int<1, max>
48+
*/
49+
public int $threads { get; }
50+
51+
/**
52+
* Gets list of supported processor instructions
53+
*
54+
* @var iterable<array-key, InstructionSetInterface>
55+
*/
56+
public iterable $instructionSets { get; }
57+
58+
/**
59+
* Checks if this CPU supports the given instruction set.
60+
*
61+
* @api
62+
*/
63+
public function isSupports(InstructionSetInterface $instructionSet): bool;
64+
}

src/Api/OperatingSystem/OperatingSystemExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66

77
use Boson\Application;
88
use Boson\Contracts\Id\IdentifiableInterface;
9-
use Boson\Contracts\OsInfo\OperatingSystemInterface;
109
use Boson\Dispatcher\EventListener;
1110
use Boson\Extension\Attribute\AvailableAs;
1211
use Boson\Extension\Extension;
1312

1413
/**
1514
* @template-extends Extension<Application>
1615
*/
17-
#[AvailableAs('os', OperatingSystemInfoInterface::class, OperatingSystemInterface::class)]
16+
#[AvailableAs('os', OperatingSystemInfoInterface::class)]
1817
final class OperatingSystemExtension extends Extension
1918
{
2019
public function load(IdentifiableInterface $ctx, EventListener $listener): OperatingSystemInfo

src/Api/OperatingSystem/OperatingSystemInfo.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44

55
namespace Boson\Api\OperatingSystem;
66

7+
use Boson\Component\OsInfo\FamilyInterface;
78
use Boson\Component\OsInfo\OperatingSystem;
8-
use Boson\Contracts\OsInfo\FamilyInterface;
9-
use Boson\Contracts\OsInfo\OperatingSystemInterface;
10-
use Boson\Contracts\OsInfo\StandardInterface;
9+
use Boson\Component\OsInfo\StandardInterface;
1110

1211
/**
1312
* @internal this is an internal library class, please do not use it in your code
1413
* @psalm-internal Boson\Api\OperatingSystem
1514
*/
1615
final class OperatingSystemInfo implements OperatingSystemInfoInterface
1716
{
18-
private OperatingSystemInterface $os {
17+
private OperatingSystem $os {
1918
get => $this->os ??= OperatingSystem::createFromGlobals();
2019
}
2120

src/Api/OperatingSystem/OperatingSystemInfoInterface.php

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,64 @@
44

55
namespace Boson\Api\OperatingSystem;
66

7-
use Boson\Contracts\OsInfo\OperatingSystemInterface;
7+
use Boson\Component\OsInfo\FamilyInterface;
8+
use Boson\Component\OsInfo\StandardInterface;
89

910
/**
1011
* Provides information about the current OS.
1112
*/
12-
interface OperatingSystemInfoInterface extends
13-
OperatingSystemInterface {}
13+
interface OperatingSystemInfoInterface
14+
{
15+
/**
16+
* Gets the family this operating system belongs to.
17+
*/
18+
public FamilyInterface $family { get; }
19+
20+
/**
21+
* Gets the name of the operating system.
22+
*
23+
* The name should be a non-empty string that uniquely identifies this
24+
* operating system. For example, "Ubuntu 22.04 LTS" or "Windows 11".
25+
*
26+
* @var non-empty-string
27+
*/
28+
public string $name { get; }
29+
30+
/**
31+
* Gets the version of the operating system.
32+
*
33+
* @var non-empty-string
34+
*/
35+
public string $version { get; }
36+
37+
/**
38+
* Gets the codename of the operating system.
39+
*
40+
* @var non-empty-string|null
41+
*/
42+
public ?string $codename { get; }
43+
44+
/**
45+
* Gets the edition of the operating system.
46+
*
47+
* @var non-empty-string|null
48+
*/
49+
public ?string $edition { get; }
50+
51+
/**
52+
* Gets the list of standards supported by this operating system.
53+
*
54+
* @var iterable<array-key, StandardInterface>
55+
*/
56+
public iterable $standards { get; }
57+
58+
/**
59+
* Checks if this operating system supports the given standard.
60+
*
61+
* This method checks if any of the standards supported by this operating
62+
* system (including standards of its family) supports the given standard.
63+
*
64+
* @api
65+
*/
66+
public function isSupports(StandardInterface $standard): bool;
67+
}

0 commit comments

Comments
 (0)