compare() public method

Compares current instance of FieldDescriptor with another instance.
public compare ( Sulu\Component\Rest\ListBuilder\FieldDescriptorInterface $other ) : boolean
$other Sulu\Component\Rest\ListBuilder\FieldDescriptorInterface
return boolean
Example #1
0
 /**
  * Returns index of given FieldDescriptor in given array of descriptors.
  * If no match is found, false will be returned.
  *
  * @param FieldDescriptorInterface $fieldDescriptor
  * @param FieldDescriptorInterface[] $fieldDescriptors
  *
  * @return bool|int|string
  */
 protected function retrieveIndexOfFieldDescriptor(FieldDescriptorInterface $fieldDescriptor, array $fieldDescriptors)
 {
     foreach ($fieldDescriptors as $index => $other) {
         if ($fieldDescriptor->compare($other)) {
             return $index;
         }
     }
     return false;
 }