-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added integration of the new AMP API field `mode` - added possibility to render embed banners - added new rendering mode `embed` (`EmbedRenderingMode`) for the Latte bridge - updated docs - updated CHANGELOG - fixed and added tests
- Loading branch information
Showing
49 changed files
with
732 additions
and
72 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
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,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SixtyEightPublishers\AmpClient\Bridge\Latte\RenderingMode; | ||
|
||
use SixtyEightPublishers\AmpClient\Request\ValueObject\Position; | ||
|
||
final class EmbedRenderingMode implements RenderingModeInterface | ||
{ | ||
public const Name = 'embed'; | ||
|
||
public function getName(): string | ||
{ | ||
return self::Name; | ||
} | ||
|
||
public function supportsQueues(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function shouldBePositionQueued(Position $position, object $globals): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function shouldBePositionRenderedClientSide(Position $position): bool | ||
{ | ||
return true; | ||
} | ||
} |
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,64 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SixtyEightPublishers\AmpClient\Renderer; | ||
|
||
use InvalidArgumentException; | ||
use function in_array; | ||
use function sprintf; | ||
|
||
final class ClientSideMode | ||
{ | ||
public const Modes = [ | ||
self::Managed, | ||
self::Embed, | ||
]; | ||
|
||
private const Managed = 'managed'; | ||
private const Embed = 'embed'; | ||
|
||
private string $value; | ||
|
||
private function __construct(string $value) | ||
{ | ||
$this->value = $value; | ||
} | ||
|
||
public static function managed(): self | ||
{ | ||
return new self(self::Managed); | ||
} | ||
|
||
public static function embed(): self | ||
{ | ||
return new self(self::Embed); | ||
} | ||
|
||
public static function fromValue(string $value): self | ||
{ | ||
if (!in_array($value, self::Modes, true)) { | ||
throw new InvalidArgumentException(sprintf( | ||
'Value "%s" is not valid client side mode.', | ||
$value, | ||
)); | ||
} | ||
|
||
return new self($value); | ||
} | ||
|
||
public function getValue(): string | ||
{ | ||
return $this->value; | ||
} | ||
|
||
public function isManaged(): bool | ||
{ | ||
return self::Managed === $this->value; | ||
} | ||
|
||
public function isEmbed(): bool | ||
{ | ||
return self::Embed === $this->value; | ||
} | ||
} |
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
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.