程式碼審查
- Pair Programming (直接的做法 - 時間短 - feedback 慢 - 高密度)
- 可使用在新人加入時
<?php | |
// See https://github.com/web-token/jwt-framework/tree/v1.3.9 for about JWT | |
function createAppleIDSecret() | |
{ | |
$privateKey = file_get_contents('/path/to/your/key'); | |
$keyId = 'key_id'; | |
$teamId = 'team_id'; | |
$clientId = 'client_id'; |
# Docker files | |
.dockerignore | |
Dockerfile | |
# Git files | |
.git | |
# Node files | |
node_modules |
<?php | |
$totalScore = 0; | |
foreach ($exam as $value) { | |
foreach ($value->mocks as $mock) { | |
foreach ($mock->items as $item) { | |
$totalScore += (int)$item->ext->score; | |
} | |
} |
<?php | |
if (!function_exists('mysql_connect')) { | |
function mysql_connect($host, $username, $password) { | |
mysqli_connect($host, $username, $password); | |
} | |
} | |
mysql_connect('127.0.0.1', 'root', 'password'); |
<?php | |
class Client | |
{ | |
public $greetingRules = []; | |
public function __construct() | |
{ | |
$this->greetingRules[] = new MorningGreeting(); | |
$this->greetingRules[] = new AfternoonGreeting(); |
#!/usr/bin/make -f | |
IMAGE := $(shell basename $(shell pwd)) | |
VERSION := latest | |
.PHONY: all build rebuild shell run | |
# ------------------------------------------------------------------------------ | |
all: build |
// ignore import | |
public class TestFragment extends Fragment | |
{ | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) | |
{ | |
return inflater.inflate(R.layout.fragment, container, false); | |
} |
<?php | |
/** | |
* class 教學 | |
* | |
* class 全域需注意的重點: | |
* 1.全域:跟function一樣,一經宣告後,任何地方皆可使用。 | |
* 2.不可重載:跟function一樣,一經宣告後,不可再宣告同名的class | |
* | |
* 建立class的重點: |
<?php | |
/** | |
* php function的重點: | |
* 1.全域:一經宣告後,程式的任何位置都能直接使用,包括class中。 | |
* 2.不可重載:一經宣告後,不能宣告第二次。 | |
* 3.傳值:使用傳值後,外部和內部的參數會毫不相千。 | |
* 4.傳址:使用傳址後,內部對參數的修改,外部的變數也會跟著變動。 | |
* 5.預設值:沒傳參數時,會使用預設值當參數,通常放在參數的最後面(右邊) | |
* 6.回傳值:只能回傳一個值,但可以是任何一種資料型態。 | |
* 7.可變函數:當變數後有"()"時,php會試著找該變數是否有定義為函數。 |