Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Source code recreated from a .class file by IntelliJ IDEA
- // (powered by Fernflower decompiler)
- //
- package com.jetbrains.php.config;
- import com.intellij.openapi.util.text.StringUtil;
- import com.intellij.util.containers.HashSet;
- import com.jetbrains.php.PhpBundle;
- import com.jetbrains.php.config.PhpLanguageFeature;
- import com.jetbrains.php.config.phpInfo.PhpInfo;
- import java.util.Collections;
- import java.util.List;
- import java.util.Set;
- import org.jetbrains.annotations.NotNull;
- import org.jetbrains.annotations.Nullable;
- public enum PhpLanguageLevel {
- PHP530,
- PHP540,
- PHP550,
- PHP560;
- public static final PhpLanguageLevel DEFAULT;
- @NotNull
- private final String myVersionString;
- @NotNull
- private final String myPresentableName;
- @NotNull
- private final String myShortDescription;
- @NotNull
- private final Set<PhpLanguageFeature> myFeatures;
- private PhpLanguageLevel(@NotNull String versionString, @NotNull String presentableName, @NotNull String shortDescription, @NotNull PhpLanguageFeature[] languageFeatures) {
- this.myVersionString = versionString;
- this.myPresentableName = presentableName;
- this.myShortDescription = shortDescription;
- this.myFeatures = new HashSet();
- Collections.addAll(this.myFeatures, languageFeatures);
- }
- private PhpLanguageLevel(@NotNull String versionString, @NotNull String presentableName, @NotNull String shortDescription, @NotNull PhpLanguageLevel base, @NotNull PhpLanguageFeature[] languageFeatures) {
- this.myVersionString = versionString;
- this.myPresentableName = presentableName;
- this.myShortDescription = shortDescription;
- this.myFeatures = new HashSet();
- this.myFeatures.addAll(base.myFeatures);
- Collections.addAll(this.myFeatures, languageFeatures);
- }
- @NotNull
- public String getPresentableName() {
- String var10000 = this.myPresentableName;
- if(this.myPresentableName == null) {
- throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[]{"com/jetbrains/php/config/PhpLanguageLevel", "getPresentableName"}));
- } else {
- return var10000;
- }
- }
- @NotNull
- public String getVersionString() {
- String var10000 = this.myVersionString;
- if(this.myVersionString == null) {
- throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[]{"com/jetbrains/php/config/PhpLanguageLevel", "getVersionString"}));
- } else {
- return var10000;
- }
- }
- @NotNull
- public String getShortDescription() {
- String var10000 = this.myShortDescription;
- if(this.myShortDescription == null) {
- throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[]{"com/jetbrains/php/config/PhpLanguageLevel", "getShortDescription"}));
- } else {
- return var10000;
- }
- }
- public boolean hasFeature(@NotNull PhpLanguageFeature languageFeature) {
- return this.myFeatures.contains(languageFeature);
- }
- @NotNull
- public static PhpLanguageLevel parse(@NotNull String versionString) {
- PhpLanguageLevel var10000;
- if(PHP530.getVersionString().equals(versionString)) {
- var10000 = PHP530;
- if(PHP530 == null) {
- throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[]{"com/jetbrains/php/config/PhpLanguageLevel", "parse"}));
- } else {
- return var10000;
- }
- } else if(PHP540.getVersionString().equals(versionString)) {
- var10000 = PHP540;
- if(PHP540 == null) {
- throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[]{"com/jetbrains/php/config/PhpLanguageLevel", "parse"}));
- } else {
- return var10000;
- }
- } else if(PHP550.getVersionString().equals(versionString)) {
- var10000 = PHP550;
- if(PHP550 == null) {
- throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[]{"com/jetbrains/php/config/PhpLanguageLevel", "parse"}));
- } else {
- return var10000;
- }
- } else if(PHP560.getVersionString().equals(versionString)) {
- var10000 = PHP560;
- if(PHP560 == null) {
- throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[]{"com/jetbrains/php/config/PhpLanguageLevel", "parse"}));
- } else {
- return var10000;
- }
- } else {
- var10000 = DEFAULT;
- if(DEFAULT == null) {
- throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[]{"com/jetbrains/php/config/PhpLanguageLevel", "parse"}));
- } else {
- return var10000;
- }
- }
- }
- @Nullable
- public static PhpLanguageLevel parse(@NotNull PhpInfo phpInfo) {
- List split = StringUtil.split(phpInfo.getVersion(), ".");
- if(split.size() > 1 && ((String)split.get(0)).equals("5")) {
- String version = (String)split.get(1);
- if(version.equals("3")) {
- return PHP530;
- }
- if(version.equals("4")) {
- return PHP540;
- }
- if(version.equals("5")) {
- return PHP550;
- }
- if(version.equals("6")) {
- return PHP560;
- }
- }
- return null;
- }
- static {
- PHP530 = new PhpLanguageLevel("PHP530", 0, "5.3.0", PhpBundle.message("PhpLanguageLevel.5.3.0.presentable.name", new Object[0]), PhpBundle.message("PhpLanguageLevel.5.3.0.short.description", new Object[0]), new PhpLanguageFeature[]{PhpLanguageFeature.VAR_CONTINUE_ARGUMENT, PhpLanguageFeature.VAR_BREAK_ARGUMENT, PhpLanguageFeature.VAR_CONTINUE_ZERO_ARGUMENT, PhpLanguageFeature.VAR_BREAK_ZERO_ARGUMENT, PhpLanguageFeature.CALL_TIME_PASS_BY_REFERENCE});
- PHP540 = new PhpLanguageLevel("PHP540", 1, "5.4.0", PhpBundle.message("PhpLanguageLevel.5.4.0.presentable.name", new Object[0]), PhpBundle.message("PhpLanguageLevel.5.4.0.short.description", new Object[0]), new PhpLanguageFeature[]{PhpLanguageFeature.TRAITS, PhpLanguageFeature.SHORT_ARRAY_SYNTAX, PhpLanguageFeature.CLASS_MEMBER_ACCESS_ON_INSTANTIATION, PhpLanguageFeature.ARRAY_DEREFERENCING, PhpLanguageFeature.THIS_IN_CLOSURE, PhpLanguageFeature.SELF_IN_CLOSURE, PhpLanguageFeature.PARENT_IN_CLOSURE, PhpLanguageFeature.STATIC_IN_CLOSURE, PhpLanguageFeature.BINARY_LITERAL, PhpLanguageFeature.LITERAL_IN_STATIC_CALL, PhpLanguageFeature.BUILT_IN_WEB_SERVER});
- PHP550 = new PhpLanguageLevel("PHP550", 2, "5.5.0", PhpBundle.message("PhpLanguageLevel.5.5.0.presentable.name", new Object[0]), PhpBundle.message("PhpLanguageLevel.5.5.0.short.description", new Object[0]), PHP540, new PhpLanguageFeature[]{PhpLanguageFeature.FINALLY, PhpLanguageFeature.GENERATORS, PhpLanguageFeature.FOREACH_LIST, PhpLanguageFeature.EMPTY_ANY_EXPRESSION, PhpLanguageFeature.IMMEDIATE_DEREFERENCING, PhpLanguageFeature.CLASS_NAME_CONST});
- PHP560 = new PhpLanguageLevel("PHP560", 3, "5.6.0", PhpBundle.message("PhpLanguageLevel.5.6.0.presentable.name", new Object[0]), PhpBundle.message("PhpLanguageLevel.5.6.0.short.description", new Object[0]), PHP550, new PhpLanguageFeature[]{PhpLanguageFeature.CONSTANT_SCALAR_EXPRESSIONS, PhpLanguageFeature.VARIADIC_FUNCTIONS, PhpLanguageFeature.ARGUMENT_UNPACKING, PhpLanguageFeature.EXPONENTIATION, PhpLanguageFeature.USE_FUNCTION_AND_CONST});
- DEFAULT = PHP540;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement