DevelopmentController::getProsilverPageData()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 63

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 63
rs 8.8072
c 0
b 0
f 0
cc 1
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 *
4
 * @copyright (c) 2013 phpBB Group
5
 * @license http://opensource.org/licenses/gpl-3.0.php GNU General Public License v3
6
 * @author MichaelC
7
 *
8
 */
9
10
namespace AppBundle\Controller;
11
12
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
13
14
class DevelopmentController extends Controller
15
{
16
	public function prosilverAction($page = 1)
17
	{
18
		$templateVariables = array();
19
20
		$data = $this->getProsilverPageData();
21
22
		$i = 1;
23
24
		$toc = array();
25
		$var = array();
26
27
		foreach ($data as $item) {
28
			$var['TITLE']	= $item['DATE'];
29
			$var['ITEM']	= '/development/prosilver/' . $i;
30
			$var['ID']		= $i;
31
32
			$toc[$i] = $var;
33
34
			$i++;
35
		}
36
37
		$templateVariables += array(
38
			'TOC'					=> $toc,
39
			'MENU_COUNT' 			=> count($toc),
40
41
			'PAGE'					=> $page,
42
43
			'DATE_TITLE'			=> $data[$page]['DATE'],
44
			'CAPTION'				=> $data[$page]['TEXT'],
45
46
			'IMAGE'		=> ('/assets/images/prosilver/' . $data[$page]['IMAGE']),
47
48
			'NEXT_PAGE'	=> (isset($data[$page + 1])) ? ('/development/prosilver/' . ($page + 1)) : '',
49
			'PREV_PAGE'	=> (isset($data[$page - 1])) ? ('/development/prosilver/' . ($page - 1)) : '',
50
51
			'IN_DEV_PROSILVER'	=> true,);
52
53
		return $this->render('AppBundle:Development:prosilver.html.twig', $templateVariables);
54
	}
55
56
	private function getProsilverPageData()
57
	{
58
		$data = array(
59
			1 	=> array(
60
				'DATE' 	=> 'Feb 8th 2004: The first interface concept',
61
				'TEXT' 	=> 'Moving the info panel to the right-hand side so the focus is on the post content',
62
				'IMAGE'	=> 'prosilver_history01.jpg'),
63
			2 	=> array(
64
				'DATE' 	=> 'Feb 14th 2004: The first admin concept',
65
				'TEXT' 	=> 'Started to think about how the admin layout could be better organised. An exciting thing to do on Valentines day I know...',
66
				'IMAGE'	=> 'prosilver_history02.jpg'),
67
			3 	=> array(
68
				'DATE' 	=> 'Feb 24th 2004: An example topic page ',
69
				'TEXT' 	=> 'This page is trying different ideas with the side panel and links',
70
				'IMAGE'	=> 'prosilver_history03.jpg'),
71
			4 	=> array(
72
				'DATE' 	=> 'June 2004: Board index',
73
				'TEXT' 	=> 'There was quite a gap between the first flurry of activity and this board index design. Must have been busy with other stuff.',
74
				'IMAGE'	=> 'prosilver_history04.jpg'),
75
			5 	=> array(
76
				'DATE' 	=> 'July 2004: Board index',
77
				'TEXT' 	=> 'By now a fully marked-up version of this design was running on our super-sekrit testing forum that had frequent bug infestations...',
78
				'IMAGE'	=> 'prosilver_history05.jpg'),
79
			6 	=> array(
80
				'DATE' 	=> 'July 2004: New smilies',
81
				'TEXT' 	=> 'Why not have more face shaped smilies? I tried a few concepts of graphic elements for the new website. Also the first sign of a new logo idea.',
82
				'IMAGE'	=> 'prosilver_history06.jpg'),
83
			7 	=> array(
84
				'DATE' 	=> 'August 2004: Colour variations',
85
				'TEXT' 	=> 'Some half-hearted attempts at trying different colour schemes. Was never really that happy with the silver and beige shades.',
86
				'IMAGE'	=> 'prosilver_history07.jpg'),
87
			8	=> array(
88
				'DATE' 	=> 'November 2004: proSilver MkII',
89
				'TEXT' 	=> 'I wasn\'t happy with the previous colour scheme, so MkII used a much stronger palette.',
90
				'IMAGE'	=> 'prosilver_history08.jpg'),
91
			9 	=> array(
92
				'DATE' 	=> 'December 2004: proSilver MkII',
93
				'TEXT' 	=> 'Read the topic content below for the explaination.',
94
				'IMAGE'	=> 'prosilver_history09.jpg'),
95
			10 	=> array(
96
				'DATE' 	=> 'January 15th 2005: Logo concepts I',
97
				'TEXT' 	=> 'Some logo variations were put to the vote to the wider phpBB team.',
98
				'IMAGE'	=> 'prosilver_history10.jpg'),
99
			11 	=> array(
100
				'DATE' 	=> 'January 15th 2005: Logo concepts II',
101
				'TEXT' 	=> 'More logo variations.',
102
				'IMAGE'	=> 'prosilver_history11.jpg'),
103
			12 	=> array(
104
				'DATE' 	=> 'January 15th 2005: Olympus!',
105
				'TEXT' 	=> 'The new name for phpBB3, and also the name of the largest mountain on Mars...',
106
				'IMAGE'	=> 'prosilver_history12.jpg'),
107
			13 	=> array(
108
				'DATE' 	=> 'January 2005: Onwards',
109
				'TEXT' 	=> 'A lot of time spent creating templates and marking up the new design.',
110
				'IMAGE'	=> 'prosilver_history13.gif'),
111
			14 	=> array(
112
				'DATE' 	=> 'February 2006: phpBB3 website',
113
				'TEXT' 	=> 'Design for new website created.',
114
				'IMAGE'	=> 'prosilver_history14.jpg'
115
			));
116
117
		return $data;
118
	}
119
}
120