PartitionAlgorithmInterface::getPartitionWeight()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
1
<?php
2
3
namespace drupol\phpartition;
4
5
/**
6
 * Interface PartitionAlgorithmInterface.
7
 *
8
 * @package drupol\phpartition
9
 */
10
interface PartitionAlgorithmInterface
11
{
12
13
  /**
14
   * Set the number of partition to use.
15
   *
16
   * @param int $size
17
   *   The number of partition.
18
   */
19
    public function setSize($size);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
20
21
  /**
22
   * Get the size, the number of partition to use.
23
   *
24
   * @return int
25
   *   The number of partition.
26
   */
27
    public function getSize();
28
29
  /**
30
   * Get the partition container object.
31
   *
32
   * @return PartitionContainer
33
   *   The partition container object.
34
   */
35
    public function getPartitionContainer();
36
37
  /**
38
   * Set the original data.
39
   *
40
   * @param mixed[] $data
41
   *   The original data.
42
   */
43
    public function setData(array $data = array());
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
44
45
  /**
46
   * Get the original data.
47
   *
48
   * @return mixed[]
49
   *   The original data.
50
   */
51
    public function getData();
52
53
  /**
54
   * Get the result as array chunks.
55
   *
56
   * @return array
57
   *   The result array.
58
   */
59
    public function getResult();
60
61
  /**
62
   * Set the function used to compute the value of an item.
63
   *
64
   * @param callable $callable
0 ignored issues
show
Documentation introduced by
Should the type for parameter $callable not be null|callable? Also, consider making the array more specific, something like array<String>, or String[].

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive. In addition it looks for parameters that have the generic type array and suggests a stricter type like array<String>.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
65
   *   The function.
66
   */
67
    public function setItemAccessCallback(callable $callable = null);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
68
69
  /**
70
   * Get the function used to compute the value of an item.
71
   *
72
   * @return callable
73
   *   The function.
74
   */
75
    public function getItemAccessCallback();
76
77
  /**
78
   * Get the weight of a partition.
79
   *
80
   * @param \drupol\phpartition\Partition $partition
81
   *   The partition to get the weight from.
82
   *
83
   * @return int|float
84
   *   The weight.
85
   */
86
    public function getPartitionWeight(Partition $partition);
87
88
  /**
89
   * Get the original set of data as a partition.
90
   *
91
   * @return Partition
92
   *   A single partition containing the original items.
93
   */
94
    public function getDataPartition();
95
96
  /**
97
   * Set the original set of data partition.
98
   *
99
   * @param Partition $partition
100
   *   The partition.
101
   */
102
    public function setDataPartition(Partition $partition);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
103
104
  /**
105
   * Generate the original data partition.
106
   *
107
   * @param mixed[] $items
108
   *   The original items.
109
   *
110
   * @return Partition
111
   *   The partition.
112
   */
113
    public function generateDataPartition(array $items = array());
114
115
  /**
116
   * Create and return a new partition, ready to use.
117
   *
118
   * @return Partition
119
   *   A new partition.
120
   */
121
    public function getPartition();
122
}
123