Guest User

Untitled

a guest
Aug 10th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. in_array on objects with circular references
  2. public function addField ($name, ifaceNode $field)
  3. {
  4. // Prevent the same field being added multiple times
  5. if (!in_array ($field, $this -> fields))
  6. {
  7. $this -> fields [$name] = $field;
  8. $field -> setParent ($this);
  9. }
  10. else
  11. {
  12. throw new InvalidArgumentException ('This field cannot be added to this group');
  13. }
  14. return ($this);
  15. }
  16.  
  17. if (!in_array ($field, $this -> fields, true))
Add Comment
Please, Sign In to add comment