Completed
Pull Request — master (#1)
by Jacob
03:28
created
src/Domain/Stream/YouTube/MysqlYouTubeRepository.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -8,88 +8,88 @@
 block discarded – undo
8 8
 class MysqlYouTubeRepository implements YouTubeRepositoryInterface
9 9
 {
10 10
 
11
-    /** @var  ConnectionLocator */
12
-    protected $connections;
11
+	/** @var  ConnectionLocator */
12
+	protected $connections;
13 13
 
14
-    /**
15
-     * @param ConnectonLocator $connections
16
-     */
17
-    public function __construct(ConnectionLocator $connections)
18
-    {
19
-        $this->connections = $connections;
20
-    }
14
+	/**
15
+	 * @param ConnectonLocator $connections
16
+	 */
17
+	public function __construct(ConnectionLocator $connections)
18
+	{
19
+		$this->connections = $connections;
20
+	}
21 21
 
22
-    public function getYouTubes($limit = null, $offset = 0)
23
-    {
24
-        $query = "
22
+	public function getYouTubes($limit = null, $offset = 0)
23
+	{
24
+		$query = "
25 25
             SELECT `id`, `video_id`, `datetime`
26 26
             FROM `jpemeric_stream`.`youtube`
27 27
             ORDER BY `datetime` DESC";
28
-        if (!is_null($limit)) {
29
-            $query .= "
28
+		if (!is_null($limit)) {
29
+			$query .= "
30 30
             LIMIT {$offset}, {$limit}";
31
-        }
31
+		}
32 32
 
33
-        return $this
34
-            ->connections
35
-            ->getRead()
36
-            ->fetchAll($query);
37
-    }
33
+		return $this
34
+			->connections
35
+			->getRead()
36
+			->fetchAll($query);
37
+	}
38 38
 
39
-    /**
40
-     * @param string $title
41
-     *
42
-     * @return array|false
43
-     */
44
-    public function getYouTubeByVideoId($videoId)
45
-    {
46
-        $query = "
39
+	/**
40
+	 * @param string $title
41
+	 *
42
+	 * @return array|false
43
+	 */
44
+	public function getYouTubeByVideoId($videoId)
45
+	{
46
+		$query = "
47 47
             SELECT *
48 48
             FROM `jpemeric_stream`.`youtube`
49 49
             WHERE `video_id` = :video_id
50 50
             LIMIT 1";
51
-        $bindings = [
52
-            'video_id' => $videoId,
53
-        ];
51
+		$bindings = [
52
+			'video_id' => $videoId,
53
+		];
54 54
 
55
-        return $this
56
-            ->connections
57
-            ->getRead()
58
-            ->fetchOne($query, $bindings);
59
-    }
55
+		return $this
56
+			->connections
57
+			->getRead()
58
+			->fetchOne($query, $bindings);
59
+	}
60 60
 
61
-    public function getYouTubesUpdatedSince(DateTime $datetime)
62
-    {
63
-        $query = "
61
+	public function getYouTubesUpdatedSince(DateTime $datetime)
62
+	{
63
+		$query = "
64 64
             SELECT *
65 65
             FROM `jpemeric_stream`.`youtube`
66 66
             WHERE `updated_at` >= :last_update";
67
-        $bindings = [
68
-            'last_update' => $datetime->format('Y-m-d H:i:s'),
69
-        ];
70
-        return $this
71
-            ->connections
72
-            ->getRead()
73
-            ->fetchAll($query, $bindings);
74
-    }
67
+		$bindings = [
68
+			'last_update' => $datetime->format('Y-m-d H:i:s'),
69
+		];
70
+		return $this
71
+			->connections
72
+			->getRead()
73
+			->fetchAll($query, $bindings);
74
+	}
75 75
 
76
-    public function insertVideo($videoId, DateTime $datetime, array $metadata)
77
-    {
78
-        $query = "
76
+	public function insertVideo($videoId, DateTime $datetime, array $metadata)
77
+	{
78
+		$query = "
79 79
             INSERT INTO `jpemeric_stream`.`youtube`
80 80
                 (`video_id`, `datetime`, `metadata`)
81 81
             VALUES
82 82
                 (:video_id, :datetime, :metadata)";
83 83
 
84
-        $bindings = [
85
-            'video_id' => $videoId,
86
-            'datetime' => $datetime->format('Y-m-d H:i:s'),
87
-            'metadata' => json_encode($metadata),
88
-        ];
84
+		$bindings = [
85
+			'video_id' => $videoId,
86
+			'datetime' => $datetime->format('Y-m-d H:i:s'),
87
+			'metadata' => json_encode($metadata),
88
+		];
89 89
 
90
-        return $this
91
-            ->connections
92
-            ->getWrite()
93
-            ->perform($query, $bindings);
94
-    }
90
+		return $this
91
+			->connections
92
+			->getWrite()
93
+			->perform($query, $bindings);
94
+	}
95 95
 }
Please login to merge, or discard this patch.