Example #1
0
 /**
  * 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");
Example #3
0
 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';
}
?>
Example #5
0
<?php

normalFunctionCall();
\NSedFunctionCall();
\a\b\NSedFunctionCall();
$variableFunctionCall();
$arrayFunctionCall[1]();
$object->methodFunctionCall();
StdClass::staticMethodFunctionCall();
Example #6
0
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();
 }