original_string: protected function requires_serialisation($value, $depth = 1) {
          if (is_scalar($value)) {
              return false;
          } else if (is_array($value) || $value instanceof stdClass || $value instanceof Traversable) {
              if ($depth > 5) {
                  // Skrew it, mega-deep object, developer you suck, we're just going to serialise.
                  return true;
              }
              foreach ($value as $key => $subvalue) {
                  if ($this->requires_serialisation($subvalue, $depth++)) {
                      return true;
                  }
              }
          }
          // Its not scalar, array, or stdClass so we'll need to serialise.
          return true;
      }
code: protected function requires_serialisation($value, $depth = 1) {
          if (is_scalar($value)) {
              return false;
          } else if (is_array($value) || $value instanceof stdClass || $value instanceof Traversable) {
              if ($depth > 5) {
                  // Skrew it, mega-deep object, developer you suck, we're just going to serialise.
                  return true;
              }
              foreach ($value as $key => $subvalue) {
                  if ($this->requires_serialisation($subvalue, $depth++)) {
                      return true;
                  }
              }
          }
          // Its not scalar, array, or stdClass so we'll need to serialise.
          return true;
      }
code_tokens: protected function requires_serialisation ( $ value , $ depth = 1 ) { if ( is_scalar ( $ value ) ) { return false ; } else if ( is_array ( $ value ) || $ value instanceof stdClass || $ value instanceof Traversable ) { if ( $ depth > 5 ) { // Skrew it, mega-deep object, developer you suck, we're just going to serialise. return true ; } foreach ( $ value as $ key => $ subvalue ) { if ( $ this -> requires_serialisation ( $ subvalue , $ depth ++ ) ) { return true ; } } } // Its not scalar, array, or stdClass so we'll need to serialise. return true ; }
docstring: Checks to see if a var requires serialisation.
  
  @param mixed $value The value to check.
  @param int $depth Used to ensure we don't enter an endless loop (think recursion).
  @return bool Returns true if the value is going to require serialisation in order to ensure a reference free copy
  or false if its safe to clone.
docstring_tokens: Checks to see if a var requires serialisation .