ExitToRightFrames.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. namespace League\CLImate\Tests;
  3. trait ExitToRightFrames
  4. {
  5. abstract protected function shouldWrite($content, $count = 1);
  6. abstract protected function blankLines($count = 1);
  7. abstract protected function emptyFrame();
  8. protected function padStr($str, $pre = 0, $post = 0)
  9. {
  10. return str_repeat(' ', $pre) . $str . str_repeat(' ', $post);
  11. }
  12. protected function fullArtExitRight()
  13. {
  14. $repeat = 71;
  15. $this->shouldWrite("\e[m" . $this->padStr(" _ _ ", 0, $repeat) . "\e[0m")->ordered();
  16. $this->shouldWrite("\e[m" . $this->padStr(" | || | ", 0, $repeat) . "\e[0m")->ordered();
  17. $this->shouldWrite("\e[m" . $this->padStr(" | || |_ ", 0, $repeat) . "\e[0m")->ordered();
  18. $this->shouldWrite("\e[m" . $this->padStr(" |__ _|", 0, $repeat) . "\e[0m")->ordered();
  19. $this->shouldWrite("\e[m" . $this->padStr(" | | ", 0, $repeat) . "\e[0m")->ordered();
  20. $this->shouldWrite("\e[m" . $this->padStr(" |_| ", 0, $repeat) . "\e[0m")->ordered();
  21. }
  22. protected function exitRightFrame($frame, $times = 1)
  23. {
  24. $pre = $frame;
  25. $post = 71 - $frame;
  26. for ($i = 1; $i <= $times; $i++) {
  27. $this->shouldWrite("\e[m\e[6A\r\e[K" . $this->padStr(" _ _ ", $pre, $post) . "\e[0m")->ordered();
  28. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | || | ", $pre, $post) . "\e[0m")->ordered();
  29. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | || |_ ", $pre, $post) . "\e[0m")->ordered();
  30. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |__ _|", $pre, $post) . "\e[0m")->ordered();
  31. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | | ", $pre, $post) . "\e[0m")->ordered();
  32. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |_| ", $pre, $post) . "\e[0m")->ordered();
  33. }
  34. }
  35. protected function exitRightFrameEnd1()
  36. {
  37. $pre = 72;
  38. $this->shouldWrite("\e[m\e[6A\r\e[K" . $this->padStr(" _ _ ", $pre) . "\e[0m")->ordered();
  39. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | || | ", $pre) . "\e[0m")->ordered();
  40. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | || |_", $pre) . "\e[0m")->ordered();
  41. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |__ _", $pre) . "\e[0m")->ordered();
  42. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | | ", $pre) . "\e[0m")->ordered();
  43. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |_| ", $pre) . "\e[0m")->ordered();
  44. }
  45. protected function exitRightFrameEnd2()
  46. {
  47. $pre = 73;
  48. $this->shouldWrite("\e[m\e[6A\r\e[K" . $this->padStr(" _ _ ", $pre) . "\e[0m")->ordered();
  49. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | || |", $pre) . "\e[0m")->ordered();
  50. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | || |", $pre) . "\e[0m")->ordered();
  51. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |__ ", $pre) . "\e[0m")->ordered();
  52. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | |", $pre) . "\e[0m")->ordered();
  53. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |_|", $pre) . "\e[0m")->ordered();
  54. }
  55. protected function exitRightFrameEnd3()
  56. {
  57. $pre = 74;
  58. $this->shouldWrite("\e[m\e[6A\r\e[K" . $this->padStr(" _ _", $pre) . "\e[0m")->ordered();
  59. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | || ", $pre) . "\e[0m")->ordered();
  60. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | || ", $pre) . "\e[0m")->ordered();
  61. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |__ ", $pre) . "\e[0m")->ordered();
  62. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | ", $pre) . "\e[0m")->ordered();
  63. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |_", $pre) . "\e[0m")->ordered();
  64. }
  65. protected function exitRightFrameEnd4()
  66. {
  67. $pre = 75;
  68. $this->shouldWrite("\e[m\e[6A\r\e[K" . $this->padStr(" _ ", $pre) . "\e[0m")->ordered();
  69. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | ||", $pre) . "\e[0m")->ordered();
  70. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | ||", $pre) . "\e[0m")->ordered();
  71. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |__ ", $pre) . "\e[0m")->ordered();
  72. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |", $pre) . "\e[0m")->ordered();
  73. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |", $pre) . "\e[0m")->ordered();
  74. }
  75. protected function exitRightFrameEnd5()
  76. {
  77. $pre = 76;
  78. $this->shouldWrite("\e[m\e[6A\r\e[K" . $this->padStr(" _ ", $pre) . "\e[0m")->ordered();
  79. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | |", $pre) . "\e[0m")->ordered();
  80. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | |", $pre) . "\e[0m")->ordered();
  81. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |__", $pre) . "\e[0m")->ordered();
  82. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" ", $pre) . "\e[0m")->ordered();
  83. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" ", $pre) . "\e[0m")->ordered();
  84. }
  85. protected function exitRightFrameEnd6()
  86. {
  87. $pre = 77;
  88. $this->shouldWrite("\e[m\e[6A\r\e[K" . $this->padStr(" _", $pre) . "\e[0m")->ordered();
  89. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | ", $pre) . "\e[0m")->ordered();
  90. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" | ", $pre) . "\e[0m")->ordered();
  91. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |_", $pre) . "\e[0m")->ordered();
  92. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" ", $pre) . "\e[0m")->ordered();
  93. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" ", $pre) . "\e[0m")->ordered();
  94. }
  95. protected function exitRightFrameEnd7()
  96. {
  97. $pre = 78;
  98. $this->shouldWrite("\e[m\e[6A\r\e[K" . $this->padStr(" ", $pre) . "\e[0m")->ordered();
  99. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |", $pre) . "\e[0m")->ordered();
  100. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |", $pre) . "\e[0m")->ordered();
  101. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" |", $pre) . "\e[0m")->ordered();
  102. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" ", $pre) . "\e[0m")->ordered();
  103. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" ", $pre) . "\e[0m")->ordered();
  104. }
  105. protected function exitRightFrameEnd8()
  106. {
  107. $pre = 79;
  108. $this->shouldWrite("\e[m\e[6A\r\e[K" . $this->padStr(" ", $pre) . "\e[0m")->ordered();
  109. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" ", $pre) . "\e[0m")->ordered();
  110. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" ", $pre) . "\e[0m")->ordered();
  111. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" ", $pre) . "\e[0m")->ordered();
  112. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" ", $pre) . "\e[0m")->ordered();
  113. $this->shouldWrite("\e[m\r\e[K" . $this->padStr(" ", $pre) . "\e[0m")->ordered();
  114. }
  115. protected function exitRightFrameEnd9()
  116. {
  117. $this->shouldWrite("\e[m\e[6A\r\e[K\e[0m")->ordered();
  118. $this->blankLines(5);
  119. }
  120. protected function enterRightFrame1()
  121. {
  122. $this->emptyFrame();
  123. }
  124. }