-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,141 additions
and
295 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the DriftPHP Project | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Drift\DBAL; | ||
|
||
/** | ||
* Class ConnectionWorker. | ||
*/ | ||
class ConnectionWorker | ||
{ | ||
private Connection $connection; | ||
private int $id; | ||
private int $jobs; | ||
|
||
/** | ||
* @param Connection $connection | ||
* @param int $id | ||
*/ | ||
public function __construct(Connection $connection, int $id) | ||
{ | ||
$this->connection = $connection; | ||
$this->id = $id; | ||
$this->jobs = 0; | ||
} | ||
|
||
public function startJob() | ||
{ | ||
++$this->jobs; | ||
} | ||
|
||
public function stopJob() | ||
{ | ||
--$this->jobs; | ||
} | ||
|
||
/** | ||
* @return Connection | ||
*/ | ||
public function getConnection(): Connection | ||
{ | ||
return $this->connection; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getId(): int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getJobs(): int | ||
{ | ||
return $this->jobs; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.