Inheritance: extends Controller
Esempio n. 1
0
 public function testXXX()
 {
     $expectedResult = "Hello, somkiat";
     $hello = new Hello();
     $actualResult = $hello->sayHi("somkiat");
     $this->assertEquals($expectedResult, $actualResult);
 }
Esempio n. 2
0
 /**
  * @magentoDataFixture Magento/Customer/_files/customer.php
  */
 public function testToHtml()
 {
     $this->customerSession->setCustomerId(1);
     $html = $this->block->toHtml();
     $this->assertContains("<div class=\"block block-dashboard-welcome\">", $html);
     $this->assertContains("<strong>Hello, Firstname Lastname!</strong>", $html);
 }
Esempio n. 3
0
 public static function getid()
 {
     self::$subjectid = self::$subjectid + 1;
     echo self::$subjectid;
 }
Esempio n. 4
0
<?php

namespace Com\Iesebres\Dam2\spineda\helloworldcomposer;

require __DIR__ . "/src/Hello.php";
$greetings = new Hello();
$greetings->say_Hello();
Esempio n. 5
0
 public function testRunMethod()
 {
     $hello = new Hello();
     $this->assertEquals("Hello Composer", $hello->run());
 }
Esempio n. 6
0
<?php

require '../src/Hello.php';
$hello = new Hello();
print $hello->greet();
Esempio n. 7
0
<?php

class Hello
{
    public static $greeting = 'hello';
    public static function hello_world()
    {
        print self::$greeting . " world!\n";
    }
}
Hello::hello_world();
Esempio n. 8
0
<?php

//require "Hello.php";
require __DIR__ . "/Hello.php";
$greetings = new Hello();
$greetings->sayHello();
Esempio n. 9
0
<?php

require __DIR__ . "/src/hello.php";
use Com\Iesebre\Dam2\rogermelich\helloworldComposer\hello;
/**
 * Created by PhpStorm.
 * User: roger
 * Date: 6/10/15
 * Time: 19:33
 */
$greatings = new Hello();
$greatings->sayHello();
 public function actionIndex()
 {
     $data = Hello::model()->findAll();
     $this->render('index', array('data' => $data));
 }
Esempio n. 11
0
<?php
include "Hello.php";
$a = new Hello();
$a->bj();

?>
Esempio n. 12
0
<?php

$br = php_sapi_name() == "cli" ? "" : "<br>";
if (!extension_loaded('objects2')) {
    dl('objects2.' . PHP_SHLIB_SUFFIX);
}
$obj = new Hello("leon", 32);
echo $obj->greet();
echo $obj->var;
Esempio n. 13
0
    public function setAge($age)
    {
        if ($this->chain == FALSE) {
            return $this->name = $age;
        } else {
            $this->name = $age;
            return $this;
        }
    }
    public function introduce()
    {
        if (empty($this->name)) {
            print "I need a name!";
        } else {
            if (empty($this->age)) {
                print "I dont have an age!";
            } else {
                printf("Hello there, my name is <b>%s</b> and I am <b>%s</b> years old.", $this->name, $this->age);
            }
        }
    }
}
//$hello = new Hello();
$name = "Tung";
$age = 17;
//echo $hello->setName($name);
//echo $hello->setAge($age);
//$hello->introduce();
$hello = new Hello(true);
// chaining method
$hello->setName($name)->setAge($age)->introduce();
Esempio n. 14
0
 public function getMessage()
 {
     return parent::getMessage() . ", World";
 }
<?php

// Define project specific routes using $app which is an instance of Slim
/*
For example:
$app->get('/foo/bar', function($request, $response, $args) {
    $controller = new \Project\Controllers\Index($this, $request, $response);
    return $controller->index();
});
*/
if (!S3MVC_APP_USE_MVC_ROUTES) {
    //Not using mvc routes. So at least define the default / route.
    //You can change it for your app if desired
    $app->get('/', function ($request, $response, $args) {
        $prepend_action = !S3MVC_APP_AUTO_PREPEND_ACTION_TO_ACTION_METHOD_NAMES;
        $action = $prepend_action ? 'action-index' : 'index';
        $controller = new Hello($this, 'hello', $action);
        return $controller->actionIndex();
    });
}
Esempio n. 16
0
<?php

require_once "lib/Core.php";
require_once "obj/Hello.php";
// インスタンス生成
$obj = new Hello();
// Hello World!!
$obj->sayHello();
Esempio n. 17
0
<?php

/**
 * Created by PhpStorm.
 * User: jim
 * Date: 2015/11/5
 * Time: 22:54
 */
require_once 'hello1.php';
$h = new Hello();
$h->sayHello();
$d = new Desktop();
$d->work();
Esempio n. 18
0
 public function tell()
 {
     Hello::say();
 }
Esempio n. 19
0
<?php

$c = new Hello();
echo $c->getName(), PHP_EOL;
echo Hello::DefaultHello(), PHP_EOL;
Esempio n. 20
0
<?php

class Hello
{
    protected $lang;
    function __construct($lang)
    {
        $this->lang = $lang;
    }
    function greet()
    {
        if ($this->lang == 'fr') {
            return 'Bonjour';
        }
        if ($this->lang == 'es') {
            return 'Hola';
        }
        return 'Hello';
    }
}
$hi = new Hello('es');
echo $hi->greet() . "\n";
Esempio n. 21
0
 public function index()
 {
     $message = Hello::getMessage();
     $this->set(get_defined_vars());
 }
Esempio n. 22
0
 private function __construct($name, $option = null)
 {
     self::$name = $name;
 }