本文整理汇总了PHP中Strings::underscore方法的典型用法代码示例。如果您正苦于以下问题:PHP Strings::underscore方法的具体用法?PHP Strings::underscore怎么用?PHP Strings::underscore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Strings
的用法示例。
在下文中一共展示了Strings::underscore方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getByName
public function getByName($name, $type, $transpose = 0)
{
$this->name = Strings::strtoupper($name);
$this->type = Strings::underscore($type);
$notes = $this->getNotes();
if (in_array($this->type, array_keys($this->config))) {
$start = array_keys($notes, $this->name);
$note_sum = sizeof($notes) - 1;
if (count($start) > 0) {
if ($start[0] + $transpose < 0) {
$current = $start[0] + $transpose + $note_sum + 1;
} else {
if ($start[0] + $transpose > $note_sum) {
$current = $start[0] + $transpose - $note_sum - 1;
} else {
$current = $start[0] + $transpose;
}
}
$this->scale[] = $notes[$current];
foreach ($this->config[$this->type] as $num) {
$current += $num;
if ($current > $note_sum) {
$current -= $note_sum + 1;
}
$this->scale[] = $notes[$current];
}
return $this->scale;
}
}
}
示例2: getByScale
public function getByScale($name, $type)
{
$scale = new Scale();
$name = Strings::strtoupper($name);
$type = Strings::underscore($type);
$scale->getByName($name, $type);
$scale_notes = $scale->notes;
if (isset($scale_notes) && count($scale_notes) > 0) {
$this->possible = array();
$chords = $this->getTypes();
for ($i = 0; $i < 12; $i++) {
foreach ($chords as $chord) {
$this->chord = null;
$this->getByName("C", $chord, $i);
if ($this->containsNotes($this->chord, $scale_notes)) {
array_push($this->possible, array("name" => current($this->chord), "type" => $chord));
}
}
}
return $this->possible;
}
}