Guest User

Untitled

a guest
Jan 19th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.47 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Laravel\Platforms\SuperV;
  4.  
  5. use RuntimeException;
  6.  
  7. class SuperV
  8. {
  9. /**
  10. * Open source and will stay so
  11. *
  12. * @var bool
  13. */
  14. public static const OPEN_SOURCE = true;
  15.  
  16. /**
  17. * Free and will stay so
  18. *
  19. * @var bool
  20. */
  21. public static const IS_FREE = true;
  22.  
  23. /**
  24. * Started this so long ago
  25. *
  26. * @var bool
  27. */
  28. public static const CREATED_AT = '2017-02-16';
  29.  
  30. /**
  31. * So many times, so many..
  32. *
  33. * @var bool
  34. */
  35. public static const TOTAL_REWRITES = '?';
  36.  
  37. /**
  38. * Current Version
  39. *
  40. * @var \Laravel\Platforms\SuperV\Version
  41. */
  42. protected $version = '0.6.dev';
  43.  
  44. /**
  45. * Depends on Laravel Framework, obviously..
  46. *
  47. * @var \Laravel\Platforms\SuperV\Laravel
  48. */
  49. protected $laravel;
  50.  
  51. /**
  52. * Depends on JWT-Auth package for API authentication
  53. *
  54. * @var \Laravel\Platforms\SuperV\JWTAuth
  55. */
  56. protected $jwtAuth;
  57.  
  58. /**
  59. * Absolutely needs support
  60. *
  61. * @var \Laravel\Community\Support
  62. */
  63. private $support;
  64.  
  65. /**
  66. * SuperV dependencies.
  67. *
  68. * @param \Laravel $laravel
  69. * @param \JWTAuth $jwtAuth
  70. * @param \CommunitySupport $support
  71. */
  72. public function __construct(Laravel $laravel, JWTAuth $jwtAuth, CommunitySupport $support)
  73. {
  74. $this->laravel = $laravel;
  75. $this->jwtAuth = $jwtAuth;
  76. $this->support = $support;
  77. }
  78.  
  79. /**
  80. * Basic info about SuperV
  81. *
  82. * @return string
  83. */
  84. public function getInfo()
  85. {
  86. return 'SuperV is a platform built on Laravel to make your life easier';
  87. }
  88.  
  89. /**
  90. * Get unique platform features
  91. *
  92. * @return \Laravel\Platforms\SuperV\FeatureCollection
  93. */
  94. public function getUniqueFeatures()
  95. {
  96. return (new FeatureCollection([
  97. ModularityFeature::make()
  98. ->improves('Modularity')
  99. ->improves('Reusability')
  100. ->provides('Out of the box testing-ready modules.')
  101. ->boot(),
  102. FrameworkAgnosticismFeature::make()
  103. ->provides('Encapsulated framework features such as routing, validation, migrations, events etc')
  104. ->boot(),
  105. ExtendedMigrationsFeature::make()
  106. ->provides('Single point for resource management for basic usage')
  107. ->provides('CRUD functionality only with migration including relations') // TODO: I should really check this
  108. ->creates('Pivot tables and fields if relation is defined in migrations')
  109. ->provides('Ability to define validation rules in migration')
  110. ->boot(),
  111. DbResourceManagementFeature::make()
  112. ->provides('Pop resource home page to control panel sidebar just with running migrations')
  113. ->provides('No creation of eloquent model files needed. If you need a model file just tell in the migration file')
  114. ->provides('No creation of resource files needed. If you need more features you can extend a resource in a dedicated file')
  115. ->provides('Tabbed relations in resource view with single line of definition in migration')
  116. ->provides('File uploads out of the box if defined as a field in migration')
  117. ->boot(),
  118. SpaFeature::make()
  119. ->provides('Fully customizable SPA VueJS based frontend framework-ish')
  120. ->provides('Tabbed page container which you can navigate between pages w/o closing them') // I don't believe this exists!
  121. ->provides('Ability to control page design with pre-coded components without writing single line of JS code')
  122. ->boot(),
  123. AuthFeature::make()
  124. ->provides('Easy authorization with roles, actions allowing to control the finest areas')
  125. ->provides('Port concept to easier segregation of API routes and Model Composers based on defined urls or url prefixes')
  126. ->boot(),
  127. ]))->unique();
  128. }
  129.  
  130. /**
  131. * Determine if SuperV can be used by current developer
  132. *
  133. * @return bool
  134. */
  135. public function canItBeUsed()
  136. {
  137. if (starts_with($this->version, '0.') && $this->environment->isProduction()) {
  138. return false;
  139. }
  140.  
  141. // Let's return early here..
  142. if ($this->developer->canReadFeaturesFromTests()
  143. || $this->developers->doesNotRequireDocumentation()) {
  144. return true;
  145. }
  146.  
  147. if ($this->developer->requiresPolishedCode()) {
  148. return false;
  149. }
  150.  
  151. if ($this->developer->requiresPerfectVariableNaming()) {
  152. exit;
  153. }
  154.  
  155. if ($this->developer->requiresThreeLineCommentsEachShorterThanPreviousByThreeLetters()) {
  156. return false;
  157. }
  158.  
  159. if ($this->developer->requiresPixelPerfectFrontendDesign()) {
  160. exit;
  161. }
  162.  
  163. if ($this->developer->requires100PercentCodeCoverage()) {
  164. return false;
  165. }
  166.  
  167. return true;
  168. }
  169.  
  170. /**
  171. * Get differences with Nova
  172. *
  173. * @throws DiffNaziDetectedException
  174. */
  175. public function compareWithNova()
  176. {
  177. throw new DiffNaziDetectedException('Please use a diff tool instead');
  178. }
  179.  
  180. /**
  181. * Get differences with Backpack
  182. *
  183. * @throws DiffNaziDetectedException
  184. */
  185. public function compareWithBackpack()
  186. {
  187. throw new DiffNaziDetectedException('Please use a diff tool instead');
  188. }
  189. }
Add Comment
Please, Sign In to add comment