Completed
Push — master ( 24dcff...a3e8b1 )
by Simon
02:24
created
code/extensions/ShortListExtension.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -12,15 +12,15 @@  discard block
 block discarded – undo
12 12
      * */
13 13
     public function getShortlistURL($full = false)
14 14
     {
15
-	    if ($full) {
16
-		    $shortlist = $this->getShortList();
15
+        if ($full) {
16
+            $shortlist = $this->getShortList();
17 17
 
18
-	        if ($shortlist && $shortlist->exists()) {
19
-	            return $shortlist->Link();
20
-	        }
21
-	    } else {
22
-		    return Config::inst()->get('ShortList', 'URLSegment');
23
-	    }
18
+            if ($shortlist && $shortlist->exists()) {
19
+                return $shortlist->Link();
20
+            }
21
+        } else {
22
+            return Config::inst()->get('ShortList', 'URLSegment');
23
+        }
24 24
 
25 25
 
26 26
         return false;
@@ -31,39 +31,39 @@  discard block
 block discarded – undo
31 31
      * */
32 32
     public function getSessionID()
33 33
     {
34
-		Session::start();
35
-		return session_id();
36
-	}
34
+        Session::start();
35
+        return session_id();
36
+    }
37 37
 
38
-	public function getShortList()
39
-	{
40
-		return DataObject::get_one('ShortList', $filter = array('SessionID' => session_id()));
41
-	}
38
+    public function getShortList()
39
+    {
40
+        return DataObject::get_one('ShortList', $filter = array('SessionID' => session_id()));
41
+    }
42 42
 
43
-	public function getShortListCount()
44
-	{
45
-		$shortlist = $this->getShortList();
43
+    public function getShortListCount()
44
+    {
45
+        $shortlist = $this->getShortList();
46 46
 
47
-		if ($shortlist && $shortlist->exists()) {
48
-			return $shortlist->ShortListItems()->Count();
49
-		}
47
+        if ($shortlist && $shortlist->exists()) {
48
+            return $shortlist->ShortListItems()->Count();
49
+        }
50 50
 
51
-		return 0;
52
-	}
51
+        return 0;
52
+    }
53 53
 
54
-	public function AddedToShortList($ID = null, $type = null) {
55
-		if (is_null($ID) || is_null($type)) {
56
-			return false;
57
-		}
54
+    public function AddedToShortList($ID = null, $type = null) {
55
+        if (is_null($ID) || is_null($type)) {
56
+            return false;
57
+        }
58 58
 
59
-		$shortlist = $this->getShortList();
59
+        $shortlist = $this->getShortList();
60 60
 
61
-		if ($shortlist) {
62
-			$items = $shortlist->ShortListItems()->filter(array('ItemID' => $ID, 'ItemType' => $type));
61
+        if ($shortlist) {
62
+            $items = $shortlist->ShortListItems()->filter(array('ItemID' => $ID, 'ItemType' => $type));
63 63
 
64
-			return $items->Count() > 0;
65
-		}
64
+            return $items->Count() > 0;
65
+        }
66 66
 
67
-		return 0;
68
-	}
67
+        return 0;
68
+    }
69 69
 }
Please login to merge, or discard this patch.
tests/ShortlistTest.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 {
5 5
     protected static $fixture_file = 'fixtures.yml';
6 6
 
7
-	public function testShortlistCreation()
8
-	{
7
+    public function testShortlistCreation()
8
+    {
9 9
         $shortlists = ShortList::get();
10 10
 
11 11
         $this->get('shortlist');
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         Session::start();
48 48
         $sessionID = session_id();
49 49
 
50
-        $response = $this->get('shortlist/add?id=' . $testpage->ID . '&type=Page&s=' . $sessionID . '&output=0');
50
+        $response = $this->get('shortlist/add?id='.$testpage->ID.'&type=Page&s='.$sessionID.'&output=0');
51 51
 
52 52
         $shortlist = DataObject::get_one('ShortList', array('SessionID' => $sessionID));
53 53
 
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
         Session::start();
62 62
         $sessionID = session_id();
63 63
 
64
-        $this->get('shortlist/add?id=' . $testpage->ID . '&type=Page&s=' . $sessionID . '&output=0');
64
+        $this->get('shortlist/add?id='.$testpage->ID.'&type=Page&s='.$sessionID.'&output=0');
65 65
 
66 66
         $shortlist = DataObject::get_one('ShortList', array('SessionID' => $sessionID));
67 67
 
68
-        $this->get('shortlist/remove?id=' . $testpage->ID . '&type=Page&s=' . $sessionID . '&output=0');
68
+        $this->get('shortlist/remove?id='.$testpage->ID.'&type=Page&s='.$sessionID.'&output=0');
69 69
 
70 70
         $this->assertEquals($shortlist->ShortListItems()->Count(), 0);
71 71
     }
Please login to merge, or discard this patch.
code/extensions/ShortListPaginationExtension.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
  * Provides Pagination for shortlist controller
6 6
  */
7 7
 class ShortListPaginationExtension extends DataExtension {
8
-	/**
8
+    /**
9 9
      * Get a paginated list of the shortlist items.
10 10
      *
11 11
      * @return mixed the paginated list of items, or false if the list cannot be found.
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function nextPage()
38 38
     {
39 39
         if ($this->owner->list->CurrentPage() < $this->owner->list->TotalPages()) {
40
-            return '?page=' . ($this->owner->list->CurrentPage() + 1);
40
+            return '?page='.($this->owner->list->CurrentPage() + 1);
41 41
         }
42 42
 
43 43
         return false;
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     public function prevPage()
47 47
     {
48 48
         if ($this->owner->list->CurrentPage() > 1) {
49
-            return '?page=' . ($this->owner->list->CurrentPage() - 1);
49
+            return '?page='.($this->owner->list->CurrentPage() - 1);
50 50
         }
51 51
 
52 52
         return false;
Please login to merge, or discard this patch.
code/models/ShortList.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
      */
82 82
     public function Link($action = null)
83 83
     {
84
-        return Config::inst()->get('ShortList', 'URLSegment') . $this->URL;
84
+        return Config::inst()->get('ShortList', 'URLSegment').$this->URL;
85 85
     }
86 86
 
87 87
     /**
Please login to merge, or discard this patch.
code/controllers/ShortListController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
     public function index($request)
36 36
     {
37 37
         if (($shortlist = $this->getSessionShortList())) {
38
-            return $this->redirect(Config::inst()->get('ShortList', 'URLSegment') . $shortlist->URL);
38
+            return $this->redirect(Config::inst()->get('ShortList', 'URLSegment').$shortlist->URL);
39 39
         } else {
40 40
             /*
41 41
 if (!ShortList::isBrowser()) {
Please login to merge, or discard this patch.
code/factories/RemoveFromshortlistAction.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
             return false;
23 23
         }
24 24
 
25
-        $query = "ItemType = '" . $type . "' AND ItemID = " . $ID . ' AND ShortListID = ' . $shortlist->ID;
25
+        $query = "ItemType = '".$type."' AND ItemID = ".$ID.' AND ShortListID = '.$shortlist->ID;
26 26
 
27 27
         $item = DataObject::get_one('ShortListItem', $filter = $query);
28 28
 
Please login to merge, or discard this patch.