Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche committed Mar 13, 2024
1 parent 8178c93 commit 65e17b7
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 53 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ You can create an OR combination of conditions like this:
```php
Discover::in(__DIR__)
->any(
ProfileCondition::classes(),
ProfileCondition::enums()
ConditionBuilder::create()->classes(),
ConditionBuilder::create()->enums()
)
->get();
```
Expand All @@ -200,13 +200,13 @@ You can also create more complex operations like an or of and's:
```php
Discover::in(__DIR__)
->any(
ProfileCondition::exact(
ProfileCondition::classes(),
ProfileCondition::implementing(Arrayble::class),
ConditionBuilder::create()->exact(
ConditionBuilder::create()->classes(),
ConditionBuilder::create()->implementing(Arrayble::class),
),
ProfileCondition::exact(
ProfileCondition::enums(),
ProfileCondition::implementing(Stringable::class),
ConditionBuilder::create()->exact(
ConditionBuilder::create()->enums(),
ConditionBuilder::create()->implementing(Stringable::class),
)
)
->get();
Expand All @@ -217,11 +217,11 @@ This example can be written shorter like this:
```php
Discover::in(__DIR__)
->any(
ProfileCondition::exact(
ProfileCondition::classes()->implementing(Arrayble::class),
ConditionBuilder::create()->exact(
ConditionBuilder::create()->classes()->implementing(Arrayble::class),
),
ProfileCondition::exact(
ProfileCondition::enums()->implementing(Stringable::class),
ConditionBuilder::create()->exact(
ConditionBuilder::create()->enums()->implementing(Stringable::class),
)
)
->get();
Expand Down
5 changes: 5 additions & 0 deletions src/Support/Conditions/ConditionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public function __construct(
) {
}

public static function create(): self
{
return new self();
}

public function conditionsStore(): ExactDiscoverCondition
{
return $this->conditions;
Expand Down
21 changes: 21 additions & 0 deletions src/Support/ProfileCondition.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Spatie\StructureDiscoverer\Support;

class ProfileCondition implements HasConditions

Check failure on line 5 in src/Support/ProfileCondition.php

View workflow job for this annotation

GitHub Actions / phpstan

Class Spatie\StructureDiscoverer\Support\ProfileCondition implements unknown interface Spatie\StructureDiscoverer\Support\HasConditions.
{
use HasConditionsTrait;

Check failure on line 7 in src/Support/ProfileCondition.php

View workflow job for this annotation

GitHub Actions / phpstan

Class Spatie\StructureDiscoverer\Support\ProfileCondition uses unknown trait Spatie\StructureDiscoverer\Support\HasConditionsTrait.

public function __construct(
public ExactDiscoverCondition $conditions = new ExactDiscoverCondition()

Check failure on line 10 in src/Support/ProfileCondition.php

View workflow job for this annotation

GitHub Actions / phpstan

Instantiated class Spatie\StructureDiscoverer\Support\ExactDiscoverCondition not found.

Check failure on line 10 in src/Support/ProfileCondition.php

View workflow job for this annotation

GitHub Actions / phpstan

Parameter $conditions of method Spatie\StructureDiscoverer\Support\ProfileCondition::__construct() has invalid type Spatie\StructureDiscoverer\Support\ExactDiscoverCondition.

Check failure on line 10 in src/Support/ProfileCondition.php

View workflow job for this annotation

GitHub Actions / phpstan

Property Spatie\StructureDiscoverer\Support\ProfileCondition::$conditions has unknown class Spatie\StructureDiscoverer\Support\ExactDiscoverCondition as its type.
) {
}

public function conditionsStore(): ExactDiscoverCondition

Check failure on line 14 in src/Support/ProfileCondition.php

View workflow job for this annotation

GitHub Actions / phpstan

Method Spatie\StructureDiscoverer\Support\ProfileCondition::conditionsStore() has invalid return type Spatie\StructureDiscoverer\Support\ExactDiscoverCondition.
{
return $this->conditions;
}
}
{

}
Loading

0 comments on commit 65e17b7

Please sign in to comment.