8000 Documentation for Factory by clue · Pull Request #119 · reactphp/event-loop · GitHub
[go: up one dir, main page]

Skip to content

Documentation f 8000 or Factory #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Documentation for Factory
  • Loading branch information
clue committed Nov 10, 2017
commit e360c730904e48581447d8fe11da9148c97c20e9
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,23 @@ $loop->run();
purposes.
3. The loop is run with a single `$loop->run()` call at the end of the program.

## Factory

The `Factory` class exists as a convenient way to pick the best available
[loop implementation)(#loop-implementation).

The `create(): LoopInterface` method can be used to create a new loop
instance:

```php
$loop = React\EventLoop\Factory::create();
```

This method always returns an instance implementing `LoopInterface`,
the actual loop implementation is an implementation detail.

This method should usually only be called once at the beginning of the program.

## Loop implementations

In addition to the interface there are the following implementations provided:
Expand Down
17 changes: 17 additions & 0 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,25 @@

namespace React\EventLoop;

/**
* The `Factory` class exists as a convenient way to pick the best available loop implementation.
*/
class Factory
{
/**
* Creates a new loop instance
*
* ```php
* $loop = React\EventLoop\Factory::create();
* ```
*
* This method always returns an instance implementing `LoopInterface`,
* the actual loop implementation is an implementation detail.
*
* This method should usually only be called once at the beginning of the program.
*
* @return LoopInterface
*/
public static function create()
{
// @codeCoverageIgnoreStart
Expand Down
0