Skip to content

Commit 4945a72

Browse files
committed
init commit
1 parent 85c0194 commit 4945a72

File tree

13 files changed

+861
-2
lines changed

13 files changed

+861
-2
lines changed

AVATORTurbosmsBundle.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace AVATOR\TurbosmsBundle;
4+
5+
use Symfony\Component\HttpKernel\Bundle\Bundle;
6+
7+
class AVATORTurbosmsBundle extends Bundle
8+
{
9+
10+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace AVATOR\TurbosmsBundle\DependencyInjection;
4+
5+
use Symfony\Component\DependencyInjection\ContainerBuilder;
6+
use Symfony\Component\Config\FileLocator;
7+
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
8+
use Symfony\Component\DependencyInjection\Loader;
9+
10+
/**
11+
* This is the class that loads and manages your bundle configuration.
12+
*
13+
* @link http://symfony.com/doc/current/cookbook/bundles/extension.html
14+
*/
15+
class AVATORTurbosmsExtension extends Extension
16+
{
17+
/**
18+
* {@inheritdoc}
19+
*/
20+
public function load(array $configs, ContainerBuilder $container)
21+
{
22+
$configuration = new Configuration();
23+
$config = $this->processConfiguration($configuration, $configs);
24+
25+
$container->setParameter('avator_turbosms.login', $config['login']);
26+
$container->setParameter('avator_turbosms.password', $config['password']);
27+
$container->setParameter('avator_turbosms.sender', $config['sender']);
28+
$container->setParameter('avator_turbosms.debug', $config['debug']);
29+
$container->setParameter('avator_turbosms.save_to_db', $config['save_to_db']);
30+
31+
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
32+
$loader->load('services.yml');
33+
}
34+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
namespace AVATOR\TurbosmsBundle\DependencyInjection;
4+
5+
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6+
use Symfony\Component\Config\Definition\ConfigurationInterface;
7+
8+
/**
9+
* This is the class that validates and merges configuration from your app/config files.
10+
*
11+
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
12+
*/
13+
class Configuration implements ConfigurationInterface
14+
{
15+
/**
16+
* {@inheritdoc}
17+
*/
18+
public function getConfigTreeBuilder()
19+
{
20+
$treeBuilder = new TreeBuilder();
21+
$rootNode = $treeBuilder->root('avator_turbosms');
22+
23+
$rootNode
24+
->children()
25+
26+
->scalarNode('login')
27+
->isRequired()
28+
->cannotBeEmpty()
29+
->end()
30+
31+
->scalarNode('password')
32+
->isRequired()
33+
->cannotBeEmpty()
34+
->end()
35+
36+
->scalarNode('sender')
37+
->isRequired()
38+
->cannotBeEmpty()
39+
->end()
40+
41+
->scalarNode('debug')
42+
->defaultFalse()
43+
->end()
44+
45+
->scalarNode('save_to_db')
46+
->defaultTrue()
47+
->end();
48+
49+
return $treeBuilder;
50+
}
51+
}

Entity/TurboSmsSent.php

Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
<?php
2+
3+
namespace AVATOR\TurbosmsBundle\Entity;
4+
5+
/**
6+
* Class TurboSmsSent
7+
* @package AVATOR\TurbosmsBundle\Entity
8+
*/
9+
class TurboSmsSent
10+
{
11+
const STATUS_SENT = 1;
12+
13+
/**
14+
* @var integer
15+
*/
16+
private $id;
17+
18+
/**
19+
* @var string
20+
*/
21+
private $phone = '';
22+
23+
/**
24+
* @var string
25+
*/
26+
private $message_id = '';
27+
28+
/**
29+
* @var string
30+
*/
31+
private $status = '';
32+
33+
/**
34+
* @var string
35+
*/
36+
private $status_message = '';
37+
38+
/**
39+
* @var string
40+
*/
41+
private $message = '';
42+
43+
/**
44+
* @var \DateTime
45+
*/
46+
private $created_at;
47+
48+
/**
49+
* @var \DateTime
50+
*/
51+
private $updated_at;
52+
53+
public function __construct()
54+
{
55+
$this->setStatus(self::STATUS_SENT);
56+
}
57+
58+
/**
59+
* Get id
60+
*
61+
* @return integer
62+
*/
63+
public function getId()
64+
{
65+
return $this->id;
66+
}
67+
68+
/**
69+
* Set phone
70+
*
71+
* @param string $phone
72+
*
73+
* @return TurboSmsSent
74+
*/
75+
public function setPhone($phone)
76+
{
77+
$this->phone = $phone;
78+
79+
return $this;
80+
}
81+
82+
/**
83+
* Get phone
84+
*
85+
* @return string
86+
*/
87+
public function getPhone()
88+
{
89+
return $this->phone;
90+
}
91+
92+
/**
93+
* Set messageId
94+
*
95+
* @param string $messageId
96+
*
97+
* @return TurboSmsSent
98+
*/
99+
public function setMessageId($messageId)
100+
{
101+
$this->message_id = $messageId;
102+
103+
return $this;
104+
}
105+
106+
/**
107+
* Get messageId
108+
*
109+
* @return string
110+
*/
111+
public function getMessageId()
112+
{
113+
return $this->message_id;
114+
}
115+
116+
/**
117+
* Set status
118+
*
119+
* @param string $status
120+
*
121+
* @return TurboSmsSent
122+
*/
123+
public function setStatus($status)
124+
{
125+
$this->status = $status;
126+
127+
return $this;
128+
}
129+
130+
/**
131+
* Get status
132+
*
133+
* @return string
134+
*/
135+
public function getStatus()
136+
{
137+
return $this->status;
138+
}
139+
140+
/**
141+
* Set statusMessage
142+
*
143+
* @param string $statusMessage
144+
*
145+
* @return TurboSmsSent
146+
*/
147+
public function setStatusMessage($statusMessage)
148+
{
149+
$this->status_message = $statusMessage;
150+
151+
return $this;
152+
}
153+
154+
/**
155+
* Get statusMessage
156+
*
157+
* @return string
158+
*/
159+
public function getStatusMessage()
160+
{
161+
return $this->status_message;
162+
}
163+
164+
/**
165+
* Set message
166+
*
167+
* @param string $message
168+
*
169+
* @return TurboSmsSent
170+
*/
171+
public function setMessage($message)
172+
{
173+
$this->message = $message;
174+
175+
return $this;
176+
}
177+
178+
/**
179+
* Get message
180+
*
181+
* @return string
182+
*/
183+
public function getMessage()
184+
{
185+
return $this->message;
186+
}
187+
188+
/**
189+
* Set createdAt
190+
*
191+
* @param \DateTime $createdAt
192+
*
193+
* @return TurboSmsSent
194+
*/
195+
public function setCreatedAt($createdAt)
196+
{
197+
$this->created_at = $createdAt;
198+
199+
return $this;
200+
}
201+
202+
/**
203+
* Get createdAt
204+
*
205+
* @return \DateTime
206+
*/
207+
public function getCreatedAt()
208+
{
209+
return $this->created_at;
210+
}
211+
212+
/**
213+
* Set updatedAt
214+
*
215+
* @param \DateTime $updatedAt
216+
*
217+
* @return TurboSmsSent
218+
*/
219+
public function setUpdatedAt($updatedAt)
220+
{
221+
$this->updated_at = $updatedAt;
222+
223+
return $this;
224+
}
225+
226+
/**
227+
* Get updatedAt
228+
*
229+
* @return \DateTime
230+
*/
231+
public function getUpdatedAt()
232+
{
233+
return $this->updated_at;
234+
}
235+
236+
/**
237+
* @ORM\PrePersist
238+
*/
239+
public function onInsert()
240+
{
241+
$this->setCreatedAt(new \DateTime());
242+
$this->setUpdatedAt(new \DateTime());
243+
}
244+
245+
/**
246+
* @ORM\PreUpdate
247+
*/
248+
public function onUpdate()
249+
{
250+
$this->setUpdatedAt(new \DateTime());
251+
}
252+
253+
}
254+

LICENSE.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2017, Oleksii Golub
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
* Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
* Neither the name of avator or symfony-turbosms nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)