Completed
Push — master ( cbda97...e7ef90 )
by J.D.
03:04
created
src/classes/entity/restrictions.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -42,61 +42,61 @@  discard block
 block discarded – undo
42 42
 	 *                                        the restrictions of this type for this
43 43
 	 *                                        entity.
44 44
 	 */
45
-	public function get( $entity_id, $hierarchy, $type = 'know' ) {
45
+	public function get($entity_id, $hierarchy, $type = 'know') {
46 46
 
47 47
 		$hierarchy = (array) $hierarchy;
48 48
 		$restrictions = array();
49
-		$class_hierarchies = array( $hierarchy );
49
+		$class_hierarchies = array($hierarchy);
50 50
 
51
-		$depth = count( $hierarchy );
51
+		$depth = count($hierarchy);
52 52
 
53
-		if ( 1 === $depth ) {
53
+		if (1 === $depth) {
54 54
 			$class_hierarchies[] = array();
55 55
 		}
56 56
 
57
-		if ( is_array( $entity_id ) ) {
57
+		if (is_array($entity_id)) {
58 58
 
59 59
 			$context     = $entity_id;
60
-			$entity_slug = $hierarchy[ $depth - ( $depth % 2 ? 1 : 2 ) ];
61
-			$entity_id   = $context[ $entity_slug ];
60
+			$entity_slug = $hierarchy[$depth - ($depth % 2 ? 1 : 2)];
61
+			$entity_id   = $context[$entity_slug];
62 62
 
63
-			unset( $context[ $entity_slug ] );
63
+			unset($context[$entity_slug]);
64 64
 
65 65
 			/** @var WordPoints_Entity_Contexts $contexts */
66
-			$contexts = wordpoints_entities()->get_sub_app( 'contexts' );
67
-			$contexts->switch_to( $context );
66
+			$contexts = wordpoints_entities()->get_sub_app('contexts');
67
+			$contexts->switch_to($context);
68 68
 		}
69 69
 
70
-		$types = array( $type );
70
+		$types = array($type);
71 71
 
72 72
 		// If a user isn't allowed to even know about an entity, they can't do
73 73
 		// anything else either. So we always check that too.
74
-		if ( 'know' !== $type ) {
74
+		if ('know' !== $type) {
75 75
 			$types[] = 'know';
76 76
 		}
77 77
 
78
-		foreach ( $types as $type ) {
78
+		foreach ($types as $type) {
79 79
 
80
-			$sub_app = $this->get_sub_app( $type );
80
+			$sub_app = $this->get_sub_app($type);
81 81
 
82
-			if ( ! $sub_app instanceof WordPoints_Class_Registry_Deep_Multilevel ) {
82
+			if ( ! $sub_app instanceof WordPoints_Class_Registry_Deep_Multilevel) {
83 83
 				continue;
84 84
 			}
85 85
 
86
-			foreach ( $class_hierarchies as $class_hierarchy ) {
86
+			foreach ($class_hierarchies as $class_hierarchy) {
87 87
 
88 88
 				$type_restrictions = $sub_app->get_children(
89 89
 					$class_hierarchy
90
-					, array( $entity_id, $hierarchy )
90
+					, array($entity_id, $hierarchy)
91 91
 				);
92 92
 
93
-				if ( ! $type_restrictions ) {
93
+				if ( ! $type_restrictions) {
94 94
 					continue;
95 95
 				}
96 96
 
97 97
 				$restrictions = array_merge(
98 98
 					$restrictions
99
-					, array_values( $type_restrictions )
99
+					, array_values($type_restrictions)
100 100
 				);
101 101
 			}
102 102
 		}
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
 			$entity_id
106 106
 			, $hierarchy
107 107
 			, $restrictions
108
-			, isset( $context ) ? $context : array()
108
+			, isset($context) ? $context : array()
109 109
 		);
110 110
 
111
-		if ( isset( $contexts ) ) {
111
+		if (isset($contexts)) {
112 112
 			$contexts->switch_back();
113 113
 		}
114 114
 
Please login to merge, or discard this patch.
src/classes/entity/context.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @param string $slug The slug of this context.
57 57
 	 */
58
-	public function __construct( $slug ) {
58
+	public function __construct($slug) {
59 59
 		$this->slug = $slug;
60 60
 	}
61 61
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return bool Whether the context was switched to successfully.
100 100
 	 */
101
-	public function switch_to( $id ) {
101
+	public function switch_to($id) {
102 102
 		return false;
103 103
 	}
104 104
 
Please login to merge, or discard this patch.
src/classes/entity/user/role.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,22 +29,22 @@
 block discarded – undo
29 29
 	/**
30 30
 	 * @since 2.1.0
31 31
 	 */
32
-	protected function get_entity_human_id( $entity ) {
32
+	protected function get_entity_human_id($entity) {
33 33
 
34 34
 		$names = wp_roles()->get_names();
35 35
 
36
-		if ( ! isset( $names[ $entity->name ] ) ) {
36
+		if ( ! isset($names[$entity->name])) {
37 37
 			return false;
38 38
 		}
39 39
 
40
-		return translate_user_role( $names[ $entity->name ] );
40
+		return translate_user_role($names[$entity->name]);
41 41
 	}
42 42
 
43 43
 	/**
44 44
 	 * @since 2.1.0
45 45
 	 */
46 46
 	public function get_title() {
47
-		return __( 'Role', 'wordpoints' );
47
+		return __('Role', 'wordpoints');
48 48
 	}
49 49
 
50 50
 	/**
Please login to merge, or discard this patch.
src/classes/entity/user/roles.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,15 +34,15 @@
 block discarded – undo
34 34
 	/**
35 35
 	 * @since 2.1.0
36 36
 	 */
37
-	protected function get_related_entity_ids( WordPoints_Entity $entity ) {
38
-		return $entity->get_the_attr_value( $this->related_ids_field );
37
+	protected function get_related_entity_ids(WordPoints_Entity $entity) {
38
+		return $entity->get_the_attr_value($this->related_ids_field);
39 39
 	}
40 40
 
41 41
 	/**
42 42
 	 * @since 2.1.0
43 43
 	 */
44 44
 	public function get_title() {
45
-		return __( 'Roles', 'wordpoints' );
45
+		return __('Roles', 'wordpoints');
46 46
 	}
47 47
 
48 48
 	/**
Please login to merge, or discard this patch.
src/classes/entity/user.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 	 * @since 2.1.0
44 44
 	 */
45 45
 	public function get_title() {
46
-		return __( 'User', 'wordpoints' );
46
+		return __('User', 'wordpoints');
47 47
 	}
48 48
 }
49 49
 
Please login to merge, or discard this patch.
src/classes/entity/stored/array.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 	public function get_storage_info() {
32 32
 		return array(
33 33
 			'type' => 'array',
34
-			'info' => array( 'type' => 'method' ),
34
+			'info' => array('type' => 'method'),
35 35
 		);
36 36
 	}
37 37
 }
Please login to merge, or discard this patch.
src/classes/entity/parenti.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 	 *
26 26
 	 * @return WordPoints_EntityishI|false The child, or false if not found.
27 27
 	 */
28
-	public function get_child( $child_slug );
28
+	public function get_child($child_slug);
29 29
 }
30 30
 
31 31
 // EOF
Please login to merge, or discard this patch.
src/classes/entity/restrictioni.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 *                              entity slug followed by the slugs leading to the
23 23
 	 *                              descendant in question, if not the entity itself.
24 24
 	 */
25
-	public function __construct( $entity_id, array $hierarchy );
25
+	public function __construct($entity_id, array $hierarchy);
26 26
 
27 27
 	/**
28 28
 	 * Check whether the rule applies to this particular entity.
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @return bool Whether this particular user is restricted.
44 44
 	 */
45
-	public function user_can( $user_id );
45
+	public function user_can($user_id);
46 46
 }
47 47
 
48 48
 // EOF
Please login to merge, or discard this patch.
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -18,6 +18,7 @@
 block discarded – undo
18 18
 	 * @since 2.2.0
19 19
 	 *
20 20
 	 * @param object $log The object for the points log the restriction is for.
21
+	 * @return void
21 22
 	 */
22 23
 	public function __construct( $log );
23 24
 
Please login to merge, or discard this patch.
src/classes/entity/array.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @param string $entity_slug The slug of the entity type.
54 54
 	 */
55
-	public function __construct( $entity_slug ) {
55
+	public function __construct($entity_slug) {
56 56
 
57 57
 		$this->entity_slug = $entity_slug;
58
-		$this->entity_object = wordpoints_entities()->get( $this->entity_slug );
58
+		$this->entity_object = wordpoints_entities()->get($this->entity_slug);
59 59
 
60
-		parent::__construct( $this->entity_slug . '{}' );
60
+		parent::__construct($this->entity_slug . '{}');
61 61
 	}
62 62
 
63 63
 	/**
@@ -80,19 +80,19 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return bool Whether the value was set successfully.
82 82
 	 */
83
-	public function set_the_value( $values ) {
83
+	public function set_the_value($values) {
84 84
 
85 85
 		$this->the_entities = $this->the_value = array();
86 86
 
87
-		if ( ! ( $this->entity_object instanceof WordPoints_Entity ) ) {
87
+		if ( ! ($this->entity_object instanceof WordPoints_Entity)) {
88 88
 			return false;
89 89
 		}
90 90
 
91
-		foreach ( $values as $value ) {
91
+		foreach ($values as $value) {
92 92
 
93 93
 			$entity = clone $this->entity_object;
94 94
 
95
-			if ( $entity->set_the_value( $value ) ) {
95
+			if ($entity->set_the_value($value)) {
96 96
 				$this->the_entities[] = $entity;
97 97
 				$this->the_value[] = $entity->get_the_id();
98 98
 			}
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function get_title() {
119 119
 
120
-		if ( $this->entity_object ) {
120
+		if ($this->entity_object) {
121 121
 
122 122
 			return sprintf(
123 123
 				// translators: the singular name of an item
124
-				__( '%s Collection', 'wordpoints' )
124
+				__('%s Collection', 'wordpoints')
125 125
 				, $this->entity_object->get_title()
126 126
 			);
127 127
 
128 128
 		} else {
129
-			return __( 'Item Collection', 'wordpoints' );
129
+			return __('Item Collection', 'wordpoints');
130 130
 		}
131 131
 	}
132 132
 }
Please login to merge, or discard this patch.