/** * Tests __call * @covers \Copycat\Standard\StdClass::__call() */ public function testCall() { $class = new StdClass(); $class->test = function () { return StdClassTest::TEST; }; /** @noinspection PhpUndefinedMethodInspection */ $this->assertEquals(self::TEST, $class->test()); try { $caught = false; /** @noinspection PhpUndefinedMethodInspection */ $class->testTest(); } catch (Exception $exception) { $caught = true; $this->assertEquals('Method testTest is undefined', $exception->getMessage()); } if (!$caught) { $this->fail('Exception was not caught'); } }
<?php $user = new StdClass(); $user->name = "Romil"; $user->gender = "male"; var_dump($user); $user->name = "Juku"; echo "<br>"; echo $user->name; //error $error = new StdClass(); $error->id = 0; $error->message("Unknown error"); $error->id = 3; $error->message("Wrong password");
public function something() { $object = new StdClass(); $object->call()->something(); }
if ($wp_course_search->get_count_of_all_courses() >= 10 && !isset($_GET['course_id'])) { wp_redirect(admin_url('admin.php?page=courses')); exit; } } $unit_id = ''; $course_id = ''; if (isset($_GET['course_id']) && is_numeric($_GET['course_id'])) { $course_id = (int) $_GET['course_id']; } if (isset($_GET['unit_id']) && is_numeric($_GET['unit_id'])) { $unit_id = (int) $_GET['unit_id']; } $course = new Course($course_id); if (empty($course)) { $course = new StdClass(); } else { $course_object = $course->get_course(); } $units = $course->get_units(); $students_count = $course->get_number_of_students(); ?> <div class="wrap nosubsub course-details cp-wrap"> <div class="icon32" id="icon-themes"><br></div> <?php $tab = isset($_GET['tab']) ? $_GET['tab'] : ''; if (empty($tab)) { $tab = 'overview'; } ?>
<?php normalFunctionCall(); \NSedFunctionCall(); \a\b\NSedFunctionCall(); $variableFunctionCall(); $arrayFunctionCall[1](); $object->methodFunctionCall(); StdClass::staticMethodFunctionCall();
function nonRecursive2($x) { StdClass::nonRecursive2(); }
/** * Determine if the reminder has expired. * * @param StdClass $reminder * @return bool */ protected function reminderExpired($reminder) { $createdPlusHour = $reminder->getCreatedAt()->getTimestamp() + 216000; return $createdPlusHour < $this->getCurrentTime(); }