Skip to content

Commit

Permalink
Add lead router.
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Nikolaev committed Jan 28, 2021
1 parent 341a193 commit 085f19e
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
- Add Request::getCommand();

- Add Command::getParam();

6.2.4: Add lead router.
1 change: 1 addition & 0 deletions DependencyInjection/DarvinBitrix24Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function load(array $configs, ContainerBuilder $container): void
'lead',
'repository',
'request',
'router',
'utm',
]);
}
Expand Down
10 changes: 10 additions & 0 deletions Resources/config/services/router.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
parameters:
darvin_bitrix24.router.lead.class: Darvin\Bitrix24Bundle\Router\LeadRouter

services:
Darvin\Bitrix24Bundle\Router\LeadRouterInterface: '@darvin_bitrix24.router.lead'

darvin_bitrix24.router.lead:
class: '%darvin_bitrix24.router.lead.class%'
arguments:
- '%darvin_bitrix24.account.domain%'
38 changes: 38 additions & 0 deletions Router/LeadRouter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php declare(strict_types=1);
/**
* @author Igor Nikolaev <[email protected]>
* @copyright Copyright (c) 2021, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Darvin\Bitrix24Bundle\Router;

/**
* Lead router
*/
class LeadRouter implements LeadRouterInterface
{
/**
* @var string
*/
private $domain;

/**
* @param string $domain Domain
*/
public function __construct(string $domain)
{
$this->domain = $domain;
}

/**
* {@inheritDoc}
*/
public function generateShowUrl(string $id): string
{
return sprintf('https://%s/crm/lead/show/%s/', $this->domain, $id);
}
}
24 changes: 24 additions & 0 deletions Router/LeadRouterInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php declare(strict_types=1);
/**
* @author Igor Nikolaev <[email protected]>
* @copyright Copyright (c) 2021, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Darvin\Bitrix24Bundle\Router;

/**
* Lead router
*/
interface LeadRouterInterface
{
/**
* @param string $id Lead ID
*
* @return string
*/
public function generateShowUrl(string $id): string;
}

0 comments on commit 085f19e

Please sign in to comment.