Nwidart\Modules\Repository::find PHP Method

find() public method

Find a specific module.
public find ( $name ) : mixed | void
$name
return mixed | void
    public function find($name)
    {
        foreach ($this->all() as $module) {
            if ($module->getLowerName() === strtolower($name)) {
                return $module;
            }
        }
        return;
    }

Usage Example

 /** @test */
 public function it_finds_a_module()
 {
     $this->repository->addLocation(__DIR__ . '/stubs/Recipe');
     $this->assertInstanceOf(Module::class, $this->repository->find('recipe'));
     $this->assertInstanceOf(Module::class, $this->repository->get('recipe'));
 }