-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added RUMControlFactory for HeaderControl and FooterControl
- Loading branch information
Showing
7 changed files
with
84 additions
and
30 deletions.
There are no files selected for viewing
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
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
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
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,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Contributte\NewRelic\RUM; | ||
|
||
use Contributte\NewRelic\Agent\Agent; | ||
|
||
final class RUMControlFactory | ||
{ | ||
|
||
/** | ||
* @var Agent | ||
*/ | ||
private $agent; | ||
|
||
/** | ||
* @var bool | ||
*/ | ||
private $enabled; | ||
|
||
public function __construct(Agent $agent, bool $enabled = true) | ||
{ | ||
$this->agent = $agent; | ||
$this->enabled = $enabled; | ||
} | ||
|
||
public function createHeader(bool $withScriptTag = true): HeaderControl | ||
{ | ||
return new HeaderControl($this->agent, $this->enabled, $withScriptTag); | ||
} | ||
|
||
public function createFooter(bool $withScriptTag = true): FooterControl | ||
{ | ||
return new FooterControl($this->agent, $this->enabled, $withScriptTag); | ||
} | ||
|
||
} |
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,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Contributte\NewRelic\RUM; | ||
|
||
trait RUMControlTrait | ||
{ | ||
|
||
/** | ||
* @var RUMControlFactory | ||
*/ | ||
protected $rumControlFactory; | ||
|
||
public function injectRUMControlFactory(RUMControlFactory $rumControlFactory): void | ||
{ | ||
$this->rumControlFactory = $rumControlFactory; | ||
} | ||
|
||
protected function createComponentNewRelicHeader(): HeaderControl | ||
{ | ||
return $this->rumControlFactory->createHeader(); | ||
} | ||
|
||
protected function createComponentNewRelicFooter(): FooterControl | ||
{ | ||
return $this->rumControlFactory->createFooter(); | ||
} | ||
|
||
} |
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
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