本文整理汇总了PHP中Method::set_access方法的典型用法代码示例。如果您正苦于以下问题:PHP Method::set_access方法的具体用法?PHP Method::set_access怎么用?PHP Method::set_access使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Method
的用法示例。
在下文中一共展示了Method::set_access方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_class
//.........这里部分代码省略.........
}
} else {
while ($this->at(',')) {
$this->accept();
$this->s();
$class->add_variable($this->parse_variable($access, $static));
$this->s();
}
}
$this->accept(';');
} elseif ($this->at(T_FUNCTION)) {
$this->accept();
$this->s();
if ($this->at('&')) {
$reference = true;
$this->accept();
$this->s();
} else {
$reference = false;
}
if ($this->at(T_CONSTANT_ENCAPSED_STRING)) {
if ($access != 'public') {
$this->error("pattern matched methods must be public");
}
if ($final) {
$this->error("pattern matched methods cannot be final");
}
if ($abstract) {
$this->error("pattern matched methods cannot be abstract");
}
if ($reference) {
$this->error("pattern matched methods cannot return by reference");
}
$pattern = $this->current_text();
$this->accept();
$this->s();
$args = $this->parse_arg_list();
$this->s();
$body = substr($this->parse_block(), 1, -1);
if ($static) {
$class->add_static_pattern(new Literal($pattern), $args, $body);
} else {
$class->add_pattern(new Literal($pattern), $args, $body);
}
} else {
$ident = $this->parse_ident();
$this->s();
$args = $this->parse_arg_list();
$this->s();
if ($this->at(';')) {
$body = '';
$this->accept();
} else {
$body = substr($this->parse_block(), 1, -1);
}
$method = new Method($ident);
$method->set_access($access);
$method->set_static($static);
$method->set_final($final);
$method->set_abstract($abstract);
$method->set_reference_returned($reference);
$method->set_arg_list($args);
$method->set_body($body);
$class->add_method($method);
if ($member_annotation) {
$method->set_annotation($member_annotation);
}
}
}
} elseif ($this->at(T_EVAL)) {
$this->accept();
$this->s();
$code = $this->parse_block();
class_eval_without_scope($class, $code);
} elseif ($this->at(T_INCLUDE)) {
$this->accept();
$this->s();
$mixin_method = 'mixin';
if ($this->at(T_CONST)) {
$mixin_method .= '_constants';
$this->accept();
$this->s();
} elseif ($this->at(T_STATIC)) {
$mixin_method .= '_static';
$this->accept();
$this->s();
}
$module = $this->parse_absolute_namespaced_ident();
$this->s();
$this->accept(';');
$class->{$mixin_method}($module);
}
$this->s();
}
$this->s();
$this->accept('}');
// forward declarations: after
Forward::apply('after', $class);
return $class;
}